Files
2026-06-17 16:12:19 +02:00

38 lines
954 B
Go

package templates
import (
"github.com/chasefleming/elem-go"
)
// AuthErrorResult contains the text content for an error page shown
// to users in their browser when a browser-facing operation fails
// (OIDC callback, SSH check, registration confirmation, etc.).
type AuthErrorResult struct {
// Title is the browser tab / page title,
// e.g. "Headscale - Error".
Title string
// Heading is the bold red text inside the error box,
// e.g. "Forbidden".
Heading string
// Message is the actionable user-facing message shown below
// the heading, e.g. "You are not authorized. Please contact
// your administrator."
Message string
}
// AuthError renders a styled error page for browser-facing failures.
// The caller controls every user-visible string via [AuthErrorResult].
func AuthError(result AuthErrorResult) *elem.Element {
box := errorBox(
result.Heading,
elem.Text(result.Message),
)
return page(
result.Title,
box,
)
}