@ -71,8 +71,8 @@ func GetEmailAddresses(uid int64) ([]*EmailAddress, error) {
// GetEmailAddressByID gets a user's email address by ID
// GetEmailAddressByID gets a user's email address by ID
func GetEmailAddressByID ( uid , id int64 ) ( * EmailAddress , error ) {
func GetEmailAddressByID ( uid , id int64 ) ( * EmailAddress , error ) {
// User ID is required for security reasons
// User ID is required for security reasons
email := & EmailAddress { ID : id , UID : uid }
email := & EmailAddress { UID : uid }
if has , err := x . Get ( email ) ; err != nil {
if has , err := x . ID ( id ) . Get ( email ) ; err != nil {
return nil , err
return nil , err
} else if ! has {
} else if ! has {
return nil , nil
return nil , nil
@ -126,7 +126,7 @@ func isEmailUsed(e Engine, email string) (bool, error) {
return true , nil
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.
// IsEmailUsed returns true if the email has been used.
@ -251,8 +251,8 @@ func MakeEmailPrimary(email *EmailAddress) error {
return ErrEmailNotActivated
return ErrEmailNotActivated
}
}
user := & User { ID : email . UID }
user := & User { }
has , err = x . Get ( user )
has , err = x . ID ( email . UID ) . Get ( user )
if err != nil {
if err != nil {
return err
return err
} else if ! has {
} else if ! has {