Monday, August 29, 2011

Re: successful - login interceptor

There is a working example of exactly what you are trying to do in the book: http://book.cakephp.org/view/1274/autoRedirect

Jeremy Burns
Class Outfit

http://www.classoutfit.com

On 30 Aug 2011, at 04:34, Zaky Katalan-Ezra wrote:

Take a look at cakedc users plugin

On Mon, Aug 29, 2011 at 11:46 PM, rethab <rethab.ch@gmail.com> wrote:
Hi there

I currently have a Users controller, which contains a login method.
This method is in turn invoked every time the login form gets
displayed to the user. In the app_controller, I setup the Auth like
the following:

$this->Auth->logoutRedirect = array('controller' => 'users', 'action'
=> 'login');
$this->Auth->actionPath = 'controllers/';
$this->Auth->authorize = 'actions';
$this->Auth->autoRedirect = true;
$this->Auth->loginRedirect = array('controller' => 'users', 'action'
=> 'home');

Now, I tried to implement something like a 'last-logged-in' thing
(store a timestamp in the DB). But, I found no way to intercept when a
user successfully logs in. I tried the login method, but this one get
invoked every time. Whether the user sends a wrong form or an empty
one - the login method gets invoked and I cannot find out whether that
was a successful one.

Is there anything like a callback or some other method I can override/
register in order to get to know when a successful login happened?

Thanks for your help!

- Rethab

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php



--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: