diff options
author | guillep2k <18600385+guillep2k@users.noreply.github.com> | 2020-02-21 10:08:04 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-21 10:08:04 -0300 |
commit | cfcd8e41467dd17c13c2ef80a6f12ae883f1f9f3 (patch) | |
tree | 74920ec597c768fedf3f35238b36363980c31ae6 /models | |
parent | ac18c3f6f279959decb1ae96027b909841dc5412 (diff) | |
download | gitea-cfcd8e41467dd17c13c2ef80a6f12ae883f1f9f3.tar.gz gitea-cfcd8e41467dd17c13c2ef80a6f12ae883f1f9f3.zip |
Ensure only own addresses are updated (#10397)
Diffstat (limited to 'models')
-rw-r--r-- | models/user.go | 2 | ||||
-rw-r--r-- | models/user_mail.go | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/models/user.go b/models/user.go index d77a54b069..5031849f90 100644 --- a/models/user.go +++ b/models/user.go @@ -1025,7 +1025,7 @@ func VerifyActiveEmailCode(code, email string) *EmailAddress { data := com.ToStr(user.ID) + email + user.LowerName + user.Passwd + user.Rands if base.VerifyTimeLimitCode(data, minutes, prefix) { - emailAddress := &EmailAddress{Email: email} + emailAddress := &EmailAddress{UID: user.ID, Email: email} if has, _ := x.Get(emailAddress); has { return emailAddress } diff --git a/models/user_mail.go b/models/user_mail.go index d929ba5a5d..41f08c9db2 100644 --- a/models/user_mail.go +++ b/models/user_mail.go @@ -201,7 +201,7 @@ func MakeEmailPrimary(email *EmailAddress) error { } // 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) if err != nil { return err |