12 public function rules()
15 array(
'service',
'required'),
16 array(
'rememberMe',
'boolean'),
17 array(
'authField, password',
'length',
'max' => 255)
21 public function attributeLabels()
25 'authField' =>
UserModule::t(ucfirst(Yii::app()->getModule(
'user')->authField)),
30 public function applyErrors($userIdentity)
32 if (!$userIdentity->errorCode)
return;
34 switch ($userIdentity->errorCode) {
35 case UserIdentity::ERROR_AUTH_FIELD_INVALID:
36 $this->addError(
'authField', ucfirst(Yii::app()->getModule(
'user')->authField) .
' invalid');
38 case UserIdentity::ERROR_PASSWORD_INVALID:
39 $this->addError(
'password',
UserModule::t(
'Password invalid'));
41 case UserIdentity::ERROR_STATUS_NOTACTIV:
42 $this->addError(
"status",
UserModule::t(
"Your account is not activated."));
44 case UserIdentity::ERROR_STATUS_BAN:
45 $this->addError(
"status",
UserModule::t(
"Your account is blocked."));
55 public function getAjaxErrors()
58 foreach ($this->getErrors() as $attribute => $errors)
59 $result[CHtml::activeId($this, $attribute)] = $errors;
61 return CJSON::encode($result);