aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorguillep2k <18600385+guillep2k@users.noreply.github.com>2020-02-21 10:35:17 -0300
committerGitHub <noreply@github.com>2020-02-21 10:35:17 -0300
commit3cee15e6f9931df6c009dd802a4e12ea494286fc (patch)
treeb3af70d47a2b515c662546f95747375c3d6a5dad
parent34e3644adacd0823b18969517a3dafb29b0bd303 (diff)
downloadgitea-3cee15e6f9931df6c009dd802a4e12ea494286fc.tar.gz
gitea-3cee15e6f9931df6c009dd802a4e12ea494286fc.zip
Ensure only own addresses are updated (#10397) (#10399)
-rw-r--r--models/user.go2
-rw-r--r--models/user_mail.go2
2 files changed, 2 insertions, 2 deletions
diff --git a/models/user.go b/models/user.go
index 5760bab57d..c515bd222b 100644
--- a/models/user.go
+++ b/models/user.go
@@ -989,7 +989,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