Put the function in beforeFilter of app_controller.
On Jan 16, 11:49 pm, cmbg <[EMAIL PROTECTED]> wrote:
> Hi all!
>
> I have the Auth component on every controller in my app, so it makes
> sure that the user is logged in before performing any actions. What I
> want is if the validated user also has flag that requires them to
> change their password, they can't go to any other controller or
> perform any actions until they successfully change their password.
>
> The only thing I can think of is adding the following lines of code to
> every controller's "beforeFilter".
>
> function beforeFilter()
> {
> ...
> $user = $this->Auth->user();
> if ($user['User']['force_password_change'] == 'Y')
> {
> $this->redirect(array('controller'=>'users',
> 'action'=>'edit'));
> }
> ...
>
> }
>
> BUT what if I have tons of controllers? I don't want to copy and
> paste this code in every one of them... heh. I don't think that's
> very good coding...
>
> Thanks for any advice!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---