username password bug修复

This commit is contained in:
pixelqm
2019-09-14 22:30:28 +08:00
parent a0fab80d28
commit 36d0f9414b
2 changed files with 9 additions and 9 deletions

View File

@@ -39,7 +39,7 @@ func Regist(c *gin.Context) {
"user": user,
})
} else {
servers.ReportFormat(c, false, "创建成功", gin.H{
servers.ReportFormat(c, true, "创建成功", gin.H{
"user": user,
})
}
@@ -73,16 +73,16 @@ func tokenNext(c *gin.Context, user dbModel.User) {
NickName: user.NickName,
AuthorityId: user.AuthorityId,
StandardClaims: jwt.StandardClaims{
NotBefore: int64(time.Now().Unix() - 1000), // 签名生效时间
ExpiresAt: int64(time.Now().Unix() + 3600*7), // 过期时间 一周
Issuer: "qmPlus", //签名的发行者
NotBefore: int64(time.Now().Unix() - 1000), // 签名生效时间
ExpiresAt: int64(time.Now().Unix() + 60*60*24*7), // 过期时间 一周
Issuer: "qmPlus", //签名的发行者
},
}
token, err := j.CreateToken(clams)
if err != nil {
servers.ReportFormat(c, false, "获取token失败", gin.H{})
} else {
servers.ReportFormat(c, true, "登录成功", gin.H{"user": user, "token": token})
servers.ReportFormat(c, true, "登录成功", gin.H{"user": user, "token": token, "expiresAt": clams.StandardClaims.ExpiresAt * 1000})
}
}