Authenticate With (Usergroups Module)

Hi everyone! :D

I want to use a full scale user management system, so I choose the UserGroups module to do so.

Now everything is working fine.

I can login like usual, but when I’m logged in, I want in some sensitive area for the user to re-enter his password to protect key data.

Now usually in "modules/userGroups/controllers/UserController.php"


public function actionLogin()


		$model=new UserGroupsUser('login');

		// collect user input data




			// validate user input and redirect to the previous page if valid

			if($model->validate() && $model->login()) {





where it uses its own "modules/userGroups/components/UserGroupsIdentity.php"


	public function authenticate()


		$model=UserGroupsUser::model()->findByAttributes(array('username' => $this->username));



		else if((int)$model->status === UserGroupsUser::WAITING_ACTIVATION)


		else if($model->password!==md5($this->password . $model->getSalt()))



Everything works well [color="#FF0000"]ONLY FROM THE MODULE CONTROLLER!!![/color]

When I’m inside my application, when I use my code:


if (isset($_POST['formVal']['password']))


                        $UG_identity = new UserIdentity( Yii::app()->user->name, $_POST['formVal']['password'].$modelUG->getSalt());         


                        if ($UG_identity->authenticate())



I get the exception:

[color="#FF0000"]Trying to get property of non-object[/color]


-Line(542) [color="#FF0000"] if (Yii::app()->controller->module->salt)[/color]


public function getSalt()


		// TODO when stop supporting php 5.2 use dateTime

		// turn the creation_date into the corresponding timestamp

		list($date, $time) = explode(' ', $this->creation_date);

		$date = explode('-', $date);

		$time = explode(':', $time);


                $timestamp = mktime($time[0], $time[1], $time[2], $date[1], $date[2], $date[0]);

		// create the salt

		$salt = $this->username . $timestamp;


		// add the additional salt if it's provided

		if (Yii::app()->controller->module->salt)

			$salt .= Yii::app()->controller->module->salt;

		return $salt;


Now I have the feeling it’s not working because i’m inside my siteController reaching for the property inside a module, but this line: [color="#0000FF"]Yii::app()->controller->module->salt[/color] ask for

Yii::app()->siteController->userGroups->salt which of course don’t exist.

[color="#0000FF"]Now how in the world can I use the function from one module from another controller?? [/color]:huh:

Thank you for your time :lol:

Up! :D

Up! Up! ;)