On Jan 14, 2008 9:18 PM, martinp <[EMAIL PROTECTED]> wrote:
>
> Hello
>
> I appreciate there's a lot of discussion and a few tutorials on Auth
> in 1.2, but for some reason I can't get it to work at all - even at a
> basic level. I'm probably doing something noobtastically wrong, so I
> apologise in advance for my stupidity if so, but I wonder if someone
> wouldn't mind giving me some pointers on this.

Hey Martin, I've put some of my comments inline here, hopefully they can help.

> I've set up my login page, my users controller and app_controller, but
> when I attempt to login, nothing happens. Nothing. No error message,
> no redirection, no cakephp error, just nothing.

Do you keep getting redirected to the login form?  This kept happening
to me...until I updated my app/core/config.php file to the newest
version.  I was running quite a few revisions behind and once I
updated stuff, it went just fine.

> Here's my login.ctp:
>         echo $form->create('User', array('controller' => 'users', 'action' =>
> 'login'))."\n";
>         echo $form->input('email')."\n";
>         echo $form->input('password')."\n";
>         echo $form->checkbox('remember_me')."\n";
>         echo $form->label('remember_me', 'Stay logged in?')."\n";
>         echo $form->end('Login')."\n";

Login form looks okay to me.

> My app_controller.php:
>         var $helpers = array('Html','Javascript','Form');
>         var $components = array('Acl','Auth','Cookie','Security');
>         var $publicControllers = array('pages');
>
>         function beforeFilter() {
>                 if (isset($this->Auth)) {
>                         $this->Auth->fields = array('username' => 'email', 
> 'password' =>
> 'password');
>                         $this->Auth->loginAction = array('controller' => 
> 'users', 'action'
> => 'login');
>                         $this->Auth->loginRedirect = array('controller' => 
> 'users',
> 'action' => 'index');
>                         $this->Auth->logoutRedirect = '/';
>                         $this->Auth->userModel = 'User';
>                         $this->Auth->userScope = array('User.status' => 
> 'Activated');
>                         $this->Auth->loginError = 'Invalid email / password 
> combination.
> Please try again';

I've never used isset($this->Auth) before, and that might be causing
part of the problem.  Is there an example out there that uses this, as
I've never seen that.  Not saying that it's wrong, just that I haven't
seen it before.

Otherwise, things look okay to me here.  One thing that sticks out is
to make sure that the status field for your model is, in fact, set to
'Activated'.  Silly, I know, but worth looking at.

>                         if (in_array(low($this->params['controller']), $this-
> >publicControllers)) {
>                                 $this->Auth->allow();
>                         }

Hrm, that's a neat little construct.  Haven't seen that before either.
 Again, I'd love to see the link to that example.

>                 }
>         }
>
> I know I've got to implement ACL, but surely I should be getting error
> messages for incorrect passwords even now? Grateful for anyone's
> input!

I'd suggest that you remove ACL from the equation for now and make
sure that you can get Auth working first.  Remember the motto:  make
it work, then make it work better.

-- 
Chris Hartjes
Internet Loudmouth
Motto for 2008: "Moving from herding elephants to handling snakes..."
@TheKeyBoard: http://www.littlehart.net/atthekeyboard

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to