feat(api): add signup, login with totp and account security pages

Signup is limited to the first user by default (UPTIME_SIGNUP). TOTP
secrets are sealed with UPTIME_SECRET_KEYS and bound to the user id.

Closes #3
Closes #5

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
This commit is contained in:
Sebastian UnterschützandClaude Opus 5.5 committed 2026-11-21 23:55:23 +01:00
1 parent 99e9b1e57d
commit db44fedc72
18 files changed
+1792 -91

No files matched your search

+37
View File
@@ -0,0 +1,37 @@
package web
templ Login(p Page, signupAllowed bool) {
@authShell(p, "Anmelden") {
<form data-api="/auth/login" data-next="/">
@formError()
<div data-step="password">
@field("E-Mail", "email", "email", "username", true)
@field("Passwort", "password", "password", "current-password", true)
</div>
<div data-step="totp" hidden>
<p class="mb-4 text-sm text-muted">Code aus der Authenticator-App eingeben.</p>
@field("Code", "code", "text", "one-time-code", false)
</div>
@submit("Weiter")
</form>
if signupAllowed {
<p class="mt-8 text-sm text-muted">Noch kein Konto? <a class="text-ink underline underline-offset-2" href="/signup">Registrieren</a></p>
}
}
}
templ Signup(p Page) {
@authShell(p, "Konto anlegen") {
<form data-api="/auth/signup" data-next="/">
@formError()
@field("Name", "display_name", "text", "name", false)
@field("E-Mail", "email", "email", "username", true)
@field("Passwort (min. 12 Zeichen)", "password", "password", "new-password", true)
<hr class="my-6 border-rule"/>
@field("Organisation", "org_name", "text", "organization", true)
@field("Kurzname (a–z, 0–9, -)", "org_slug", "text", "off", true)
@submit("Anlegen")
</form>
<p class="mt-8 text-sm text-muted"><a class="text-ink underline underline-offset-2" href="/login">Zur Anmeldung</a></p>
}
}