20 public $personalisation;
26 const ERROR_AUTH_FIELD_INVALID = 3;
27 const ERROR_STATUS_NOTACTIV = 4;
28 const ERROR_STATUS_BAN = 5;
41 if (Yii::app()->getModule(
'user')->authField ==
'email') {
42 $user =
User::model()->with(
'profile')->notsafe()->findByAttributes(array(
'email' => $this->username));
44 $user =
User::model()->with(
'profile')->notsafe()->findByAttributes(array(
'username' => $this->username));
48 $this->errorCode = self::ERROR_AUTH_FIELD_INVALID;
49 else if (Yii::app()->getModule(
'user')->encrypting($this->password) !== $user->password)
50 $this->errorCode = self::ERROR_PASSWORD_INVALID;
51 else if ($user->status == 0 && Yii::app()->getModule(
'user')->loginNotActiv ==
false)
52 $this->errorCode = self::ERROR_STATUS_NOTACTIV;
53 else if ($user->status == -1)
54 $this->errorCode = self::ERROR_STATUS_BAN;
56 $this->_id = $user->id;
57 $this->email = $user->email;
58 $this->username = !empty($user->username) ? $user->username : $user->email;
59 $this->errorCode = self::ERROR_NONE;
60 Yii::app()->getModule(
'personalisation');
61 $this->setPersistentStates(array(
62 'email' => $this->email,
63 'firstname' => $user->profile->firstname,
64 'lastname' => $user->profile->lastname,
65 'gender' => $user->profile->gender,
70 return !$this->errorCode;