feat: invalidate old token after changing the password (close #5515)
This commit is contained in:
@ -57,6 +57,12 @@ func Auth(c *gin.Context) {
|
||||
c.Abort()
|
||||
return
|
||||
}
|
||||
// validate password timestamp
|
||||
if userClaims.PwdTS != user.PwdTS {
|
||||
common.ErrorStrResp(c, "Password has been changed, login please", 401)
|
||||
c.Abort()
|
||||
return
|
||||
}
|
||||
if user.Disabled {
|
||||
common.ErrorStrResp(c, "Current user is disabled, replace please", 401)
|
||||
c.Abort()
|
||||
@ -105,6 +111,12 @@ func Authn(c *gin.Context) {
|
||||
c.Abort()
|
||||
return
|
||||
}
|
||||
// validate password timestamp
|
||||
if userClaims.PwdTS != user.PwdTS {
|
||||
common.ErrorStrResp(c, "Password has been changed, login please", 401)
|
||||
c.Abort()
|
||||
return
|
||||
}
|
||||
if user.Disabled {
|
||||
common.ErrorStrResp(c, "Current user is disabled, replace please", 401)
|
||||
c.Abort()
|
||||
|
Reference in New Issue
Block a user