From eb79fad90eb17aa6572d818e3230b2cc69c1ed7c Mon Sep 17 00:00:00 2001 From: notCharles Date: Fri, 22 Nov 2024 09:38:52 -0500 Subject: [PATCH] make password hidden / revealable --- .../Resources/ServerResource/Pages/EditServer.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/Filament/Resources/ServerResource/Pages/EditServer.php b/app/Filament/Resources/ServerResource/Pages/EditServer.php index 6530dfc2a0..0d02325bca 100644 --- a/app/Filament/Resources/ServerResource/Pages/EditServer.php +++ b/app/Filament/Resources/ServerResource/Pages/EditServer.php @@ -641,9 +641,12 @@ public function form(Form $form): Form TextInput::make('username') ->disabled() ->formatStateUsing(fn ($record) => $record->username) - ->columnSpan(2), + ->columnSpan(1), TextInput::make('password') ->disabled() + ->password() + ->revealable() + ->columnSpan(1) ->hintAction( Action::make('rotate') ->authorize(fn (Server $server) => auth()->user()->can('update database')) @@ -651,8 +654,7 @@ public function form(Form $form): Form ->requiresConfirmation() ->action(fn (DatabasePasswordService $service, $record, $set, $get) => $this->rotatePassword($service, $record, $set, $get)) ) - ->formatStateUsing(fn (Database $database) => $database->password) - ->columnSpan(2), + ->formatStateUsing(fn (Database $database) => $database->password), TextInput::make('remote') ->disabled() ->formatStateUsing(fn ($record) => $record->remote) @@ -664,6 +666,8 @@ public function form(Form $form): Form ->columnSpan(1), TextInput::make('JDBC') ->disabled() + ->password() + ->revealable() ->label('JDBC Connection String') ->columnSpan(2) ->formatStateUsing(fn (Get $get, $record) => 'jdbc:mysql://' . $get('username') . ':' . urlencode($record->password) . '@' . $record->host->host . ':' . $record->host->port . '/' . $get('database')),