Fix OAuthProvider & Add ColorPicker for Authentik (#975)

* Fix driver name

* Fix AuthentikProvider config & Add ColorPicker

* Add sqlite-journal to .gitignore
This commit is contained in:
MartinOscar 2025-02-07 17:28:06 +01:00 committed by GitHub
parent 77bf70b063
commit 9ec2f6eae1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 13 additions and 9 deletions

1
.gitignore vendored
View File

@ -23,6 +23,7 @@ yarn-error.log
public/assets/manifest.json
/database/*.sqlite
/database/*.sqlite-journal
filament-monaco-editor/
_ide_helper*
/.phpstorm.meta.php

View File

@ -2,6 +2,7 @@
namespace App\Extensions\OAuth\Providers;
use Filament\Forms\Components\ColorPicker;
use Filament\Forms\Components\TextInput;
use SocialiteProviders\Authentik\Provider;
@ -20,11 +21,9 @@ final class AuthentikProvider extends OAuthProvider
public function getServiceConfig(): array
{
return [
'client_id' => null,
'client_secret' => env('OAUTH_STEAM_CLIENT_SECRET'),
'allowed_hosts' => [
str_replace(['http://', 'https://'], '', env('APP_URL')),
],
'base_url' => env('OAUTH_AUTHENTIK_BASE_URL'),
'client_id' => env('OAUTH_AUTHENTIK_CLIENT_ID'),
'client_secret' => env('OAUTH_AUTHENTIK_CLIENT_SECRET'),
];
}
@ -42,9 +41,13 @@ final class AuthentikProvider extends OAuthProvider
TextInput::make('OAUTH_AUTHENTIK_DISPLAY_NAME')
->label('Display Name')
->placeholder('Display Name')
->columnSpan(2)
->autocomplete(false)
->default(env('OAUTH_AUTHENTIK_DISPLAY_NAME', 'Authentik')),
ColorPicker::make('OAUTH_AUTHENTIK_DISPLAY_COLOR')
->label('Display Color')
->placeholder('#fd4b2d')
->default(env('OAUTH_AUTHENTIK_DISPLAY_COLOR', '#fd4b2d'))
->hex(),
]);
}
@ -55,7 +58,7 @@ final class AuthentikProvider extends OAuthProvider
public function getHexColor(): string
{
return '#fd4b2d';
return env('OAUTH_AUTHENTIK_DISPLAY_COLOR') ?? '#fd4b2d';
}
public static function register(): self

View File

@ -17,7 +17,7 @@ final class DiscordProvider extends OAuthProvider
return 'discord';
}
public function getProvider(): string
public function getProviderClass(): string
{
return Provider::class;
}

View File

@ -168,7 +168,7 @@ class EditProfile extends BaseEditProfile
->success()
->send();
} else {
redirect(Socialite::with($name)->redirect()->getTargetUrl());
redirect(Socialite::with($id)->redirect()->getTargetUrl());
}
});
}