Bonjour tout le monde,
I installed the extension yii-user-management on the framework, it almost works perfectly except that when I try to connect to an account or not activated with a wrong password I get an error for an invalid account I get this:
Undefined class constant 'ERROR_STATUS_NOTACTIV' in /var/www/yii/site/protected/modules/user/models/UserLogin.php on line 69
Here are the file in question :
[PHP]<?php
/**
-
LoginForm class.
-
LoginForm is the data structure for keeping
-
user login form data. It is used by the ‘login’ action of ‘UserController’.
*/
class UserLogin extends CFormModel
{
public $username;
public $password;
public $rememberMe;
/**
* Declares the validation rules.
* The rules state that username and password are required,
* and password needs to be authenticated.
*/
public function rules()
{
return array(
// username and password are required
array('username, password', 'required'),
// rememberMe needs to be a boolean
array('rememberMe', 'boolean'),
// password needs to be authenticated
array('password', 'authenticate'),
);
}
public function attributeLabels()
{
if(Yii::app()->controller->module->loginType == 0)
$username = Yii::t("UserModule.user", "Pseudonyme");
else if(Yii::app()->controller->module->loginType == 1)
$username = Yii::t("UserModule.user", "Adresse email");
else if(Yii::app()->controller->module->loginType == 2)
$username = Yii::t("UserModule.user", "Pseudonyme ou adresse email");
return array(
'username'=>$username,
'password'=>Yii::t("UserModule.user", "password"),
'rememberMe'=>Yii::t("UserModule.user", "Se souvenir de moi la prochaine fois"),
);
}
/**
* Authenticates the password.
* This is the 'authenticate' validator as declared in rules().
*/
public function authenticate($attribute,$params)
{
if(!$this->hasErrors()) // we only want to authenticate when no input errors
{
$identity=new UserIdentity($this->username,$this->password);
$identity->authenticate();
switch($identity->errorCode)
{
case UserIdentity::ERROR_NONE:
$duration=$this->rememberMe ? 3600*24*30 : 0; // 30 days
Yii::app()->user->login($identity,$duration);
break;
case UserIdentity::ERROR_EMAIL_INVALID:
$this->addError("username",Yii::t("UserModule.user", "Votre adresse email est invalide."));
break;
case UserIdentity::ERROR_USERNAME_INVALID:
$this->addError("username",Yii::t("UserModule.user", "Votre pseudo est invalide."));
break;
case UserIdentity::ERROR_STATUS_NOTACTIV:
$this->addError("status",Yii::t("UserModule.user", "Votre compte n'est pas activer."));
break;
case UserIdentity::ERROR_STATUS_BAN:
$this->addError("status",Yii::t("UserModule.user", "Votre compte est banni."));
break;
case UserIdentity::ERROR_PASSWORD_INVALID:
$this->addError("password",Yii::t("UserModule.user", "Mot de passe invalide."));
break;
}
}
}
}
[/PHP]
line 69 is that one:
case UserIdentity::ERROR_STATUS_NOTACTIV:
Did you know what the error came from?
PS: I even can’t change my password.
Best regards