Always store primary email address into email_address table and also the state (#15956)
* Always store primary email address into email_address table and also the state * Add lower_email to not convert email to lower as what's added * Fix fixture * Fix tests * Use BeforeInsert to save lower email * Fix v180 migration * fix tests * Fix test * Remove wrong submited codes * Fix test * Fix test * Fix test * Add test for v181 migration * remove change user's email to lower * Revert change on user's email column * Fix lower email * Fix test * Fix test
This commit is contained in:
parent
21cde5c439
commit
b9d611e917
11 changed files with 594 additions and 237 deletions
|
@ -237,6 +237,21 @@ func (err ErrEmailAddressNotExist) Error() string {
|
|||
return fmt.Sprintf("Email address does not exist [email: %s]", err.Email)
|
||||
}
|
||||
|
||||
// ErrPrimaryEmailCannotDelete primary email address cannot be deleted
|
||||
type ErrPrimaryEmailCannotDelete struct {
|
||||
Email string
|
||||
}
|
||||
|
||||
// IsErrPrimaryEmailCannotDelete checks if an error is an ErrPrimaryEmailCannotDelete
|
||||
func IsErrPrimaryEmailCannotDelete(err error) bool {
|
||||
_, ok := err.(ErrPrimaryEmailCannotDelete)
|
||||
return ok
|
||||
}
|
||||
|
||||
func (err ErrPrimaryEmailCannotDelete) Error() string {
|
||||
return fmt.Sprintf("Primary email address cannot be deleted [email: %s]", err.Email)
|
||||
}
|
||||
|
||||
// ErrOpenIDAlreadyUsed represents a "OpenIDAlreadyUsed" kind of error.
|
||||
type ErrOpenIDAlreadyUsed struct {
|
||||
OpenID string
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue