Force Password Change

hi,

i want to force the user to change his password when i have a certain situation (an indication in db).

when i try to user a filter or afterAction (in the components/controller.php), i get a redirect loop.

any idea what should i do?

thanks.

I’m not quite sure why you are using afterAction instead of beforeAction but: Is it possible you are redirecting w/o checking if the redirect already took place?

Hi

Please post your code

As the @Da:Sourcerer said, it is better to do that in beforeAction…

For example overwrite the function


 

public function beforeAction($action) { 

 if(your db condition && Yii::app()->controller->id . '/' . $action->id != 'users/passwordchange') //Ignore for the password change action then only the user can access 

	 $this->redirect(array('users/passwordchange')); //Redirect to password change page 

 else

 	return true; 

 }

 

Obviously it will work Cheers!