mirror of
https://github.com/pelican-dev/panel.git
synced 2025-12-24 22:34:04 +01:00
Fix oauth providers with no color (#2044)
This commit is contained in:
parent
b1c64e2ef1
commit
ac36e7a4b5
@ -299,11 +299,15 @@ class UserResource extends Resource
|
||||
|
||||
$id = $schema->getId();
|
||||
$name = $schema->getName();
|
||||
|
||||
$color = $schema->getHexColor();
|
||||
$color = is_string($color) ? Color::hex($color) : null;
|
||||
|
||||
$actions[] = Action::make("oauth_$id")
|
||||
->label(trans('profile.unlink', ['name' => $name]))
|
||||
->icon('tabler-unlink')
|
||||
->requiresConfirmation()
|
||||
->color(Color::hex($schema->getHexColor()))
|
||||
->color($color)
|
||||
->action(function ($livewire) use ($oauthService, $user, $name, $schema) {
|
||||
$oauthService->unlinkUser($user, $schema);
|
||||
$livewire->form->fill($user->attributesToArray());
|
||||
|
||||
@ -181,12 +181,15 @@ class EditProfile extends BaseEditProfile
|
||||
$id = $schema->getId();
|
||||
$name = $schema->getName();
|
||||
|
||||
$color = $schema->getHexColor();
|
||||
$color = is_string($color) ? Color::hex($color) : null;
|
||||
|
||||
$unlink = array_key_exists($id, $this->getUser()->oauth ?? []);
|
||||
|
||||
$actions[] = Action::make("oauth_$id")
|
||||
->label(trans('profile.' . ($unlink ? 'unlink' : 'link'), ['name' => $name]))
|
||||
->icon($unlink ? 'tabler-unlink' : 'tabler-link')
|
||||
->color(Color::hex($schema->getHexColor()))
|
||||
->color($color)
|
||||
->action(function (UserUpdateService $updateService) use ($id, $name, $unlink) {
|
||||
if ($unlink) {
|
||||
$oauth = user()?->oauth;
|
||||
|
||||
@ -76,10 +76,13 @@ class Login extends BaseLogin
|
||||
|
||||
$id = $schema->getId();
|
||||
|
||||
$color = $schema->getHexColor();
|
||||
$color = is_string($color) ? Color::hex($color) : null;
|
||||
|
||||
$actions[] = Action::make("oauth_$id")
|
||||
->label($schema->getName())
|
||||
->icon($schema->getIcon())
|
||||
->color(Color::hex($schema->getHexColor()))
|
||||
->color($color)
|
||||
->url(route('auth.oauth.redirect', ['driver' => $id], false));
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user