本文整理汇总了Golang中github.com/gogits/gogs/modules/base.CreateTimeLimitCode函数的典型用法代码示例。如果您正苦于以下问题:Golang CreateTimeLimitCode函数的具体用法?Golang CreateTimeLimitCode怎么用?Golang CreateTimeLimitCode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CreateTimeLimitCode函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: CreateUserActiveCode
// create a time limit code for user active
func CreateUserActiveCode(user *models.User, startInf interface{}) string {
minutes := base.Service.ActiveCodeLives
data := base.ToStr(user.Id) + user.Email + user.LowerName + user.Passwd + user.Rands
code := base.CreateTimeLimitCode(data, minutes, startInf)
// add tail hex username
code += hex.EncodeToString([]byte(user.LowerName))
return code
}
示例2: GenerateEmailActivateCode
// 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
}
示例3: CreateUserEmailActivateCode
// create a time limit code for user active
func CreateUserEmailActivateCode(u *models.User, e *models.EmailAddress, startInf interface{}) string {
minutes := setting.Service.ActiveCodeLives
data := com.ToStr(u.Id) + e.Email + u.LowerName + u.Passwd + u.Rands
code := base.CreateTimeLimitCode(data, minutes, startInf)
// add tail hex username
code += hex.EncodeToString([]byte(u.LowerName))
return code
}