fixed testing
All checks were successful
GoLang Tests / Run Go Tests (push) Successful in 50s
GoLang Tests / Build Go Image and Upload (push) Successful in 1m50s

This commit is contained in:
2025-09-04 09:59:31 +02:00
parent a2cd118644
commit 0af65f52f3
7 changed files with 39 additions and 21 deletions

View File

@@ -18,6 +18,7 @@ var Session *scs.SessionManager
func CreateSessionManager(lifetime time.Duration) *scs.SessionManager {
Session = scs.New()
Session.Lifetime = lifetime
log.Println("Created Session")
return Session
}
@@ -55,14 +56,15 @@ func loginUser(w http.ResponseWriter, r *http.Request) {
user, err := models.GetUserByPersonalNr(personal_nummer)
if err != nil {
log.Println("No user found under this personal number!")
log.Println("No user found under this personal number!", err)
http.Error(w, "No user found!", http.StatusNotFound)
}
password := r.FormValue("password")
if user.Login(password) {
log.Printf("New succesfull user login from %s %s!\n", user.Vorname, user.Name)
log.Printf("New succesfull user login from %s %s (%d)!\n", user.Vorname, user.Name, user.PersonalNummer)
Session.Put(r.Context(), "user", user.PersonalNummer)
Session.Commit(r.Context())
http.Redirect(w, r, "/time", http.StatusSeeOther) //with this browser always uses GET
} else {
showLoginPage(w, r, true)