From 166ea488cf0a479102cc48d27734ce4ab1666000 Mon Sep 17 00:00:00 2001 From: Ruidy Date: Fri, 15 Nov 2024 15:35:50 +0100 Subject: [PATCH] login form log --- internal/view/layout/base.templ | 2 +- internal/view/layout/base_templ.go | 2 +- internal/view/login.templ | 12 ++--- internal/view/login_form.templ | 85 ++++++++++++++++++------------ internal/view/login_form_templ.go | 24 ++++----- internal/view/login_templ.go | 4 +- 6 files changed, 72 insertions(+), 57 deletions(-) diff --git a/internal/view/layout/base.templ b/internal/view/layout/base.templ index 0afecd1..f201345 100644 --- a/internal/view/layout/base.templ +++ b/internal/view/layout/base.templ @@ -8,7 +8,7 @@ templ BaseLayout() { @head() @navbar() -
+
{ children... }
@footer() diff --git a/internal/view/layout/base_templ.go b/internal/view/layout/base_templ.go index 99e5762..aaf2805 100644 --- a/internal/view/layout/base_templ.go +++ b/internal/view/layout/base_templ.go @@ -47,7 +47,7 @@ func BaseLayout() templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/internal/view/login.templ b/internal/view/login.templ index 7960bf6..e2775ee 100644 --- a/internal/view/login.templ +++ b/internal/view/login.templ @@ -4,14 +4,14 @@ import "github.com/rjNemo/rentease/internal/view/layout" templ Login(lfvm LoginFormViewModel) { @layout.BaseLayout() { -
-
-
-

Welcome

-

Manage your rental property

+
+
+
+

Welcome

+

Manage your rental property

@LoginForm(lfvm) -
+
} } diff --git a/internal/view/login_form.templ b/internal/view/login_form.templ index 9d9ac7d..f1be720 100644 --- a/internal/view/login_form.templ +++ b/internal/view/login_form.templ @@ -6,39 +6,54 @@ func isFormError(data map[string]string, key string) bool { } templ LoginForm(lfvm LoginFormViewModel) { -
- - if msg, ok := lfvm.Errors["credentials"]; ok { - Authentication error: { msg } - } - - Password is too short - - Registration is disabled. Please ask an admin to activate it. -
+
+
+
+

Login

+
+
+ + if msg, ok := lfvm.Errors["credentials"]; ok { + Authentication error: { msg } + } +
+
+ + Password is too short +
+ +
+ Registration is disabled. Please ask an admin to activate it. +
+
+
+
+
} diff --git a/internal/view/login_form_templ.go b/internal/view/login_form_templ.go index 91da7b1..5e92d6a 100644 --- a/internal/view/login_form_templ.go +++ b/internal/view/login_form_templ.go @@ -34,25 +34,25 @@ func LoginForm(lfvm LoginFormViewModel) templ.Component { templ_7745c5c3_Var1 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

Login

Authentication error: ") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("Authentication error: ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var3 string templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(msg) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/login_form.templ`, Line: 24, Col: 37} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/login_form.templ`, Line: 30, Col: 65} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
Password is too short Registration is disabled. Please ask an admin to activate it.") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" autocomplete=\"password\" required @input.debounce=\"passwordTooShort = $event.target.value.length < 4\" :class=\"{'input-error': passwordTooShort}\"> Password is too short
Registration is disabled. Please ask an admin to activate it.
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/internal/view/login_templ.go b/internal/view/login_templ.go index 43e0d9d..3dfc1dd 100644 --- a/internal/view/login_templ.go +++ b/internal/view/login_templ.go @@ -43,7 +43,7 @@ func Login(lfvm LoginFormViewModel) templ.Component { }() } ctx = templ.InitializeContext(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

Welcome

Manage your rental property

") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

Welcome

Manage your rental property

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -51,7 +51,7 @@ func Login(lfvm LoginFormViewModel) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err }