summaryrefslogtreecommitdiffstats
path: root/models/user_mail.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/user_mail.go')
-rw-r--r--models/user_mail.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/models/user_mail.go b/models/user_mail.go
index af9602e714..60354e23ff 100644
--- a/models/user_mail.go
+++ b/models/user_mail.go
@@ -71,8 +71,8 @@ func GetEmailAddresses(uid int64) ([]*EmailAddress, error) {
// GetEmailAddressByID gets a user's email address by ID
func GetEmailAddressByID(uid, id int64) (*EmailAddress, error) {
// User ID is required for security reasons
- email := &EmailAddress{ID: id, UID: uid}
- if has, err := x.Get(email); err != nil {
+ email := &EmailAddress{UID: uid}
+ if has, err := x.ID(id).Get(email); err != nil {
return nil, err
} else if !has {
return nil, nil
@@ -126,7 +126,7 @@ func isEmailUsed(e Engine, email string) (bool, error) {
return true, nil
}
- return e.Get(&EmailAddress{Email: email})
+ return e.Where("email=?", email).Get(&EmailAddress{})
}
// IsEmailUsed returns true if the email has been used.
@@ -251,8 +251,8 @@ func MakeEmailPrimary(email *EmailAddress) error {
return ErrEmailNotActivated
}
- user := &User{ID: email.UID}
- has, err = x.Get(user)
+ user := &User{}
+ has, err = x.ID(email.UID).Get(user)
if err != nil {
return err
} else if !has {