Browse Source

Ensure only own addresses are updated (#10397)

tags/v1.10.5
guillep2k 4 years ago
parent
commit
cfcd8e4146
No account linked to committer's email address
2 changed files with 2 additions and 2 deletions
  1. 1
    1
      models/user.go
  2. 1
    1
      models/user_mail.go

+ 1
- 1
models/user.go View File

data := com.ToStr(user.ID) + email + user.LowerName + user.Passwd + user.Rands data := com.ToStr(user.ID) + email + user.LowerName + user.Passwd + user.Rands


if base.VerifyTimeLimitCode(data, minutes, prefix) { if base.VerifyTimeLimitCode(data, minutes, prefix) {
emailAddress := &EmailAddress{Email: email}
emailAddress := &EmailAddress{UID: user.ID, Email: email}
if has, _ := x.Get(emailAddress); has { if has, _ := x.Get(emailAddress); has {
return emailAddress return emailAddress
} }

+ 1
- 1
models/user_mail.go View File

} }


// Make sure the former primary email doesn't disappear. // Make sure the former primary email doesn't disappear.
formerPrimaryEmail := &EmailAddress{Email: user.Email}
formerPrimaryEmail := &EmailAddress{UID: user.ID, Email: user.Email}
has, err = x.Get(formerPrimaryEmail) has, err = x.Get(formerPrimaryEmail)
if err != nil { if err != nil {
return err return err

Loading…
Cancel
Save