yii-user-management

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 &#036;username;


public &#036;password;


public &#036;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()-&gt;controller-&gt;module-&gt;loginType == 0)


	&#036;username = Yii::t(&quot;UserModule.user&quot;, &quot;Pseudonyme&quot;);


else if(Yii::app()-&gt;controller-&gt;module-&gt;loginType == 1)


	&#036;username = Yii::t(&quot;UserModule.user&quot;, &quot;Adresse email&quot;);


else if(Yii::app()-&gt;controller-&gt;module-&gt;loginType == 2)


	&#036;username = Yii::t(&quot;UserModule.user&quot;, &quot;Pseudonyme ou adresse email&quot;);





	return array(


		'username'=&gt;&#036;username,


		'password'=&gt;Yii::t(&quot;UserModule.user&quot;, &quot;password&quot;),


		'rememberMe'=&gt;Yii::t(&quot;UserModule.user&quot;, &quot;Se souvenir de moi la prochaine fois&quot;),


	);


}





/**


 * Authenticates the password.


 * This is the 'authenticate' validator as declared in rules().


 */


public function authenticate(&#036;attribute,&#036;params)


{


	if(&#33;&#036;this-&gt;hasErrors())  // we only want to authenticate when no input errors


	{


		&#036;identity=new UserIdentity(&#036;this-&gt;username,&#036;this-&gt;password);


		&#036;identity-&gt;authenticate();


		switch(&#036;identity-&gt;errorCode)


		{


			case UserIdentity::ERROR_NONE:


				&#036;duration=&#036;this-&gt;rememberMe ? 3600*24*30 : 0; // 30 days


				Yii::app()-&gt;user-&gt;login(&#036;identity,&#036;duration);


				break;


			case UserIdentity::ERROR_EMAIL_INVALID:


				&#036;this-&gt;addError(&quot;username&quot;,Yii::t(&quot;UserModule.user&quot;, &quot;Votre adresse email est invalide.&quot;));


				break;


			case UserIdentity::ERROR_USERNAME_INVALID:


				&#036;this-&gt;addError(&quot;username&quot;,Yii::t(&quot;UserModule.user&quot;, &quot;Votre pseudo est invalide.&quot;));


				break;


			case UserIdentity::ERROR_STATUS_NOTACTIV:


				&#036;this-&gt;addError(&quot;status&quot;,Yii::t(&quot;UserModule.user&quot;, &quot;Votre compte n'est pas activer.&quot;));


				break;


			case UserIdentity::ERROR_STATUS_BAN:


				&#036;this-&gt;addError(&quot;status&quot;,Yii::t(&quot;UserModule.user&quot;, &quot;Votre compte est banni.&quot;));


				break;


			case UserIdentity::ERROR_PASSWORD_INVALID:


				&#036;this-&gt;addError(&quot;password&quot;,Yii::t(&quot;UserModule.user&quot;, &quot;Mot de passe invalide.&quot;));


				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

I believe this was fixed on March 15th.

This module is still actively being worked on. Get the latest from this site or try

http://code.google.com/p/yii-user-management/

I downloaded the extension about 3 days ago,where should a take the updates?

Looks like you downloaded a copy posted on the 14th - a day before the fix you need.

Try the link I provided. You’ll have to download it from Google Code.

http://code.google.com/p/yii-user-management/

Note that this extension is actively being worked on and still transforming considerably.

I have installed this great extantion successfuly, but don’t understant, how can i get value of field in profile that i need from any place in my site??? like this:

Yii::app()->user->id

but i want

Yii::app()->user->email

Yii::app()->user->city

Yii::app()->user->gender etc … help me please

or may be some thing like

User::model()->profile($id)->email;

It would probably serve you better if you ask in this thread

http://www.yiiframework.com/forum/index.php?/topic/7591-module-yii-user-management-module/

I’d guess, you’d probably have to use

User::model()->findByPk($id)->profile->email;