In yii I can use:
self::ERROR_USERNAME_INVALID;
I want another one:
self::ERROR_USER_BANNED;
That must give the error:
Sorry, but you cannot login because you account has been blocked.
How do I set this up?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Add it directly to your protected/components/UserIdentity.php :
The default way with LoginForm.php model :
Add a new validator rule, say to your
usernamefield:Ofcourse you could have declared another function in UserIdentity to check just for banning, and call that function from the
isBannedvalidator, instead of having things in theauthenticatefunction.