Skip to content

Commit

Permalink
Merge pull request #42 from ariebrainware/develop
Browse files Browse the repository at this point in the history
Patch Release v1.1.3
  • Loading branch information
ariebrainware authored Nov 8, 2019
2 parents 116baf5 + f62dee9 commit 3d78349
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions endpoint/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,18 +357,14 @@ func Auth(c *gin.Context) {
if logging.Token == "" {
util.CallServerError(c, "you have to sign in first", nil)
c.Abort()
} else if token != nil && err != nil {
} else if token != nil && time.Unix(claim.ExpiresAt, 0).Sub(time.Now()) < 30*time.Second {
util.CallUserError(c, "token expired", err)
err = config.DB.Model(&logging).Where("token = ?", tokenString).Delete(&logging).Error
if err != nil {
fmt.Println(err)
util.CallServerError(c, "fail when try to delete the logging", err)
}
c.Abort()
}
if time.Unix(claim.ExpiresAt, 0).Sub(time.Now()) > 30*time.Second {
return
}

err = config.DB.Model(&logging).Where("token = ?", tokenString).Delete(&logging).Error
if err != nil {
fmt.Println(err)
util.CallServerError(c, "fail when try to delete the logging", err)
return
}
}
Expand Down

0 comments on commit 3d78349

Please sign in to comment.