mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-20 20:24:44 +02:00
Update jdbc string
should also update the password here.
This commit is contained in:
parent
1bae239971
commit
0a5810358a
@ -26,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, $set) => $this->rotatePassword($service, $database, $set))
|
->action(fn (DatabasePasswordService $service, Database $database, $set, $get) => $this->rotatePassword($service, $database, $set, $get))
|
||||||
)
|
)
|
||||||
->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'),
|
||||||
@ -59,9 +59,12 @@ class DatabasesRelationManager extends RelationManager
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function rotatePassword(DatabasePasswordService $service, Database $database, $set): void
|
protected function rotatePassword(DatabasePasswordService $service, Database $database, $set, $get): void
|
||||||
{
|
{
|
||||||
$newPassword = $service->handle($database);
|
$newPassword = $service->handle($database);
|
||||||
|
$jdbcString = 'jdbc:mysql://' . $get('username') . ':' . urlencode($newPassword) . '@' . $database->host->host . ':' . $database->host->port . '/' . $get('database');
|
||||||
|
|
||||||
$set('password', $newPassword);
|
$set('password', $newPassword);
|
||||||
|
$set('JDBC', $jdbcString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user