jwt登录时,内存存储结构不一致
Rurikou opened this issue · comments
position:
jwt.go
if err := bcrypt.CompareHashAndPassword([]byte(m.Password), []byte(inputPassword)); err != nil {
// when password failed reties will add 1
loginRetries = loginRetries + 1
mem.Set(loginTryKey, loginRetries)
return nil, err
}
m.Password = ""
//save login user into the memory store
mem.Set(key, m) //error:mem:has value of this id, but is not type of *jwtObj 报错
return jwtGenerateToken(m)
model_user.go
if err != nil {
logrus.WithError(err).Fatal("config is wrong, can not generate jwt")
}
data := &jwtObj{SysUser: *m, Token: tokenString, Expire: expireTime, ExpireTs: expireTime.Unix()}
key := fmt.Sprintf("login:%d", m.Id)//set key name
mem.Set(key, data) //verified pass 验证通过
return data, err
这里是不是有逻辑错误呢?新手提第一次提issue!
已经修复了jwt的错误,
使用 go get -u github.com/dejavuzhou/ginbro 更新一下