Refactoring cont.

This commit is contained in:
2025-04-23 09:44:19 +01:00
parent 5c3a847900
commit 2ce810a4dd
19 changed files with 117 additions and 150 deletions

View File

@@ -5,8 +5,8 @@ import (
"net/http"
"time"
securityHelpers "license-server/helpers/security"
httpHelpers "synlotto-website/helpers/http"
securityHelpers "synlotto-website/helpers/security"
templateHelpers "synlotto-website/helpers/template"
"synlotto-website/models"
"synlotto-website/storage"
@@ -70,11 +70,11 @@ func Login(w http.ResponseWriter, r *http.Request) {
}
if user == nil || !securityHelpers.CheckPasswordHash(user.PasswordHash, password) {
storage.LogLoginAttempt(username, false)
storage.LogLoginAttempt(r, username, false)
http.Error(w, "Invalid credentials", http.StatusUnauthorized)
return
}
storage.LogLoginAttempt(username, true)
storage.LogLoginAttempt(r, username, true)
http.Redirect(w, r, "/", http.StatusSeeOther)
}