aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--models/user.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/models/user.go b/models/user.go
index e32a29ae31..1dbd63dce0 100644
--- a/models/user.go
+++ b/models/user.go
@@ -600,6 +600,15 @@ func CreateUser(u *User) (err error) {
}
u.Email = strings.ToLower(u.Email)
+ has, err := x.
+ Where("email=?", u.Email).
+ Get(new(User))
+ if err != nil {
+ return err
+ } else if has {
+ return ErrEmailAlreadyUsed{u.Email}
+ }
+
isExist, err = IsEmailUsed(u.Email)
if err != nil {
return err