Fix ob: type not registered for interface: map[string]string & superfluous response.WriteHeader, as well as wired up to go to custom 500 messages.

This commit is contained in:
2025-10-28 13:16:29 +00:00
parent e0b063fab0
commit af581a4def
3 changed files with 10 additions and 7 deletions

View File

@@ -72,8 +72,8 @@ func SignupPost(c *gin.Context) {
AcceptTerms: r.FormValue("accept_terms") == "on",
}
errors := validateRegisterForm(db, form)
if len(errors) > 0 {
errMap := validateRegisterForm(db, form)
if len(errMap) > 0 {
formMap := map[string]string{
"username": form.Username,
"email": form.Email,
@@ -85,7 +85,7 @@ func SignupPost(c *gin.Context) {
}(),
}
sm.Put(r.Context(), "register.form", formMap)
sm.Put(r.Context(), "register.errors", errors)
sm.Put(r.Context(), "register.errors", errMap)
sm.Put(r.Context(), "flash", "Please fix the highlighted errors.")
c.Redirect(http.StatusSeeOther, "/account/signup")
@@ -153,6 +153,5 @@ func validateRegisterForm(db *sql.DB, f registerForm) map[string]string {
}
func looksLikeEmail(s string) bool {
return strings.Count(s, "@") == 1 && strings.Contains(s, ".")
}