mirror of
https://github.com/coollabsio/coolify.git
synced 2026-03-11 08:55:47 +00:00
feat: add separate OAuth registration toggle
Add is_oauth_registration_enabled setting so admins can allow new users to register through OAuth providers while keeping general (password-based) registration disabled. Closes #8042
This commit is contained in:
parent
4ec32290cf
commit
9caa3fc83d
4 changed files with 34 additions and 1 deletions
|
|
@ -22,7 +22,7 @@ class OauthController extends Controller
|
|||
$user = User::whereEmail($oauthUser->email)->first();
|
||||
if (! $user) {
|
||||
$settings = instanceSettings();
|
||||
if (! $settings->is_registration_enabled) {
|
||||
if (! $settings->is_registration_enabled && ! $settings->is_oauth_registration_enabled) {
|
||||
abort(403, 'Registration is disabled');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,9 @@ class Advanced extends Component
|
|||
#[Validate('boolean')]
|
||||
public bool $is_registration_enabled;
|
||||
|
||||
#[Validate('boolean')]
|
||||
public bool $is_oauth_registration_enabled;
|
||||
|
||||
#[Validate('boolean')]
|
||||
public bool $do_not_track;
|
||||
|
||||
|
|
@ -41,6 +44,7 @@ class Advanced extends Component
|
|||
{
|
||||
return [
|
||||
'is_registration_enabled' => 'boolean',
|
||||
'is_oauth_registration_enabled' => 'boolean',
|
||||
'do_not_track' => 'boolean',
|
||||
'is_dns_validation_enabled' => 'boolean',
|
||||
'custom_dns_servers' => 'nullable|string',
|
||||
|
|
@ -62,6 +66,7 @@ class Advanced extends Component
|
|||
$this->allowed_ips = $this->settings->allowed_ips;
|
||||
$this->do_not_track = $this->settings->do_not_track;
|
||||
$this->is_registration_enabled = $this->settings->is_registration_enabled;
|
||||
$this->is_oauth_registration_enabled = $this->settings->is_oauth_registration_enabled;
|
||||
$this->is_dns_validation_enabled = $this->settings->is_dns_validation_enabled;
|
||||
$this->is_api_enabled = $this->settings->is_api_enabled;
|
||||
$this->disable_two_step_confirmation = $this->settings->disable_two_step_confirmation;
|
||||
|
|
@ -138,6 +143,7 @@ class Advanced extends Component
|
|||
{
|
||||
try {
|
||||
$this->settings->is_registration_enabled = $this->is_registration_enabled;
|
||||
$this->settings->is_oauth_registration_enabled = $this->is_oauth_registration_enabled;
|
||||
$this->settings->do_not_track = $this->do_not_track;
|
||||
$this->settings->is_dns_validation_enabled = $this->is_dns_validation_enabled;
|
||||
$this->settings->custom_dns_servers = $this->custom_dns_servers;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('instance_settings', function (Blueprint $table) {
|
||||
$table->boolean('is_oauth_registration_enabled')->default(false)->after('is_registration_enabled');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('instance_settings', function (Blueprint $table) {
|
||||
$table->dropColumn('is_oauth_registration_enabled');
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
@ -21,6 +21,11 @@
|
|||
helper="Allow users to self-register. If disabled, only administrators can create accounts."
|
||||
label="Registration Allowed" />
|
||||
</div>
|
||||
<div class="md:w-96">
|
||||
<x-forms.checkbox instantSave id="is_oauth_registration_enabled"
|
||||
helper="Allow new users to register through OAuth providers (GitHub, Google, etc.) even when general registration is disabled."
|
||||
label="OAuth Registration Allowed" />
|
||||
</div>
|
||||
<div class="md:w-96">
|
||||
<x-forms.checkbox instantSave id="do_not_track"
|
||||
helper="Opt out of reporting this instance to coolify.io's installation count. No other data is collected."
|
||||
|
|
|
|||
Loading…
Reference in a new issue