diff options
author | Unknwon <u@gogs.io> | 2015-09-17 01:54:12 -0400 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2015-09-17 01:54:12 -0400 |
commit | 373731f5e85566eb385e92f604e81232e3d6ba1a (patch) | |
tree | 83311e464adf24f3006030e27473086e43a11240 /models | |
parent | e75fd2f783a413ae612e3e6110c912b3ecf9555d (diff) | |
download | gitea-373731f5e85566eb385e92f604e81232e3d6ba1a.tar.gz gitea-373731f5e85566eb385e92f604e81232e3d6ba1a.zip |
user gomail and new activate account email tpl
- #1496: fallback plain text
- #1002: add date header
- #913: fix encoding of header
Diffstat (limited to 'models')
-rw-r--r-- | models/user.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/models/user.go b/models/user.go index 9450860eb2..f824e2bd59 100644 --- a/models/user.go +++ b/models/user.go @@ -133,6 +133,22 @@ func (u *User) HomeLink() string { return setting.AppSubUrl + "/" + u.Name } +// GenerateEmailActivateCode generates an activate code based on user information and given e-mail. +func (u *User) GenerateEmailActivateCode(email string) string { + code := base.CreateTimeLimitCode( + com.ToStr(u.Id)+email+u.LowerName+u.Passwd+u.Rands, + setting.Service.ActiveCodeLives, nil) + + // Add tail hex username + code += hex.EncodeToString([]byte(u.LowerName)) + return code +} + +// GenerateActivateCode generates an activate code based on user information. +func (u *User) GenerateActivateCode() string { + return u.GenerateEmailActivateCode(u.Email) +} + // CustomAvatarPath returns user custom avatar file path. func (u *User) CustomAvatarPath() string { return filepath.Join(setting.AvatarUploadPath, com.ToStr(u.Id)) |