Hide a users email everywhere (#69)
This commit is contained in:
@ -44,7 +44,7 @@ type User struct {
|
||||
Username string `xorm:"varchar(250) not null unique" json:"username" valid:"length(3|250)" minLength:"3" maxLength:"250"`
|
||||
Password string `xorm:"varchar(250) not null" json:"-"`
|
||||
// The user's email address.
|
||||
Email string `xorm:"varchar(250) null" json:"email" valid:"email,length(0|250)" maxLength:"250"`
|
||||
Email string `xorm:"varchar(250) null" json:"email,omitonempty" valid:"email,length(0|250)" maxLength:"250"`
|
||||
IsActive bool `xorm:"null" json:"-"`
|
||||
|
||||
PasswordResetToken string `xorm:"varchar(450) null" json:"-"`
|
||||
@ -58,6 +58,11 @@ type User struct {
|
||||
web.Auth `xorm:"-" json:"-"`
|
||||
}
|
||||
|
||||
// AfterLoad is used to delete all emails to not have them leaked to the user
|
||||
func (u *User) AfterLoad() {
|
||||
u.Email = ""
|
||||
}
|
||||
|
||||
// AuthDummy implements the auth of the crud handler
|
||||
func (User) AuthDummy() {}
|
||||
|
||||
|
Reference in New Issue
Block a user