mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-20 15:44:45 +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 $listeners = ['refresh' => 'refreshForm'];
|
||||
|
||||
public function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
@ -28,7 +26,7 @@ class DatabasesRelationManager extends RelationManager
|
||||
Action::make('rotate')
|
||||
->icon('tabler-refresh')
|
||||
->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)),
|
||||
Forms\Components\TextInput::make('remote')->label('Connections From'),
|
||||
@ -60,4 +58,10 @@ class DatabasesRelationManager extends RelationManager
|
||||
//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