refactor(ui): complete ui template migration and fix playback

This commit is contained in:
2026-05-01 17:28:09 +02:00
committed by Mikkel Elvers
parent 33a939ca81
commit 4f3a61e143
23 changed files with 1298 additions and 68 deletions

View File

@@ -25,21 +25,19 @@ func rateLimitErrorFromQuery(r *http.Request) string {
}
func (h *Handler) HandleLoginPage(w http.ResponseWriter, r *http.Request) {
err := templates.GetRenderer().ExecuteTemplate(w, "login.gohtml", map[string]any{
"Error": rateLimitErrorFromQuery(r),
"Username": "",
})
if err != nil {
if err := templates.GetRenderer().ExecuteTemplate(w, "login.gohtml", map[string]any{
"CurrentPath": r.URL.Path,
}); err != nil {
log.Printf("render error: %v", err)
http.Error(w, "Internal Server Error", http.StatusInternalServerError)
}
}
func (h *Handler) HandleLogin(w http.ResponseWriter, r *http.Request) {
if err := r.ParseForm(); err != nil {
templates.GetRenderer().ExecuteTemplate(w, "login.gohtml", map[string]any{
"Error": "Something went wrong. Please try again.",
"Username": "",
"Error": "Something went wrong. Please try again.",
"Username": "",
"CurrentPath": r.URL.Path,
})
return
}
@@ -49,8 +47,9 @@ func (h *Handler) HandleLogin(w http.ResponseWriter, r *http.Request) {
if username == "" || password == "" {
templates.GetRenderer().ExecuteTemplate(w, "login.gohtml", map[string]any{
"Error": "The email or password is wrong.",
"Username": username,
"Error": "The email or password is wrong.",
"Username": username,
"CurrentPath": r.URL.Path,
})
return
}
@@ -58,8 +57,9 @@ func (h *Handler) HandleLogin(w http.ResponseWriter, r *http.Request) {
session, err := h.authService.Login(r.Context(), username, password)
if err != nil {
templates.GetRenderer().ExecuteTemplate(w, "login.gohtml", map[string]any{
"Error": "The email or password is wrong.",
"Username": username,
"Error": "The email or password is wrong.",
"Username": username,
"CurrentPath": r.URL.Path,
})
return
}