feat: allow OAuth-only self-registration when general registration is disabled#9602
Open
LK-maker-007 wants to merge 1 commit intocoollabsio:nextfrom
Open
feat: allow OAuth-only self-registration when general registration is disabled#9602LK-maker-007 wants to merge 1 commit intocoollabsio:nextfrom
LK-maker-007 wants to merge 1 commit intocoollabsio:nextfrom
Conversation
… disabled Closes coollabsio#8042 ## Problem When an admin sets , users cannot self-register via OAuth providers (GitHub, Google, etc.) even if the admin wants to allow OAuth logins as the sole registration method. This forces admins to either enable registration for everyone or manually create every user account. ## Solution Add a new instance setting that, when enabled, allows new user accounts to be created via OAuth even while general password-based registration remains closed. ### Changes - **Migration**: adds boolean column (default: false) to table - **Model** (): registers field in `$fillable` and `$casts` - **OauthController**: updates the registration guard to allow OAuth account creation when either flag is true - **Livewire** (): wires up the new property in mount, rules, and instantSave - **Blade view**: adds an "Allow OAuth Registration" checkbox that appears only when general registration is disabled, so the UI is contextually clear ### Behaviour | is_registration_enabled | is_oauth_registration_enabled | Result | |---|---|---| | true | any | All registrations allowed | | false | false | No self-registration (original behaviour) | | false | true | OAuth-only self-registration allowed | Existing OAuth users (already have an account) are always able to log in — this change only controls new account creation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
When general registration is disabled, users could not self-register even via OAuth providers (GitHub, Google, etc). This adds a dedicated
is_oauth_registration_enabledtoggle so admins can allow OAuth-only signups while keeping password-based registration locked down.The checkbox appears in Settings → Advanced only when "Registration Allowed" is turned off — so it never shows redundantly when open registration is active.
Files changed:
database/migrations/2026_04_16_000000_add_oauth_registration_to_instance_settings.php— boolean column, defaultfalseapp/Models/InstanceSettings.php— added to$fillableand$castsapp/Http/Controllers/OauthController.php— allow OAuth user creation whenis_oauth_registration_enabledis trueapp/Livewire/Settings/Advanced.php— property, validation, mount, instantSaveresources/views/livewire/settings/advanced.blade.php— checkbox inside@elseblock (registration disabled state)Issues
Category
Preview
Tested on local instance v4.0.0-beta.474. When "Registration Allowed" is OFF, the "Allow OAuth Registration" checkbox appears below it, saves instantly, and persists on reload.
AI Assistance
Testing
php artisan migrate:fresh --seedtest@example.com/password/auth/{provider}/callback) now creates new users whenis_oauth_registration_enabled = trueContributor Agreement
Important