Skip to content

feat: allow OAuth-only self-registration when general registration is disabled#9602

Open
LK-maker-007 wants to merge 1 commit intocoollabsio:nextfrom
LK-maker-007:feat/oauth-registration-v2
Open

feat: allow OAuth-only self-registration when general registration is disabled#9602
LK-maker-007 wants to merge 1 commit intocoollabsio:nextfrom
LK-maker-007:feat/oauth-registration-v2

Conversation

@LK-maker-007
Copy link
Copy Markdown

@LK-maker-007 LK-maker-007 commented Apr 16, 2026

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_enabled toggle 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, default false
  • app/Models/InstanceSettings.php — added to $fillable and $casts
  • app/Http/Controllers/OauthController.php — allow OAuth user creation when is_oauth_registration_enabled is true
  • app/Livewire/Settings/Advanced.php — property, validation, mount, instantSave
  • resources/views/livewire/settings/advanced.blade.php — checkbox inside @else block (registration disabled state)

Issues

Category

  • Bug fix
  • Improvement
  • New feature
  • Adding new one click service
  • Fixing or updating existing one click service

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.

Allow OAuth Registration checkbox

AI Assistance

  • AI was used

Testing

  1. Spin up dev instance, run php artisan migrate:fresh --seed
  2. Login as test@example.com / password
  3. Go to Settings → Advanced
  4. Disable "Registration Allowed" → "Allow OAuth Registration" checkbox appears
  5. Enable it → saves and persists on reload
  6. OAuth callback (/auth/{provider}/callback) now creates new users when is_oauth_registration_enabled = true

Contributor Agreement

Important

  • I have read and understood the contributor guidelines. If I have failed to follow any guideline, I understand that this PR may be closed without review.
  • I have searched existing issues and pull requests (including closed ones) to ensure this isn't a duplicate.
  • I have tested all the changes thoroughly with a local development instance of Coolify and I am confident that they will work as expected when a maintainer tests them.

… 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant