Skip to content

Commit

Permalink
[fix] #95
Browse files Browse the repository at this point in the history
  • Loading branch information
yoneyan committed Jul 6, 2021
1 parent 2d00ffd commit 7653dd5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/api/core/group/info/v0/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ func Get(c *gin.Context) {
authResult := auth.UserAuthentication(core.Token{UserToken: userToken, AccessToken: accessToken})
if authResult.Err != nil {
c.JSON(http.StatusUnauthorized, common.Error{Error: authResult.Err.Error()})
return
}

// User
Expand Down
5 changes: 5 additions & 0 deletions pkg/api/core/token/v0/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ func Delete(c *gin.Context) {
return
}

if len(result.Token) == 0 {
c.JSON(http.StatusUnauthorized, common.Error{Error: "Error: Unauthorized..."})
return
}

logging.WriteLog(strconv.Itoa(int(result.Token[0].User.ID))+"-"+result.Token[0].User.Name, "Logout")

if err := dbToken.Delete(&core.Token{Model: gorm.Model{ID: result.Token[0].ID}}); err != nil {
Expand Down

0 comments on commit 7653dd5

Please sign in to comment.