Skip to content

Commit

Permalink
make password hidden / revealable
Browse files Browse the repository at this point in the history
  • Loading branch information
notAreYouScared committed Nov 22, 2024
1 parent 4592fde commit eb79fad
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions app/Filament/Resources/ServerResource/Pages/EditServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -641,18 +641,20 @@ 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'))
->icon('tabler-refresh')
->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)
Expand All @@ -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')),
Expand Down

0 comments on commit eb79fad

Please sign in to comment.