-
Notifications
You must be signed in to change notification settings - Fork 3.4k
[GIT-66] improvement: prevent disabling last enabled authentication method #8570
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: preview
Are you sure you want to change the base?
Conversation
📝 WalkthroughWalkthroughThis change set implements validation and UI improvements for authentication method management. A new helper validates whether authentication methods can be disabled (ensuring at least one remains enabled), type definitions are restructured to include enabledConfigKey mappings, and the admin authentication page now validates disabling actions with user feedback before proceeding with API calls. Changes
Sequence DiagramsequenceDiagram
participant User
participant AdminUI as Admin Authentication Page
participant Validation as canDisableAuthMethod
participant API as API Service
participant Toast as Toast Notification
User->>AdminUI: Click to disable auth method
AdminUI->>Validation: Validate disabling (configKey, authModes, config)
alt At least 2 methods enabled
Validation-->>AdminUI: Allowed (true)
AdminUI->>AdminUI: Set submitting state
AdminUI->>API: Call updateInstanceConfigurations
API-->>AdminUI: Success response
AdminUI->>Toast: Show success toast
AdminUI->>AdminUI: Clear submitting state
else Only 1 method enabled
Validation-->>AdminUI: Not allowed (false)
AdminUI->>Toast: Show error toast
AdminUI->>AdminUI: Abort update
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
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 |
|
Linked to Plane Work Item(s) This comment was auto-generated by Plane |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/web/core/components/account/auth-forms/auth-root.tsx (1)
43-108: Guard “no auth methods” state until config is available.If
configis still undefined during load,noAuthMethodsAvailablecan briefly flip true and show the empty-state message. Consider gating the check on config availability.✅ Suggested guard
- const isEmailBasedAuthEnabled = config?.is_email_password_enabled || config?.is_magic_login_enabled; - const noAuthMethodsAvailable = !isOAuthEnabled && !isEmailBasedAuthEnabled; + const isEmailBasedAuthEnabled = config?.is_email_password_enabled || config?.is_magic_login_enabled; + const hasAuthConfig = config !== undefined; + const noAuthMethodsAvailable = hasAuthConfig && !isOAuthEnabled && !isEmailBasedAuthEnabled;
dattamlong
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some comments
Description
Adds validation to ensure at least one authentication method remains enabled. This prevents users from being locked out of the system by disabling all authentication options.
Type of Change
Screenshots and Media (if applicable)
Summary by CodeRabbit
New Features
Bug Fixes
✏️ Tip: You can customize this high-level summary in your review settings.