Compare commits
No commits in common. "d1d4f6b6790ebec29adcd74e91c584155ff566ce" and "f941ee46d469a3f0a6302b188f566029fdec4e70" have entirely different histories.
d1d4f6b679
...
f941ee46d4
|
@ -168,16 +168,9 @@ func Logout(token string) error {
|
|||
}
|
||||
|
||||
func VerifyLoginToken(token string) error {
|
||||
uvt, err := jwt.Decode([]byte(token))
|
||||
_, err := jwt.Verify(jwt.HS256, sharedKey, []byte(token), blocklist)
|
||||
if err != nil {
|
||||
return ErrInvalidToken
|
||||
}
|
||||
|
||||
var claim jwt.Claims
|
||||
|
||||
err = uvt.Claims(&claim)
|
||||
if err != nil {
|
||||
return ErrInvalidToken
|
||||
return err
|
||||
}
|
||||
|
||||
session := model.LoginSession{}
|
||||
|
@ -186,11 +179,5 @@ func VerifyLoginToken(token string) error {
|
|||
return ErrInvalidToken
|
||||
}
|
||||
|
||||
_, err = jwt.Verify(jwt.HS256, sharedKey, []byte(token), blocklist)
|
||||
if err != nil {
|
||||
db.Get().Delete(&session)
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue