File tree Expand file tree Collapse file tree 1 file changed +6
-10
lines changed Expand file tree Collapse file tree 1 file changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -357,18 +357,14 @@ func Auth(c *gin.Context) {
357
357
if logging .Token == "" {
358
358
util .CallServerError (c , "you have to sign in first" , nil )
359
359
c .Abort ()
360
- } else if token != nil && err != nil {
360
+ } else if token != nil && time . Unix ( claim . ExpiresAt , 0 ). Sub ( time . Now ()) < 30 * time . Second {
361
361
util .CallUserError (c , "token expired" , err )
362
+ err = config .DB .Model (& logging ).Where ("token = ?" , tokenString ).Delete (& logging ).Error
363
+ if err != nil {
364
+ fmt .Println (err )
365
+ util .CallServerError (c , "fail when try to delete the logging" , err )
366
+ }
362
367
c .Abort ()
363
- }
364
- if time .Unix (claim .ExpiresAt , 0 ).Sub (time .Now ()) > 30 * time .Second {
365
- return
366
- }
367
-
368
- err = config .DB .Model (& logging ).Where ("token = ?" , tokenString ).Delete (& logging ).Error
369
- if err != nil {
370
- fmt .Println (err )
371
- util .CallServerError (c , "fail when try to delete the logging" , err )
372
368
return
373
369
}
374
370
}
You can’t perform that action at this time.
0 commit comments