xtablo-source/backend/templates/auth_forms.go
2026-05-15 21:41:22 +02:00

54 lines
1.8 KiB
Go

package templates
// SignupForm carries the submitted field values back to the template so
// the email field can be repopulated on validation failure.
// Password is intentionally never echoed back to the client (T-2-01, D-25).
type SignupForm struct {
Email string
Password string // held here only for length validation; never passed to templates
}
// SignupErrors holds per-field and general error messages for the signup form.
// A field with an empty string means "no error for this field".
type SignupErrors struct {
Email string
Password string
General string
}
// LoginForm carries the submitted email value back to the template so the
// email field can be repopulated on validation failure.
// Password is intentionally never echoed back to the client (T-2-21, D-25).
type LoginForm struct {
Email string
}
// LoginErrors holds per-field and general error messages for the login form.
// A field with an empty string means "no error for this field".
// Note: the general error for credential failures uses the intentionally generic
// string "Invalid email or password" to prevent user enumeration (D-20).
type LoginErrors struct {
Email string
Password string
General string
}
// AuthProviderButton carries one social sign-in entry point into the auth pages.
type AuthProviderButton struct {
Label string
DisabledLabel string
StartURL string
Configured bool
}
// AuthProviderButtons groups the equal-prominence provider controls shown above
// the email/password auth forms.
type AuthProviderButtons struct {
Google AuthProviderButton
}
func EmptyAuthProviderButtons() AuthProviderButtons {
return AuthProviderButtons{
Google: AuthProviderButton{Label: "Continue with Google", DisabledLabel: "Google sign-in not configured"},
}
}