示例#1
0
文件: auth.go 项目: wildex/wetalk
func WriteRememberCookie(user *models.User, ctx *context.Context) {
	secret := utils.EncodeMd5(user.Rands + user.Password)
	days := 86400 * setting.LoginRememberDays
	ctx.SetCookie(setting.CookieUserName, user.UserName, days)
	ctx.SetSecureCookie(secret, setting.CookieRememberName, user.UserName, days)
}
示例#2
0
文件: base.go 项目: thanzen/identity
func (this *BaseController) WriteRememberCookie(u *user.User, ctx *context.Context) {
	secret := utils.EncodeMd5(u.PasswordSalt + u.Password)
	days := 86400 * setting.LoginRememberDays
	ctx.SetCookie(setting.CookieUsername, u.Username, days)
	ctx.SetSecureCookie(secret, setting.CookieRememberName, u.Username, days)
}