Thursday, October 30, 2008

Re: Login Redirect not Redirecting

Try:
e($form->create('User',array('action'=>'login')));

Possibly also:
e($form->input('User.username'));
e($form->input('User.password',array('type'=>'password')));

in case the first does not do the trick. I usually define Model.field
even when it is not necessary.

/Martin


On Oct 30, 2:03 am, thatsgreat2345 <thatsgreat2...@gmail.com> wrote:
> I am having trouble with the redirect, I have manually inserted the
> username/password values, I have hashed the password with the correct
> security salt. However when I go to users/login and type in the
> username and password it does not redirect me to what I have specified
> in $loginRedirect it just sends me to users/login. However nothing has
> changed, there is no error message displayed, the password field
> hasn't been hashed as it usually hashes and if there is an error it
> shows the hashed password in the password input but it is just the non-
> hashed password. Any insight would be great.
>
> Controller
> <?
>   class UsersController extends AppController {
>   var $name = 'Users';
>   var $components = array('Auth');
>
>   function beforeFilter() {
>      // $this->Auth->authorize = 'controller';
>       //$this->Auth->loginAction = array('controller' => 'users',
> 'action' => 'login');
>           $this->Auth->loginRedirect = array('controller' => 'users',
> 'action' => 'index');
>           $this->Auth->loginError = 'Username or password is incorrect';
>           $this->Auth->logoutRedirect = '/';
>           $this->Auth->authError = 'You are not allowed to access this.';
>   }
>
>   function index() {
>
>   }
>
>   function login() {
>
>   }
>
>   function logout() {
>           $this->redirect($this->Auth->logout());
>   }
>
> }
>
> ?>
>
> Model
>
> <?
>   class User extends AppModel {
>                 var $name = 'User';
>
>   }
> ?>
>
> View
>
> <?
>   if ($session->check('Message.auth')) $session->flash('auth');
>   e($form->create('Users',array('action'=>'login')));
>   e($form->input('username'));
>   e($form->input('password',array('type'=>'password')));
>   e($form->end('Login'));
>
> ?>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: