summaryrefslogtreecommitdiffstats
path: root/models/user.go
diff options
context:
space:
mode:
authorAndrew Burns <andrew@wyominghealthfairs.com>2014-12-03 16:19:35 -0700
committerAndrew Burns <andrew@wyominghealthfairs.com>2014-12-03 16:19:35 -0700
commit00cf3e4dabf810751bab3c83787c343f5ac6a88c (patch)
treeced006cd42886af42755bdc4ac00ea79f76bde08 /models/user.go
parent955899969890b3176d4327d15fba1a4f170059d8 (diff)
downloadgitea-00cf3e4dabf810751bab3c83787c343f5ac6a88c.tar.gz
gitea-00cf3e4dabf810751bab3c83787c343f5ac6a88c.zip
Use the avatar.HashEmail function instead of hashing email directly. Fixes #700
Diffstat (limited to 'models/user.go')
-rw-r--r--models/user.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/models/user.go b/models/user.go
index 5c6101e62c..a83051dbbd 100644
--- a/models/user.go
+++ b/models/user.go
@@ -21,6 +21,7 @@ import (
"github.com/Unknwon/com"
"github.com/nfnt/resize"
+ "github.com/gogits/gogs/modules/avatar"
"github.com/gogits/gogs/modules/base"
"github.com/gogits/gogs/modules/git"
"github.com/gogits/gogs/modules/log"
@@ -276,8 +277,8 @@ func CreateUser(u *User) error {
}
u.LowerName = strings.ToLower(u.Name)
- u.Avatar = base.EncodeMd5(u.Email)
u.AvatarEmail = u.Email
+ u.Avatar = avatar.HashEmail(u.AvatarEmail)
u.Rands = GetUserSalt()
u.Salt = GetUserSalt()
u.EncodePasswd()
@@ -436,6 +437,11 @@ func UpdateUser(u *User) error {
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)
return err
}