prettier ui and better login handling

This commit is contained in:
2025-11-06 22:19:20 +01:00
parent 09e65803c9
commit d3a71e1d0f
7 changed files with 516 additions and 73 deletions

View File

@@ -41,7 +41,10 @@ func loginHandler(w http.ResponseWriter, r *http.Request) {
err := db.QueryRow("SELECT 1 FROM teams WHERE password = ?", hashedPassword).Scan(new(int))
switch {
case err == sql.ErrNoRows:
http.Error(w, "No team found", http.StatusUnauthorized)
err = LoginTemplate.Execute(w, true)
if err != nil {
http.Error(w, "Could not render template", http.StatusInternalServerError)
}
return
case err != nil:
http.Error(w, "Could not retrieve team", http.StatusInternalServerError)
@@ -68,7 +71,10 @@ func loginHandler(w http.ResponseWriter, r *http.Request) {
}
}
case http.MethodGet:
http.ServeFileFS(w, r, templatesFS, "templates/login.html")
err := LoginTemplate.Execute(w, false)
if err != nil {
http.Error(w, "Could not render template", http.StatusInternalServerError)
}
default:
http.Error(w, "Method not allowed", http.StatusMethodNotAllowed)
}