Skip to content

Commit

Permalink
Fix auth bug that didn't terminate route on auth error
Browse files Browse the repository at this point in the history
Signed-off-by: Gary Greene <greeneg@tolharadys.net>
  • Loading branch information
greeneg committed Mar 24, 2024
1 parent ca7468f commit ededb60
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions middleware/authen.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ func AuthCheck(c *gin.Context) {
if err := session.Save(); err != nil {
c.IndentedJSON(http.StatusInternalServerError,
gin.H{"error": "failed to save user session"})
// session saving is not fatal, so allow them to proceed
}
log.Println("INFO: Authenticated")
} else {
Expand All @@ -81,6 +82,7 @@ func AuthCheck(c *gin.Context) {
if err != nil {
log.Println("ERROR: " + string(err.Error()))
c.IndentedJSON(http.StatusUnauthorized, gin.H{"error": "unable to authenticate: " + err.Error()})
c.Abort()
return
}
status := helpers.CheckIsNotLocked(user)
Expand Down

0 comments on commit ededb60

Please sign in to comment.