Commit 2811cf3
feat: add DISABLE_EMAIL_SIGN_UP to control email and OAuth signups separately (cgoinglove#331)
## Summary
This PR introduces a new environment variable `DISABLE_EMAIL_SIGN_UP` to
allow more granular control over user signup methods.
## Problem
Previously, `DISABLE_SIGN_UP` controlled both email/password signups AND
OAuth signups (Google, GitHub, Microsoft) together. This made it
impossible to:
- Allow OAuth signups while blocking email signups
- Require users to use corporate SSO while preventing email registration
## Solution
Separated the controls into three distinct environment variables:
| Variable | Controls |
|----------|----------|
| `DISABLE_EMAIL_SIGN_IN` | Disables email/password authentication
entirely (both sign-in and sign-up) |
| `DISABLE_EMAIL_SIGN_UP` | Disables email/password signups only (allows
existing users to sign in) |
| `DISABLE_SIGN_UP` | Disables OAuth signups only (Google, GitHub,
Microsoft) |
## Changes
- Modified `src/lib/auth/config.ts` to use `DISABLE_EMAIL_SIGN_UP` for
email signup control
- Updated `.env.example` with clear documentation for all three
variables
- Added comments to clarify the separation of concerns
## Use Cases
This enables administrators to:
1. ✅ Allow OAuth signups but block email signups
2. ✅ Require corporate SSO authentication only
3. ✅ Disable all signups (both email and OAuth) for closed systems
4. ✅ Allow email signups but block OAuth signups
## Backwards Compatibility
- Existing configurations continue to work as expected
- If `DISABLE_EMAIL_SIGN_UP` is not set, defaults to allowing email
signups (same as before)
- `DISABLE_SIGN_UP` now only affects OAuth providers (as the name
suggests)
## Testing
- [ ] Tested with `DISABLE_EMAIL_SIGN_UP=1` and `DISABLE_SIGN_UP=0`
(OAuth only)
- [ ] Tested with `DISABLE_EMAIL_SIGN_UP=0` and `DISABLE_SIGN_UP=1`
(Email only)
- [ ] Tested with both enabled and both disabled
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude <[email protected]>
Co-authored-by: choi sung keun <[email protected]>1 parent d53818f commit 2811cf3
3 files changed
+15
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | | - | |
| 79 | + | |
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
83 | | - | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
84 | 88 | | |
85 | 89 | | |
86 | 90 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
65 | | - | |
| 64 | + | |
| 65 | + | |
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| |||
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
| 176 | + | |
176 | 177 | | |
177 | 178 | | |
178 | 179 | | |
| |||
263 | 264 | | |
264 | 265 | | |
265 | 266 | | |
266 | | - | |
| 267 | + | |
267 | 268 | | |
268 | 269 | | |
269 | 270 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| |||
102 | 103 | | |
103 | 104 | | |
104 | 105 | | |
105 | | - | |
106 | | - | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
107 | 110 | | |
108 | 111 | | |
109 | 112 | | |
| |||
0 commit comments