Redirect to login page showing error

I'm trying to create a Middleware to validate User Status (When user is logged in and admins change the status to inactive, I have to redirect user to the login page and show a specific error). I can show specific errors on login, but just overriding function throwFailureValidationException from Login and when user is already on login page, but when i am inside system and try to redirect with something like bellow, it not works. (Redirect but doesn't show message error).

throw ValidationException::withMessages([
'data.login' => __('filament-panels::pages/auth/login.messages.failed'),
]);

throw ValidationException::withMessages([
'data.login' => __('filament-panels::pages/auth/login.messages.failed'),
]);
6 Replies
leoblanski
leoblanskiOP12mo ago
More details:
No description
leoblanski
leoblanskiOP12mo ago
When i'm already on Login page, and try to do login with inactive user, show message. When i'm inside other page, and redirect to Login, it not works. If i use the notification like below, it redirects and show notification on login page normally.
Notification::make()
->title(__('Your account is currently inactive!', [
'seconds' => 60,
]))
->body(__('Please get in touch with the systems administrator to reactivate your account.', [
'seconds' => 60,
]))
->danger()
->send();
Notification::make()
->title(__('Your account is currently inactive!', [
'seconds' => 60,
]))
->body(__('Please get in touch with the systems administrator to reactivate your account.', [
'seconds' => 60,
]))
->danger()
->send();
Pasteko
Pasteko12mo ago
Hello, I'm trying to achieve the same result, have you found a solution?
leoblanski
leoblanskiOP12mo ago
Not yet @Pasteko 😦
DrByte
DrByte12mo ago
Is it because the session has lost the message because of the redirect?
leoblanski
leoblanskiOP11mo ago
Yes @DrByte i think so.
Want results from more Discord servers?
Add your server