diff options
Diffstat (limited to 'backend/handlers/login.go')
| -rw-r--r-- | backend/handlers/login.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/backend/handlers/login.go b/backend/handlers/login.go index b0f5ef6..1a74166 100644 --- a/backend/handlers/login.go +++ b/backend/handlers/login.go | |||
| @@ -37,7 +37,7 @@ func Login(c *gin.Context) { | |||
| 37 | default: | 37 | default: |
| 38 | steamID, err := openID.ValidateAndGetID() | 38 | steamID, err := openID.ValidateAndGetID() |
| 39 | if err != nil { | 39 | if err != nil { |
| 40 | CreateLog(steamID, LogTypeUser, LogDescriptionUserLoginFailValidate) | 40 | CreateLog(steamID, LogTypeUser, LogDescriptionUserLoginFailValidate, err.Error()) |
| 41 | c.JSON(http.StatusOK, models.ErrorResponse(err.Error())) | 41 | c.JSON(http.StatusOK, models.ErrorResponse(err.Error())) |
| 42 | return | 42 | return |
| 43 | } | 43 | } |
| @@ -48,7 +48,7 @@ func Login(c *gin.Context) { | |||
| 48 | if checkSteamID == 0 { | 48 | if checkSteamID == 0 { |
| 49 | user, err := GetPlayerSummaries(steamID, os.Getenv("API_KEY")) | 49 | user, err := GetPlayerSummaries(steamID, os.Getenv("API_KEY")) |
| 50 | if err != nil { | 50 | if err != nil { |
| 51 | CreateLog(steamID, LogTypeUser, LogDescriptionUserLoginFailSummary) | 51 | CreateLog(steamID, LogTypeUser, LogDescriptionUserLoginFailSummary, err.Error()) |
| 52 | c.JSON(http.StatusOK, models.ErrorResponse(err.Error())) | 52 | c.JSON(http.StatusOK, models.ErrorResponse(err.Error())) |
| 53 | return | 53 | return |
| 54 | } | 54 | } |
| @@ -78,12 +78,12 @@ func Login(c *gin.Context) { | |||
| 78 | // Sign and get the complete encoded token as a string using the secret | 78 | // Sign and get the complete encoded token as a string using the secret |
| 79 | tokenString, err := token.SignedString([]byte(os.Getenv("SECRET_KEY"))) | 79 | tokenString, err := token.SignedString([]byte(os.Getenv("SECRET_KEY"))) |
| 80 | if err != nil { | 80 | if err != nil { |
| 81 | CreateLog(steamID, LogTypeUser, LogDescriptionUserLoginFailToken) | 81 | CreateLog(steamID, LogTypeUser, LogDescriptionUserLoginFailToken, err.Error()) |
| 82 | c.JSON(http.StatusOK, models.ErrorResponse("Failed to generate token.")) | 82 | c.JSON(http.StatusOK, models.ErrorResponse("Failed to generate token.")) |
| 83 | return | 83 | return |
| 84 | } | 84 | } |
| 85 | c.SetCookie("token", tokenString, 3600*24*30, "/", "", true, true) | 85 | c.SetCookie("token", tokenString, 3600*24*30, "/", "", true, true) |
| 86 | CreateLog(steamID, LogTypeUser, LogDescriptionUserLoginSuccess) | 86 | // CreateLog(steamID, LogTypeUser, LogDescriptionUserLoginSuccess) |
| 87 | c.Redirect(http.StatusTemporaryRedirect, "/") | 87 | c.Redirect(http.StatusTemporaryRedirect, "/") |
| 88 | // c.JSON(http.StatusOK, models.Response{ | 88 | // c.JSON(http.StatusOK, models.Response{ |
| 89 | // Success: true, | 89 | // Success: true, |