Skip to content

Commit 3cee15e

Browse files
authored
Ensure only own addresses are updated (go-gitea#10397) (go-gitea#10399)
1 parent 34e3644 commit 3cee15e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

models/user.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -989,7 +989,7 @@ func VerifyActiveEmailCode(code, email string) *EmailAddress {
989989
data := com.ToStr(user.ID) + email + user.LowerName + user.Passwd + user.Rands
990990

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

models/user_mail.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ func MakeEmailPrimary(email *EmailAddress) error {
201201
}
202202

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

0 commit comments

Comments
 (0)