On 15 sep, 17:30, cakephp_rocks <[email protected]> wrote:
> this is in my Userscontroller im using ad7six's mi-base
> function beforeFilter() {
>                 parent::beforeFilter();
>                 if (Configure::read()) {
>                         $this->Auth->allow('admin_init_acl');
>                 }
>                 $this->set('authFields', $this->Auth->fields);
>                 $this->Auth->allow('switch_language', 'register',
> 'forgotten_password', 'new_password', 'logout', 'back');
>                 if ($this->RequestHandler->isAjax()) {
>                         $this->Auth->autoRedirect = false;
>                 }
>                 $this->Auth->userScope = array('User.email_token' =>
> null);
>                 $this->Security->blackHoleCallback = '_blackHole';
>         }
>
> function login() {
>                 if (!$this->Auth->user() && Configure::read()) {
>                         $this->Session->setFlash('Debug only message: Save 
> some tedium -
> check remember me.');
>                 }
>                 if ($this->RequestHandler->isAjax()) {
>                         if (!$this->Auth->user()) {
>                                 $this->render('/elements/login');
>                         } else {
>                                 $this->render('/elements/context');
>                         }
>                 }
>         $this->set('allowRegistrations', $this->settings
> ['allowRegistrations']);
>         }
>
If you have $this->Auth->loginRedirect = '/'; in your app controller,
the use of MiBase isn't relevant - because your app controller doesn't
disable the auto redirect and you've explicitly stated it should send
a newly logged in user to /.

Probably worth mentioning: MiBase/Mi code use the controller function
_back() to redirect you where you came from (). - which if present
reads from the form field (added automatically) App.referer - This is /
not/ simply the http referer. Check what the value of this hidden form
field is in your login form you might be undoing what mibase is trying
to do for you.

This changeset is maybe relevant to you, it was added as a temporary
fix to ensure the auth referer was used:
http://trac.assembla.com/mi/changeset/1563/branches/mi_plugin/controllers/components/swiss_army.php
- note that it's not applied to the base branch though.

Also note that MiBase is in a state of change - with the objective of
becoming a load of focussed plugins (with almost no public facing
functionality) with acompanying bake templates - Instead of the
current generic-ish code. If you use 1.3 I invite you to try out the
leaner plugin based code
 cd anemptyapp
 svn co http://svn.assembla.com/svn/mi/branches/mi_plugin plugins/mi
 cake iq install mi_development
 cake bake controller users [etc]

you can (in principle) bake everything that mibase currently offers -
e.g. I start all projects with cake bake -skel [path to mi_development/
some client's skel folder] and go from there/follow the error
messages.

hth,

AD
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to