43 lines
1.4 KiB
Plaintext
43 lines
1.4 KiB
Plaintext
|
package pages
|
||
|
|
||
|
import (
|
||
|
"git.grosinger.net/tgrosinger/saasitone/templ/components"
|
||
|
"git.grosinger.net/tgrosinger/saasitone/pkg/form"
|
||
|
"git.grosinger.net/tgrosinger/saasitone/pkg/page"
|
||
|
)
|
||
|
|
||
|
type LoginForm struct {
|
||
|
Email string `form:"email" validate:"required,email"`
|
||
|
Password string `form:"password" validate:"required"`
|
||
|
form.Submission
|
||
|
}
|
||
|
|
||
|
templ Login(p page.Page, f *LoginForm) {
|
||
|
<form method="post" hx-boost="true" action={ templ.URL(p.ToURL("login.submit")) }>
|
||
|
@components.Messages(p)
|
||
|
<div class="field">
|
||
|
<label for="email" class="label">Email address</label>
|
||
|
<div class="control">
|
||
|
<input id="email" type="email" name="email" class={ "input", f.Submission.GetFieldStatusClass("Email") } value={ f.Email }/>
|
||
|
@components.FieldErrors(f.Submission.GetFieldErrors("Email"))
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="field">
|
||
|
<label for="password" class="label">Password</label>
|
||
|
<div class="control">
|
||
|
<input id="password" type="password" name="password" placeholder="*******" class={ "input", f.Submission.GetFieldStatusClass("Password") }/>
|
||
|
@components.FieldErrors(f.Submission.GetFieldErrors("Password"))
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="field is-grouped">
|
||
|
<p class="control">
|
||
|
<button class="button is-primary">Log in</button>
|
||
|
</p>
|
||
|
<p class="control">
|
||
|
<a href={ templ.URL(p.ToURL("home")) } class="button is-light">Cancel</a>
|
||
|
</p>
|
||
|
</div>
|
||
|
@components.CSRF(p.CSRF)
|
||
|
</form>
|
||
|
}
|