mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-05-20 14:00:04 +02:00
user gomail and new activate account email tpl
- #1496: fallback plain text - #1002: add date header - #913: fix encoding of header
This commit is contained in:
parent
e75fd2f783
commit
373731f5e8
16 changed files with 187 additions and 302 deletions
|
@ -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))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue