Skip to content

Commit cfcd8e4

Browse files
authored
Ensure only own addresses are updated (#10397)
1 parent ac18c3f commit cfcd8e4

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
@@ -1025,7 +1025,7 @@ func VerifyActiveEmailCode(code, email string) *EmailAddress {
10251025
data := com.ToStr(user.ID) + email + user.LowerName + user.Passwd + user.Rands
10261026

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

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)