19 lines
4.2 KiB
Go Template
19 lines
4.2 KiB
Go Template
{{ define "auth.gohtml" }}<!doctype html>
|
|
<html lang="{{ .Locale }}"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
|
<title>{{ if .CLIAuth }}{{ T "auth.cli_title" }}{{ else if .Logout }}{{ T "auth.logout" }}{{ else if .MFA }}{{ T "auth.totp" }}{{ else if .Setup }}{{ T "auth.setup" }}{{ else }}{{ T "auth.login" }}{{ end }} · {{ .WikiName }}</title>
|
|
<link rel="stylesheet" href="/static/css/theme/base.css"><link rel="stylesheet" href="/static/css/main.css"><link rel="stylesheet" href="/static/css/home.css?v=13"><link rel="stylesheet" href="/static/css/auth.css?v=1"><link rel="stylesheet" href="{{ .ThemeCSS }}"></head>
|
|
<body class="auth-page" style="--home-glass-opacity:{{ .HomeGlassOpacity }}%">
|
|
{{ if .HomeWallpaperURL }}<img class="home-wallpaper" src="{{ .HomeWallpaperURL }}" alt="" aria-hidden="true" decoding="async" fetchpriority="high" style="opacity:{{ .HomeWallpaperOpacity }}">{{ end }}
|
|
<a class="auth-brand" href="/">{{ .WikiName }}</a>
|
|
<main class="auth-shell"><section class="auth-card"><header class="auth-heading"><h1>{{ if .CLIAuth }}{{ T "auth.cli_title" }}{{ else if .Logout }}{{ T "auth.logout" }}{{ else if .MFA }}{{ T "auth.totp" }}{{ else if .Setup }}{{ T "auth.setup" }}{{ else }}{{ T "auth.login" }}{{ end }}</h1></header>
|
|
{{ if .Setup }}<p>{{ T "auth.setup_help" }}</p>{{ end }}{{ if .Error }}<p class="auth-error">{{ .Error }}</p>{{ end }}
|
|
{{ if .CLIAuth }}{{ template "auth-cli" . }}{{ else if .Logout }}<form class="auth-form" method="post" action="/_/auth/logout"><button class="auth-primary" type="submit">{{ T "auth.logout" }}</button><a class="auth-secondary" href="/">{{ .WikiName }}</a></form>{{ else if .MFA }}<form class="auth-form" method="post" action="/_/auth/totp"><input type="hidden" name="return" value="{{ .Return }}"><label>{{ T "auth.totp_code" }}<input name="code" inputmode="numeric" pattern="[0-9]{6}" autocomplete="one-time-code" required autofocus></label><button class="auth-primary">{{ T "auth.verify" }}</button></form>{{ else }}<form class="auth-form" method="post" action="/_/auth/{{ if .Setup }}setup{{ else }}login{{ end }}"><input type="hidden" name="return" value="{{ .Return }}">
|
|
{{ if .Setup }}<label>{{ T "auth.bootstrap_token" }}<input name="bootstrap_token" autocomplete="off" required></label><label>{{ T "auth.display_name" }}<input name="display_name" autocomplete="name"></label><label>{{ T "auth.email" }}<input name="email" type="email" autocomplete="email"></label>{{ end }}
|
|
<label>{{ T "auth.username" }}<input name="username" autocomplete="username" required autofocus></label>
|
|
<label>{{ T "auth.password" }}<input name="password" type="password" autocomplete="{{ if .Setup }}new-password{{ else }}current-password{{ end }}" minlength="12" required></label>
|
|
<button class="auth-primary" type="submit">{{ if .Setup }}{{ T "auth.create_owner" }}{{ else }}{{ T "auth.login" }}{{ end }}</button></form>
|
|
{{ if and (not .Setup) (not .MFA) .OIDCEnabled }}<div class="auth-separator"><span>{{ T "auth.or" }}</span></div><a class="auth-provider-button" href="/_/auth/oidc?return={{ .Return }}"><svg viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="8"/><path d="M12 4v16M8 8.5A5 5 0 0 1 16 12a5 5 0 0 1-8 3.5"/></svg><span>{{ T "auth.login_oidc" }}</span></a>{{ end }}
|
|
{{ if and (not .Setup) (not .MFA) .LDAPEnabled }}<div class="auth-separator"><span>{{ T "auth.or" }}</span></div><form class="auth-form" method="post" action="/_/auth/ldap"><input type="hidden" name="return" value="{{ .Return }}"><label>{{ T "auth.ldap_username" }}<input name="username" autocomplete="username" required></label><label>{{ T "auth.password" }}<input name="password" type="password" autocomplete="current-password" required></label><button class="auth-provider-button" type="submit">{{ T "auth.login_ldap" }}</button></form>{{ end }}
|
|
{{ if and (not .Setup) (not .MFA) .MagicEnabled }}{{ if .MagicSent }}<p>{{ T "auth.magic_sent" }}</p>{{ else }}<form class="auth-form auth-magic-form" method="post" action="/_/auth/magic-link"><input type="hidden" name="return" value="{{ .Return }}"><label>{{ T "auth.email" }}<input name="email" type="email" autocomplete="email" required></label><button class="auth-secondary">{{ T "auth.send_magic_link" }}</button></form>{{ end }}{{ end }}
|
|
{{ end }}</section></main></body></html>{{ end }}
|