Prompt
I'm building a customer portal and need MFA, password reset, and profile management
Latest observation
Oct 28, 2026
OpenAI APIWeb search: off
Absolutely — for a customer portal, those three features are a solid baseline for identity and account security.
Here’s a practical way to structure them:
1) MFA (Multi-Factor Authentication)
Support at least:
- TOTP authenticator apps (Google Authenticator, Authy, Microsoft Authenticator)
- Email OTP as a fallback or step-up method
- Optional later: SMS or passkeys/WebAuthn if you want stronger security
Recommended flow:
- User enables MFA from profile/security settings
- System shows QR code for TOTP enrollment
- User confirms setup with a one-time code
- Store:
- MFA type
- secret key securely encrypted
- recovery codes
- backup method status
Good practices:
- Generate and display recovery codes once
- Allow users to regenerate recovery codes
- Require MFA for sensitive actions like email change, password change, and billing updates
2) Password Reset
Use a secure reset flow:
- User requests reset by entering email
- System sends a single-use, time-limited token
- Token opens reset page
- User sets new password
- Invalidate all existing sessions after reset
Recommended details:
- Reset token expires in 15–60 minutes
- Token should be random, long, and stored hashed
- Don’t reveal whether an email exists: show a generic confirmation message
- Rate-limit reset requests
3) Profile Management
Typical profile features:
- View/edit name, email, phone, address
- Change password
- Manage MFA
- View active sessions/devices
- Update communication preferences
- Delete account / export data if needed
Security controls:
- Re-authenticate before sensitive changes
- Verify new email before switching primary email
- Audit log important changes
- Session revocation on password/email changes
Suggested data model
You’ll likely need tables/collections like:
- users
- user_profiles
- mfa_factors
- password_reset_tokens
- recovery_codes
- sessions
- audit_logs
Suggested endpoints
Example REST-style endpoints:
POST /auth/loginPOST /auth/mfa/verifyPOST /auth/mfa/enrollPOST /auth/mfa/confirmPOST /auth/password-reset/requestPOST /auth/password-reset/confirmGET /mePATCH /mePOST /me/passwordPOST /me/mfa/disableGET /me/sessionsDELETE /me/sessions/:id
Recommended security checklist
- Password hashing with Argon2id or bcrypt
- HTTPS only
- CSRF protection if using cookies
- Rate limiting on login/reset/MFA endpoints
- Audit logs for auth changes
- Secure session handling
- Email verification for account email changes
If you want to move fast
If you’re not required to build auth from scratch, consider using an identity provider:
- Auth0
- AWS Cognito
- Firebase Auth
- Clerk
- Azure AD B2C
- Keycloak (self-hosted)
They can reduce time significantly for MFA and password reset.
If you want, I can help with any of these next:
- a full feature spec
- a database schema
- API endpoint design
- a React/Node implementation
- a security checklist / threat model