Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fixed missing "hash" issue #35

Merged
merged 1 commit into from
Jun 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions config/filament-lockscreen.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
<?php

use Filament\Facades\Filament;

return [

/*
* Lock Screen Icon
*/
'icon' => 'heroicon-s-lock-closed',

/*
| ------------------------------------------------------------------------------------------------
| Table Column Name
| ------------------------------------------------------------------------------------------------
| Change the table column name if your login authentication column is checking on a different field and not on the default field ('email and password') column of the table.
*/
'table_columns' => [
'account_username_field' => 'email',
'account_password_field' => 'password',
],

/* =======================================
* if `enable_redirect_to` is TRUE then after login, it will be redirected to the route setup under `redirect_route`
*/
Expand Down
8 changes: 6 additions & 2 deletions src/Http/Livewire/LockerScreen.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ class LockerScreen extends Component implements HasForms

public ?string $password = '';

private ?string $account_username_field, $account_password_field;

public function mount()
{
session(['lockscreen' => true]);
Expand All @@ -42,6 +44,8 @@ protected function forceLogout()
public function login()
{
$data = $this->form->getState();
$this->account_password_field = config('filament-lockscreen.table_columns.account_password_field');
$this->account_username_field = config('filament-lockscreen.table_columns.account_username_field');

/*
* Rate Limit
Expand All @@ -66,8 +70,8 @@ public function login()
}

if (! Filament::auth()->attempt([
'email' => Filament::auth()->user()->email,
'password' => $data['password']
$this->account_username_field => Filament::auth()->user()->{$this->account_username_field},
$this->account_password_field => $data['password']
])) {
$this->addError('password', __('filament::login.messages.failed'));
return null;
Expand Down