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 5949fdd..85ffd63 100644 --- a/backend/handlers/login.go +++ b/backend/handlers/login.go | |||
| @@ -38,7 +38,7 @@ func Login(c *gin.Context) { | |||
| 38 | default: | 38 | default: |
| 39 | steamID, err := openID.ValidateAndGetId() | 39 | steamID, err := openID.ValidateAndGetId() |
| 40 | if err != nil { | 40 | if err != nil { |
| 41 | CreateLog(steamID, LogTypeLogin, LogDescriptionUserLoginFailValidate) | 41 | CreateLog(steamID, LogTypeUser, LogDescriptionUserLoginFailValidate) |
| 42 | c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error())) | 42 | c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error())) |
| 43 | return | 43 | return |
| 44 | } | 44 | } |
| @@ -49,7 +49,7 @@ func Login(c *gin.Context) { | |||
| 49 | if checkSteamID == 0 { | 49 | if checkSteamID == 0 { |
| 50 | user, err := GetPlayerSummaries(steamID, os.Getenv("API_KEY")) | 50 | user, err := GetPlayerSummaries(steamID, os.Getenv("API_KEY")) |
| 51 | if err != nil { | 51 | if err != nil { |
| 52 | CreateLog(steamID, LogTypeLogin, LogDescriptionUserLoginFailSummary) | 52 | CreateLog(steamID, LogTypeUser, LogDescriptionUserLoginFailSummary) |
| 53 | c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error())) | 53 | c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error())) |
| 54 | return | 54 | return |
| 55 | } | 55 | } |
| @@ -79,12 +79,12 @@ func Login(c *gin.Context) { | |||
| 79 | // Sign and get the complete encoded token as a string using the secret | 79 | // Sign and get the complete encoded token as a string using the secret |
| 80 | tokenString, err := token.SignedString([]byte(os.Getenv("SECRET_KEY"))) | 80 | tokenString, err := token.SignedString([]byte(os.Getenv("SECRET_KEY"))) |
| 81 | if err != nil { | 81 | if err != nil { |
| 82 | CreateLog(steamID, LogTypeLogin, LogDescriptionUserLoginFailToken) | 82 | CreateLog(steamID, LogTypeUser, LogDescriptionUserLoginFailToken) |
| 83 | c.JSON(http.StatusBadRequest, models.ErrorResponse("Failed to generate token.")) | 83 | c.JSON(http.StatusBadRequest, models.ErrorResponse("Failed to generate token.")) |
| 84 | return | 84 | return |
| 85 | } | 85 | } |
| 86 | c.SetCookie("token", tokenString, 3600*24*30, "/", "", true, true) | 86 | c.SetCookie("token", tokenString, 3600*24*30, "/", "", true, true) |
| 87 | CreateLog(steamID, LogTypeLogin, LogDescriptionUserLoginSuccess) | 87 | CreateLog(steamID, LogTypeUser, LogDescriptionUserLoginSuccess) |
| 88 | c.Redirect(http.StatusTemporaryRedirect, "/") | 88 | c.Redirect(http.StatusTemporaryRedirect, "/") |
| 89 | // c.JSON(http.StatusOK, models.Response{ | 89 | // c.JSON(http.StatusOK, models.Response{ |
| 90 | // Success: true, | 90 | // Success: true, |