Fix oauth providers with no color (#2044)

This commit is contained in:
Boy132 2025-12-24 14:38:47 +01:00 committed by GitHub
parent b1c64e2ef1
commit ac36e7a4b5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 13 additions and 3 deletions

View File

@ -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());

View File

@ -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;

View File

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