feat: implement magic link authentication#3
Merged
AlexVOiceover merged 19 commits intomainfrom Dec 26, 2025
Merged
Conversation
- Add Staff table and field IDs to config.ts - Update findUserByEmail to check Staff table first, then Apprentices - Document Staff table schema in docs/schema.md - Add check-staff-members.ts script for manual testing 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Create hooks.server.ts to parse session cookie on every request - Add user type to App.Locals interface in app.d.ts - Session data (email, type) now available via event.locals.user 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add layout server to pass user data to pages, update home page to show login status with logout link, and create staff-only admin route with access control. Also document authentication testing flow in README. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Changes
src/lib/server/auth.ts): JWT token generation with 15-minute expiry usingAUTH_SECRETsrc/routes/api/auth/login/+server.ts): Validates email against Staff/Apprentices tables, determines user typesrc/routes/api/auth/verify/+server.ts): Verifies JWT, creates 90-day session cookiesrc/routes/api/auth/logout/+server.ts): Clears session cookiesrc/hooks.server.ts): Parses session cookie and exposes user data to routessrc/lib/airtable/config.tsTest plan
npm run testto confirm auth.spec.ts passesRelated
Closes AP-14
🤖 Generated with Claude Code