当前位置: 首页>>代码示例>>Golang>>正文


Golang base.CreateTimeLimitCode函数代码示例

本文整理汇总了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
}
开发者ID:josephyzhou,项目名称:gogs,代码行数:10,代码来源:mail.go

示例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
}
开发者ID:jessezwd,项目名称:gogs,代码行数:10,代码来源:user.go

示例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
}
开发者ID:kevinc0825,项目名称:gogs,代码行数:10,代码来源:mail.go


注:本文中的github.com/gogits/gogs/modules/base.CreateTimeLimitCode函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。