mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-20 23:54:44 +02:00
Fix db password rotation
updates the password textbox when password is rotated.
This commit is contained in:
parent
597f74f105
commit
1bae239971
@ -15,8 +15,6 @@ class DatabasesRelationManager extends RelationManager
|
|||||||
{
|
{
|
||||||
protected static string $relationship = 'databases';
|
protected static string $relationship = 'databases';
|
||||||
|
|
||||||
protected $listeners = ['refresh' => 'refreshForm'];
|
|
||||||
|
|
||||||
public function form(Form $form): Form
|
public function form(Form $form): Form
|
||||||
{
|
{
|
||||||
return $form
|
return $form
|
||||||
@ -28,7 +26,7 @@ class DatabasesRelationManager extends RelationManager
|
|||||||
Action::make('rotate')
|
Action::make('rotate')
|
||||||
->icon('tabler-refresh')
|
->icon('tabler-refresh')
|
||||||
->requiresConfirmation()
|
->requiresConfirmation()
|
||||||
->action(fn (DatabasePasswordService $service, Database $database) => $service->handle($database))
|
->action(fn (DatabasePasswordService $service, Database $database, $set) => $this->rotatePassword($service, $database, $set))
|
||||||
)
|
)
|
||||||
->formatStateUsing(fn (Database $database) => decrypt($database->password)),
|
->formatStateUsing(fn (Database $database) => decrypt($database->password)),
|
||||||
Forms\Components\TextInput::make('remote')->label('Connections From'),
|
Forms\Components\TextInput::make('remote')->label('Connections From'),
|
||||||
@ -60,4 +58,10 @@ class DatabasesRelationManager extends RelationManager
|
|||||||
//Tables\Actions\EditAction::make(),
|
//Tables\Actions\EditAction::make(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function rotatePassword(DatabasePasswordService $service, Database $database, $set): void
|
||||||
|
{
|
||||||
|
$newPassword = $service->handle($database);
|
||||||
|
$set('password', $newPassword);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user