Skip to content

Commit e14bb7d

Browse files
authored
Fix oauth provider "enabled" checks (#2142)
1 parent c770937 commit e14bb7d

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

app/Extensions/OAuth/Schemas/OAuthSchema.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,7 @@ public function getHexColor(): ?string
118118

119119
public function isEnabled(): bool
120120
{
121-
$id = Str::upper($this->getId());
122-
123-
return env("OAUTH_{$id}_ENABLED", false);
121+
return env($this->getConfigKey(), false);
124122
}
125123

126124
public function shouldCreateMissingUser(OAuthUser $user): bool

app/Filament/Admin/Pages/Settings.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -563,26 +563,25 @@ private function oauthSettings(): array
563563

564564
$oauthSchemas = $this->oauthService->getAll();
565565
foreach ($oauthSchemas as $schema) {
566-
$id = Str::upper($schema->getId());
567566
$key = $schema->getConfigKey();
568567

569568
$formFields[] = Section::make($schema->getName())
570569
->columns(5)
571570
->icon($schema->getIcon() ?? 'tabler-brand-oauth')
572-
->collapsed(fn () => !env($key, false))
571+
->collapsed(fn () => !$schema->isEnabled())
573572
->collapsible()
574573
->schema([
575574
Hidden::make($key)
576575
->live()
577-
->default(env($key)),
576+
->default($schema->isEnabled()),
578577
Actions::make([
579-
Action::make("disable_oauth_$id")
578+
Action::make('disable_oauth_' . $schema->getId())
580579
->visible(fn (Get $get) => $get($key))
581580
->disabled(fn () => !user()?->can('update settings'))
582581
->label(trans('admin/setting.oauth.disable'))
583582
->color('danger')
584583
->action(fn (Set $set) => $set($key, false)),
585-
Action::make("enable_oauth_$id")
584+
Action::make('enable_oauth_' . $schema->getId())
586585
->visible(fn (Get $get) => !$get($key))
587586
->disabled(fn () => !user()?->can('update settings'))
588587
->label(trans('admin/setting.oauth.enable'))

0 commit comments

Comments
 (0)