Customer business logic into Login in Filament 3

Hi guis, i hope you'all are great. I am new in filament and i dont find information about how to custom login logic. u created the basic or standard login. and in users table i just added a column called "user_status_id" and i only want to user who has 1 value in this column can login in. but if there's 2 or 3 will denie the login and in the login say a personal message, like "account suspended" just in the same way when we write the password wrong. somneone can please send me a guide to do this? Tahnk you!
5 Replies
Tuim
Tuim2mo ago
You can create a custom Login::class that extends the default Login::class from Filament itself Check that original class for methods to overwrite
Mohamed Ayaou
Mohamed Ayaou2mo ago
Just create a custom Login class and put it inside the ->login()
Mohamed Ayaou
Mohamed Ayaou2mo ago
This is a resource: https://filamentexamples.com/tutorial/register-wizard-steps?source=search it is about registration but the same concept with login
Filament Examples
Registration with Wizard Steps
If you have a longer registration form, you may want to split it into steps, with wizard, including different validation rules.
Mohamed Ayaou
Mohamed Ayaou2mo ago
just override the default class stuff
Povilas K
Povilas K2mo ago
Probably irrelevant for the author at this point but will post it for others to reference in the future, we published it as a free tutorial: https://filamentexamples.com/tutorial/login-extra-validation
Filament Examples
Filament Login Extra Validation: Check if User is Suspended
Sometimes, default validation cannot inform the user about a form issue. But with Filament, we can add more validation messages if needed.

Did you find this page helpful?