feat: add optional email/password auth for self-hosted deployments - #26
feat: add optional email/password auth for self-hosted deployments#26AtherBilal wants to merge 1 commit into
Conversation
📝 WalkthroughWalkthroughAdded an optional build-time flag Changes
Sequence Diagram(s)sequenceDiagram
participant User as "User (Browser)"
participant Landing as "LandingPage / SignInModal"
participant Auth as "useAuthStore"
participant Supa as "Supabase / Auth Provider"
User->>Landing: Open SignInModal
alt ENABLE_EMAIL_AUTH enabled
User->>Landing: Enter email & password, click Submit
Landing->>Auth: signUpWithEmail(email,password) or signInWithEmail(...)
Auth->>Supa: Create/Verify user, send confirmation/token
Supa-->>Auth: Auth result or error
Auth-->>Landing: Resolve or throw error
Landing-->>User: Show success or emailError
else OAuth path
User->>Landing: Choose Google/Microsoft
Landing->>Auth: signInWithOAuth(provider)
Auth->>Supa: OAuth flow
Supa-->>Auth: Token
Auth-->>Landing: Close modal / set session
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
core-web/src/components/Landing/LandingPage.tsx (1)
196-196: Announce auth errors to assistive tech.The inline error text should be exposed as a live region so screen readers announce failures immediately.
♿ Suggested tweak
- {emailError && <p className="text-red-500 text-xs">{emailError}</p>} + {emailError && ( + <p role="alert" aria-live="polite" className="text-red-500 text-xs"> + {emailError} + </p> + )}🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@core-web/src/components/Landing/LandingPage.tsx` at line 196, The inline email error rendered via the emailError conditional (the <p className="text-red-500 text-xs">{emailError}</p> in the LandingPage component) isn’t announced to screen readers; make it a live region by adding an accessibility role/attributes (e.g., role="alert" or aria-live="assertive" with aria-atomic="true") to that element so assistive tech will announce the error immediately when emailError is set. Ensure the modification is applied where emailError is rendered in LandingPage so the text remains visually the same but is exposed as a live region.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@core-web/src/components/Landing/LandingPage.tsx`:
- Around line 58-64: Reset the email auth component state when the modal is
closed by clearing the sensitive state variables: call setEmail(""),
setPassword(""), setEmailError(""), setIsSignUp(false) and
setEmailLoading(false) from the modal close/reset handler so stale
password/error/loading state is not preserved between modal sessions; add these
calls to whatever function closes the email auth modal (the modal close/reset
logic).
---
Nitpick comments:
In `@core-web/src/components/Landing/LandingPage.tsx`:
- Line 196: The inline email error rendered via the emailError conditional (the
<p className="text-red-500 text-xs">{emailError}</p> in the LandingPage
component) isn’t announced to screen readers; make it a live region by adding an
accessibility role/attributes (e.g., role="alert" or aria-live="assertive" with
aria-atomic="true") to that element so assistive tech will announce the error
immediately when emailError is set. Ensure the modification is applied where
emailError is rendered in LandingPage so the text remains visually the same but
is exposed as a live region.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: d26f3597-223a-490c-85e4-2d39b6fe001b
📒 Files selected for processing (2)
core-web/.env.examplecore-web/src/components/Landing/LandingPage.tsx
e6bc3f1 to
38290d3
Compare
The landing page only offered Google/Microsoft OAuth, which requires third-party credentials setup. Self-hosters can now set VITE_ENABLE_EMAIL_AUTH=true to enable an email/password form on the sign-in modal, using Supabase's built-in email auth. Disabled by default so the hosted app is unaffected. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
38290d3 to
6f21c3b
Compare
|



Summary
Self-hosted users currently have no way to sign in without first configuring Google or Microsoft OAuth credentials. Setting up OAuth for a local or self-hosted instance means creating a cloud project, registering redirect URIs, and managing client secrets — overhead that isn't worth it when you just want to run Core on your own infrastructure.
This PR adds an optional email/password sign-in form to the landing page, gated behind a single env var. The hosted app is completely unaffected — the form only appears when explicitly enabled.
Before (default — unchanged)
Only OAuth buttons shown. No configuration needed for hosted deployments.
After (
VITE_ENABLE_EMAIL_AUTH=true)Email/password form appears below OAuth, using Supabase's built-in email auth. No additional backend changes required.
Changes
core-web/src/components/Landing/LandingPage.tsx— email/password form with sign-in/sign-up toggle, conditionally rendered whenVITE_ENABLE_EMAIL_AUTH=truecore-web/.env.example— documented new env var under[OPTIONAL]tier with usage guidanceUsage
# In core-web/.env VITE_ENABLE_EMAIL_AUTH=trueFollow-up
InviteAcceptPageandShareLinkResolveralso have sign-in flows but only offer OAuth. Self-hosted users who receive an invite or share link would still be blocked without OAuth configured. Email auth should be extended to those surfaces in a follow-up PR.Test plan
VITE_ENABLE_EMAIL_AUTH=true: email form appears below OAuth buttons with "or" divider🤖 Generated with Claude Code