Added basic login functionality to login form

This commit is contained in:
2025-02-08 15:29:17 +11:00
parent 5a93ef81dd
commit 1004dc9563
9 changed files with 138 additions and 7 deletions

View File

@@ -5,14 +5,14 @@ import "fmt"
templ LoginForm(loginError string) {
{{
var errCreds string
if loginError == "Username or password is incorrect" {
if loginError == "Username or password incorrect" {
errCreds = "true"
} else {
errCreds = "false"
}
xdata := fmt.Sprintf("{credentialError: %s, errorMessage: '%s'}", errCreds, loginError)
}}
<form>
<form hx-post="/login">
<div
class="grid gap-y-4"
x-data={ xdata }
@@ -26,7 +26,7 @@ templ LoginForm(loginError string) {
<div class="relative">
<input
type="text"
id="username"
idnutanix="username"
name="username"
class="py-3 px-4 block w-full rounded-lg text-sm
focus:border-blue focus:ring-blue bg-base
@@ -65,6 +65,7 @@ templ LoginForm(loginError string) {
text-blue decoration-2 hover:underline
focus:outline-none focus:underline font-medium"
href="/recover-account"
tabindex="-1"
>Forgot password?</a>
</div>
<div class="relative">

View File

@@ -5,7 +5,7 @@ import "projectreshoot/view/layout"
templ Error(code string, err string, message string) {
@layout.Global() {
<div
class="grid absolute left-0 right-0 top-0 bottom-0 z-[-1]
class="grid mt-24 left-0 right-0 top-0 bottom-0
place-content-center bg-base px-4"
>
<div class="text-center">
@@ -22,7 +22,7 @@ templ Error(code string, err string, message string) {
<a
href="/"
class="mt-6 inline-block rounded-lg bg-mauve px-5 py-3
text-sm text-crust hover:bg-mauve/75"
text-sm text-crust transition hover:bg-mauve/75"
>Go to homepage</a>
</div>
</div>