You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The problem is that when the authenticate function is evaluated, it returns a user object if there is an active user in our database.
It means that if we have a user that is in the database but is NOT active, the authenticate function returns "None". As a result, checking if user.is_active after if user is not None is redundant because the authenticate function has already verified the user's active status.
Therefore, the user_login function can be simplified as follows:
There is an issue with this code below:
The problem is that when the authenticate function is evaluated, it returns a user object if there is an active user in our database.
It means that if we have a user that is in the database but is NOT active, the authenticate function returns "None". As a result, checking if user.is_active after if user is not None is redundant because the authenticate function has already verified the user's active status.
Therefore, the user_login function can be simplified as follows:
The text was updated successfully, but these errors were encountered: