1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 10:18:38 +00:00
This commit is contained in:
Unknwon
2014-11-30 18:29:16 -05:00
parent 82da024a4d
commit 5338808600
2 changed files with 17 additions and 4 deletions

View File

@@ -417,6 +417,13 @@ func ChangeUserName(u *User, newUserName string) (err error) {
// UpdateUser updates user's information.
func UpdateUser(u *User) error {
has, err := x.Where("id != ?", u.Id).And("email = ?", u.Email).Get(new(User))
if err != nil {
return err
} else if has {
return ErrEmailAlreadyUsed
}
u.LowerName = strings.ToLower(u.Name)
if len(u.Location) > 255 {
@@ -429,7 +436,7 @@ func UpdateUser(u *User) error {
u.Description = u.Description[:255]
}
_, err := x.Id(u.Id).AllCols().Update(u)
_, err = x.Id(u.Id).AllCols().Update(u)
return err
}