I am trying to implement a way by which I can check the value of an is_active
column from user
database before letting the user log in. So along with the password check, I also want to check if is_active column is True
, only then the user must be able to login, otherwise I want restrict login and show an error that "The user is inactive"(even if the password is correct).
I went through the Gramex documentation but could not find a way to configure this requirement.
Is there any way to implement this in DBAuth?
If you want to validate if the
is_active
column in the database is true, and to prevent login before the fact, useprepare:
. For example:... where
mymodule.py
has:More flexible solution. Create a subclass of
DBAuth
calledValidatedDBAuth
:Now use this instead of your
DBAuth
. For example: