This commit is contained in:
Nenad Ilic 2026-03-11 03:27:04 +08:00 committed by GitHub
commit ed5b4e300b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 34 additions and 1 deletions

View file

@ -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');
}

View file

@ -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;
@ -142,6 +147,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;

View file

@ -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');
});
}
};

View file

@ -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."