aboutsummaryrefslogtreecommitdiff
path: root/backend/handlers/login.go
diff options
context:
space:
mode:
authorArda Serdar Pektezol <1669855+pektezol@users.noreply.github.com>2024-10-31 22:06:00 +0300
committerArda Serdar Pektezol <1669855+pektezol@users.noreply.github.com>2024-10-31 22:06:00 +0300
commit4210c9b38f9053f6720a6bebaadefd24c542eaa9 (patch)
tree5b0061e23cf91291ed9e5f387766148d45103591 /backend/handlers/login.go
parentchore: change repo name to lphub (diff)
downloadlphub-4210c9b38f9053f6720a6bebaadefd24c542eaa9.tar.gz
lphub-4210c9b38f9053f6720a6bebaadefd24c542eaa9.tar.bz2
lphub-4210c9b38f9053f6720a6bebaadefd24c542eaa9.zip
backend: better auth check, audit logging
Diffstat (limited to 'backend/handlers/login.go')
-rw-r--r--backend/handlers/login.go3
1 files changed, 0 insertions, 3 deletions
diff --git a/backend/handlers/login.go b/backend/handlers/login.go
index 408d950..51c90d0 100644
--- a/backend/handlers/login.go
+++ b/backend/handlers/login.go
@@ -40,7 +40,6 @@ func Login(c *gin.Context) {
40 default: 40 default:
41 steamID, err := openID.ValidateAndGetID() 41 steamID, err := openID.ValidateAndGetID()
42 if err != nil { 42 if err != nil {
43 CreateLog(steamID, LogTypeUser, LogDescriptionUserLoginFailValidate, err.Error())
44 c.JSON(http.StatusOK, models.ErrorResponse(err.Error())) 43 c.JSON(http.StatusOK, models.ErrorResponse(err.Error()))
45 return 44 return
46 } 45 }
@@ -51,7 +50,6 @@ func Login(c *gin.Context) {
51 if checkSteamID == 0 { 50 if checkSteamID == 0 {
52 user, err := GetPlayerSummaries(steamID, os.Getenv("API_KEY")) 51 user, err := GetPlayerSummaries(steamID, os.Getenv("API_KEY"))
53 if err != nil { 52 if err != nil {
54 CreateLog(steamID, LogTypeUser, LogDescriptionUserLoginFailSummary, err.Error())
55 c.JSON(http.StatusOK, models.ErrorResponse(err.Error())) 53 c.JSON(http.StatusOK, models.ErrorResponse(err.Error()))
56 return 54 return
57 } 55 }
@@ -81,7 +79,6 @@ func Login(c *gin.Context) {
81 // 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
82 tokenString, err := token.SignedString([]byte(os.Getenv("SECRET_KEY"))) 80 tokenString, err := token.SignedString([]byte(os.Getenv("SECRET_KEY")))
83 if err != nil { 81 if err != nil {
84 CreateLog(steamID, LogTypeUser, LogDescriptionUserLoginFailToken, err.Error())
85 c.JSON(http.StatusOK, models.ErrorResponse("Failed to generate token.")) 82 c.JSON(http.StatusOK, models.ErrorResponse("Failed to generate token."))
86 return 83 return
87 } 84 }