Skip to content

Commit 69a54e4

Browse files
use original auth logic
1 parent 7d868c7 commit 69a54e4

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

src/FilamentDevelopersLogin.php

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,23 +26,29 @@ public function login(Panel $panel, FilamentDeveloperLoginsPlugin $plugin, strin
2626
->where($plugin->getColumn(), $credentials)
2727
->first();
2828

29+
2930
if (! $model) {
3031
throw ValidationException::withMessages([
3132
'developer-logins-failed' => __('filament-developer-logins::auth.messages.failed_not_found'),
3233
]);
3334
}
3435

35-
if (! $model instanceof FilamentUser || $model->canAccessPanel($panel)) {
36-
$panel->auth()->login($model);
36+
$panel->auth()->login($model);
3737

38-
session()->regenerate();
38+
if (
39+
($model instanceof FilamentUser) &&
40+
(! $model->canAccessPanel($panel))
41+
) {
42+
$panel->auth()->logout();
3943

40-
return redirect()
41-
->to($plugin->getRedirectTo() ?? $panel->getUrl());
44+
throw ValidationException::withMessages([
45+
'developer-logins-failed' => __('filament-developer-logins::auth.messages.failed'),
46+
]);
4247
}
4348

44-
throw ValidationException::withMessages([
45-
'developer-logins-failed' => __('filament-developer-logins::auth.messages.failed'),
46-
]);
49+
session()->regenerate();
50+
51+
return redirect()
52+
->to($plugin->getRedirectTo() ?? $panel->getUrl());
4753
}
4854
}

0 commit comments

Comments
 (0)