125 lines
5.2 KiB
Go
125 lines
5.2 KiB
Go
|
// Code generated by templ - DO NOT EDIT.
|
||
|
|
||
|
// templ: version: v0.2.707
|
||
|
package pages
|
||
|
|
||
|
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
||
|
|
||
|
import "github.com/a-h/templ"
|
||
|
import "context"
|
||
|
import "io"
|
||
|
import "bytes"
|
||
|
|
||
|
import (
|
||
|
"git.grosinger.net/tgrosinger/saasitone/pkg/form"
|
||
|
"git.grosinger.net/tgrosinger/saasitone/pkg/page"
|
||
|
"git.grosinger.net/tgrosinger/saasitone/templ/components"
|
||
|
)
|
||
|
|
||
|
type ResetPasswordForm struct {
|
||
|
Password string `form:"password" validate:"required"`
|
||
|
ConfirmPassword string `form:"password-confirm" validate:"required,eqfield=Password"`
|
||
|
form.Submission
|
||
|
}
|
||
|
|
||
|
func ResetPassword(p page.Page, f *ResetPasswordForm) templ.Component {
|
||
|
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
|
||
|
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
|
||
|
if !templ_7745c5c3_IsBuffer {
|
||
|
templ_7745c5c3_Buffer = templ.GetBuffer()
|
||
|
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||
|
}
|
||
|
ctx = templ.InitializeContext(ctx)
|
||
|
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
|
||
|
if templ_7745c5c3_Var1 == nil {
|
||
|
templ_7745c5c3_Var1 = templ.NopComponent
|
||
|
}
|
||
|
ctx = templ.ClearChildren(ctx)
|
||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<form method=\"post\" hx-boost=\"true\" action=\"")
|
||
|
if templ_7745c5c3_Err != nil {
|
||
|
return templ_7745c5c3_Err
|
||
|
}
|
||
|
var templ_7745c5c3_Var2 templ.SafeURL = templ.URL(p.Path)
|
||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var2)))
|
||
|
if templ_7745c5c3_Err != nil {
|
||
|
return templ_7745c5c3_Err
|
||
|
}
|
||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\"><div class=\"field\"><label for=\"password\" class=\"label\">Password</label><div class=\"control\">")
|
||
|
if templ_7745c5c3_Err != nil {
|
||
|
return templ_7745c5c3_Err
|
||
|
}
|
||
|
var templ_7745c5c3_Var3 = []any{"input", f.Submission.GetFieldStatusClass("Password")}
|
||
|
templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var3...)
|
||
|
if templ_7745c5c3_Err != nil {
|
||
|
return templ_7745c5c3_Err
|
||
|
}
|
||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<input type=\"password\" id=\"password\" name=\"password\" placeholder=\"*******\" class=\"")
|
||
|
if templ_7745c5c3_Err != nil {
|
||
|
return templ_7745c5c3_Err
|
||
|
}
|
||
|
var templ_7745c5c3_Var4 string
|
||
|
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(templ.CSSClasses(templ_7745c5c3_Var3).String())
|
||
|
if templ_7745c5c3_Err != nil {
|
||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `templ/pages/reset-password.templ`, Line: 1, Col: 0}
|
||
|
}
|
||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
|
||
|
if templ_7745c5c3_Err != nil {
|
||
|
return templ_7745c5c3_Err
|
||
|
}
|
||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\">")
|
||
|
if templ_7745c5c3_Err != nil {
|
||
|
return templ_7745c5c3_Err
|
||
|
}
|
||
|
templ_7745c5c3_Err = components.FieldErrors(f.Submission.GetFieldErrors("Password")).Render(ctx, templ_7745c5c3_Buffer)
|
||
|
if templ_7745c5c3_Err != nil {
|
||
|
return templ_7745c5c3_Err
|
||
|
}
|
||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div></div><div class=\"field\"><label for=\"password-confirm\" class=\"label\">Confirm password</label><div class=\"control\">")
|
||
|
if templ_7745c5c3_Err != nil {
|
||
|
return templ_7745c5c3_Err
|
||
|
}
|
||
|
var templ_7745c5c3_Var5 = []any{"input", f.Submission.GetFieldStatusClass("ConfirmPassword")}
|
||
|
templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var5...)
|
||
|
if templ_7745c5c3_Err != nil {
|
||
|
return templ_7745c5c3_Err
|
||
|
}
|
||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<input type=\"password\" id=\"password-confirm\" name=\"password-confirm\" placeholder=\"*******\" class=\"")
|
||
|
if templ_7745c5c3_Err != nil {
|
||
|
return templ_7745c5c3_Err
|
||
|
}
|
||
|
var templ_7745c5c3_Var6 string
|
||
|
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(templ.CSSClasses(templ_7745c5c3_Var5).String())
|
||
|
if templ_7745c5c3_Err != nil {
|
||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `templ/pages/reset-password.templ`, Line: 1, Col: 0}
|
||
|
}
|
||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
|
||
|
if templ_7745c5c3_Err != nil {
|
||
|
return templ_7745c5c3_Err
|
||
|
}
|
||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\">")
|
||
|
if templ_7745c5c3_Err != nil {
|
||
|
return templ_7745c5c3_Err
|
||
|
}
|
||
|
templ_7745c5c3_Err = components.FieldErrors(f.Submission.GetFieldErrors("ConfigmPassword")).Render(ctx, templ_7745c5c3_Buffer)
|
||
|
if templ_7745c5c3_Err != nil {
|
||
|
return templ_7745c5c3_Err
|
||
|
}
|
||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div></div><div class=\"field is-grouped\"><p class=\"control\"><button class=\"button is-primary\">Update password</button></p></div>")
|
||
|
if templ_7745c5c3_Err != nil {
|
||
|
return templ_7745c5c3_Err
|
||
|
}
|
||
|
templ_7745c5c3_Err = components.CSRF(p.CSRF).Render(ctx, templ_7745c5c3_Buffer)
|
||
|
if templ_7745c5c3_Err != nil {
|
||
|
return templ_7745c5c3_Err
|
||
|
}
|
||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</form>")
|
||
|
if templ_7745c5c3_Err != nil {
|
||
|
return templ_7745c5c3_Err
|
||
|
}
|
||
|
if !templ_7745c5c3_IsBuffer {
|
||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
|
||
|
}
|
||
|
return templ_7745c5c3_Err
|
||
|
})
|
||
|
}
|