23 array(
'username, password',
'required'),
25 array(
'rememberMe',
'boolean'),
27 array(
'password',
'authenticate'),
49 if (!$this->hasErrors()) {
52 $identity =
new UserIdentity($this->username, $this->password);
53 $identity->authenticate();
54 switch ($identity->errorCode) {
55 case UserIdentity::ERROR_NONE:
56 $duration = $this->rememberMe ? Yii::app()->controller->module->rememberMeTime : 0;
57 Yii::app()->user->login($identity, $duration);
60 $this->addError(
"username",
UserModule::t(
"Email is incorrect."));
62 case UserIdentity::ERROR_USERNAME_INVALID:
63 $this->addError(
"username",
UserModule::t(
"Username is incorrect."));
66 $this->addError(
"status",
UserModule::t(
"You account is not activated."));
69 $this->addError(
"status",
UserModule::t(
"You account is blocked."));
71 case UserIdentity::ERROR_PASSWORD_INVALID:
72 $this->addError(
"password",
UserModule::t(
"Password is incorrect."));