feat(auth): enable local user signup without SMTP, add admin user creation
- Remove SMTP hard-requirement from /api/auth/signup: when SMTP is not
configured accounts are activated immediately (no email verification).
When SMTP is configured the existing email-verification flow is kept.
- Inject allow_signup into global template context via app/views/base.py
- Add data-allow-signup attribute to base.html body tag
- Update common.js _renderLoggedOutAuth to show Sign Up (→ /signup) when
signup is enabled, otherwise Get Started (→ /pricing)
- Add admin API endpoints before the /{user_id:path} catch-all:
GET /api/admin/users/local – list all local accounts
POST /api/admin/users/local – admin-create local account (active immediately)
DELETE /api/admin/users/local/{id} – delete local account + profile
- Add LocalUserCreate / LocalUserResponse Pydantic schemas
- Update admin_users.html with Local User Accounts section and modals
- Update .env.demo to document ALLOW_LOCAL_SIGNUP
- Update docs/BillingSetup.md: SMTP is optional, document both flows
- Update tests: test_signup_smtp_not_configured now asserts 201 + immediate
activation; add 7 new integration tests for admin local user endpoints
Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
+12
-2
@@ -19,14 +19,14 @@ This guide covers how to configure Stripe billing and local user sign-up in Docu
|
||||
|
||||
By default, user accounts are created by an administrator. To allow users to self-register with an email address and password, set `ALLOW_LOCAL_SIGNUP=true`.
|
||||
|
||||
> **Note:** SMTP must be configured before enabling local sign-up. New accounts require email verification before they can log in.
|
||||
> **Note:** SMTP is **optional** for local sign-up. When SMTP is configured, new accounts require email verification before they can log in. Without SMTP, accounts are activated immediately upon registration — useful for self-hosted deployments without email infrastructure.
|
||||
|
||||
### Configuration
|
||||
|
||||
```bash
|
||||
ALLOW_LOCAL_SIGNUP=true
|
||||
|
||||
# SMTP (required for verification emails)
|
||||
# SMTP (optional — enables email verification and password reset)
|
||||
EMAIL_HOST=smtp.example.com
|
||||
EMAIL_PORT=587
|
||||
EMAIL_USERNAME=noreply@example.com
|
||||
@@ -37,11 +37,21 @@ EMAIL_SENDER=DocuElevate <noreply@example.com>
|
||||
|
||||
### Sign-up Flow
|
||||
|
||||
**With SMTP configured (recommended):**
|
||||
1. User visits `/signup` and fills out the registration form.
|
||||
2. DocuElevate sends a verification email with a 24-hour token link.
|
||||
3. User clicks the link — their account is activated and they are signed in.
|
||||
4. First-time users are redirected to the onboarding wizard.
|
||||
|
||||
**Without SMTP:**
|
||||
1. User visits `/signup` and fills out the registration form.
|
||||
2. Account is activated immediately — no email verification required.
|
||||
3. User is redirected to the login page to sign in straight away.
|
||||
|
||||
### Admin-Created Accounts
|
||||
|
||||
Administrators can create local user accounts directly from the **Admin → User Management** page without requiring self-registration. Admin-created accounts are immediately active regardless of SMTP configuration.
|
||||
|
||||
### Password Reset Flow
|
||||
|
||||
1. User clicks "Forgot password?" on the login page.
|
||||
|
||||
Reference in New Issue
Block a user