Add admin magic-link login and sessions #55
Labels
No labels
activitypub
admin
api
articles
auth
bug
cleanup
cli
comments
compatibility
config
contacts
database
deployment
design
dev-env
docs
documentation
email
enhancement
feature
federation
feed
homepage
implementation
integration
media
openapi
priority:high
priority:low
priority:medium
proof
public-routes
public-ui
release
safety
social
sources
status:active
status:canceled
status:done
status:inprogress
status:waiting
syndication
tailwind
template
test
web
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
erik/slugkit#55
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Goal
Implement the initial admin authentication bootstrap used before passkeys exist: an
ADMIN_EMAILallow-list, magic-link login, session cookies, logout, and a protected admin dashboard. This is the first trusted login path; passkeys are registered only after this session exists.Reference behavior:
/home/erik/Private/code/github/evcraddock/erikcraddock.meusesADMIN_EMAIL, magic links, sessions, and then lets authenticated users register passkeys and create API keys.Spec:
docs/web-specs/03-admin-auth-keys-passkeys.mdRequirements
ADMIN_EMAIL.GET /loginwith an email form and clear success/error messages.POST /loginto request a magic link.GET /login/verify?token=...to verify the token and create a server-side session.HttpOnly,SameSite=Laxsession cookie.POST /logoutand optionallyGET /logoutto delete the server-side session and clear the cookie.GET /admindashboard proving the session works.Acceptance criteria
GET /loginrenders an email login form.POST /logincreates a hashed, expiring, single-use magic-link record and exposes the raw link only through dev logging or the configured delivery boundary.POST /logindoes not create a usable magic link and does not reveal authorization status to the requester.GET /login/verifywith a valid token creates a server-side session and sets a secure cookie.GET /adminredirects anonymous users to/login.GET /adminsucceeds for authenticated owner sessions.Dependencies
Add admin login and session routesto Add admin magic-link login and sessionsSynced from todu comment by @todu on 2026-05-22T17:54:58.255Z
Scope Updated: Magic-Link Bootstrap
Updated this task to follow the proven
erikcraddock.mebootstrap model:ADMIN_EMAILis the initial trust anchor./loginrequests a magic link./login/verifycreates a server-side session cookie./adminis protected by that session.Also updated follow-up tasks so passkey registration/login and API key UI depend on this session foundation, and created
task-b8374859for the laterslug loginbrowser flow.Synced from todu comment by @todu on 2026-05-22T18:05:22.713Z
PR Review: Approved
PR: #58
Summary
Reviewed PR #58 at commit
0b75a6a. The PR implements the magic-link bootstrap slice:ADMIN_EMAILis the owner allow-list, magic-link tokens are hashed, expiring, and single-use, development delivery logs the link, production delivery fails closed when not configured, server-side sessions and cookies are added, and/login,/login/verify,/logout, and protected/adminroutes are wired with tests.Acceptance Criteria
GET /loginrenders an email login form.POST /logincreates a hashed, expiring, single-use magic-link record and exposes the raw link only through dev logging or the configured delivery boundary.POST /logindoes not create a usable magic link and does not reveal authorization status to the requester.GET /login/verifywith a valid token creates a server-side session and sets a secure cookie.GET /adminredirects anonymous users to/login.GET /adminsucceeds for authenticated owner sessions.make check,./scripts/pre-pr.sh, manual smoke, and Forgejo CI passed.Blocking Issues
None.
Warnings
None.
Verdict
Approved for merge.
Synced from todu comment by @todu on 2026-05-22T18:53:40.560Z
Closing Summary
PR #58 merged: #58
Acceptance criteria evidence:
GET /loginrenders an email login form: met.POST /logincreates a hashed, expiring, single-use magic-link record and exposes the raw link only through dev logging or delivery boundary: met.POST /logindoes not create a usable magic link and does not reveal authorization status: met.GET /login/verifywith a valid token creates a server-side session and sets anHttpOnly,SameSite=Laxcookie: met.GET /adminredirects anonymous users to/login: met.GET /adminsucceeds for authenticated owner sessions: met.make check,./scripts/pre-pr.sh, PR CI, and main push CI.Additional shipped behavior:
admin@slugkit.comwhen unset.data/paths are ignored.Post-merge cleanup: local and remote feature branches deleted.
Readiness: READY
Synced from todu comment by @todu on 2026-05-22T18:50:00.036Z
PR Review: Approved (updated)
PR: #58
Summary
Reviewed updated PR #58 through commit
ec095f4. The PR now includes the original magic-link/session bootstrap plus the follow-up fixes found during manual testing: startup migrations run before serving, default admin email falls back toadmin@slugkit.com, dev startup logs show the effective admin email, auth lifecycle events are logged, and runtime SQLite data is ignored.Acceptance Criteria
GET /loginrenders an email login form.POST /logincreates a hashed, expiring, single-use magic-link record and exposes the raw link only through dev logging or the configured delivery boundary.POST /logindoes not create a usable magic link and does not reveal authorization status to the requester.GET /login/verifywith a valid token creates a server-side session and sets a secure cookie.GET /adminredirects anonymous users to/login.GET /adminsucceeds for authenticated owner sessions.make check,./scripts/pre-pr.sh, manual login smoke, and Forgejo CI passed.Additional Verification
ADMIN_EMAIL=admin@slugkit.comwhen unset.data/paths are ignored.Blocking Issues
None.
Warnings
None.
Verdict
Approved for merge.