Merge pull request #708 from ErebusBat/master
Use the avatar.HashEmail function instead of hashing email directly.
This commit is contained in:
commit
f7f4ea1dcf
1 changed files with 7 additions and 1 deletions
|
@ -21,6 +21,7 @@ import (
|
||||||
"github.com/Unknwon/com"
|
"github.com/Unknwon/com"
|
||||||
"github.com/nfnt/resize"
|
"github.com/nfnt/resize"
|
||||||
|
|
||||||
|
"github.com/gogits/gogs/modules/avatar"
|
||||||
"github.com/gogits/gogs/modules/base"
|
"github.com/gogits/gogs/modules/base"
|
||||||
"github.com/gogits/gogs/modules/git"
|
"github.com/gogits/gogs/modules/git"
|
||||||
"github.com/gogits/gogs/modules/log"
|
"github.com/gogits/gogs/modules/log"
|
||||||
|
@ -276,8 +277,8 @@ func CreateUser(u *User) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
u.LowerName = strings.ToLower(u.Name)
|
u.LowerName = strings.ToLower(u.Name)
|
||||||
u.Avatar = base.EncodeMd5(u.Email)
|
|
||||||
u.AvatarEmail = u.Email
|
u.AvatarEmail = u.Email
|
||||||
|
u.Avatar = avatar.HashEmail(u.AvatarEmail)
|
||||||
u.Rands = GetUserSalt()
|
u.Rands = GetUserSalt()
|
||||||
u.Salt = GetUserSalt()
|
u.Salt = GetUserSalt()
|
||||||
u.EncodePasswd()
|
u.EncodePasswd()
|
||||||
|
@ -436,6 +437,11 @@ func UpdateUser(u *User) error {
|
||||||
u.Description = u.Description[:255]
|
u.Description = u.Description[:255]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if u.AvatarEmail == "" {
|
||||||
|
u.AvatarEmail = u.Email
|
||||||
|
}
|
||||||
|
u.Avatar = avatar.HashEmail(u.AvatarEmail)
|
||||||
|
|
||||||
_, err = x.Id(u.Id).AllCols().Update(u)
|
_, err = x.Id(u.Id).AllCols().Update(u)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue