Friday, March 5, 2010

Re: Models and Auth related problem

Thanks Pablo,

Have you defined in your controller, that you are using the Auth
component?
[code]
var $components = array('Auth');
[/code]
That you must do, either in your UsersController or in the
AppController!
Enjoy,
John

On Mar 5, 4:30 pm, Pablo Terradillos <teh...@gmail.com> wrote:
> oh,i'm really sorry,
>
> Here's my login form:
>
> <?php
>     $session->flash('auth');
>     echo $form->create('User', array('action' => 'login'));
>     echo $form->input('username');
>     echo $form->input('password');
>     echo $form->end('Login');
>
> ?>
>
> i don't have Auth settings in beforeFilter since i'm using a table
> with nothing but username  and password fields.
> My loging action is just this (i'm just trying to get it work,
> acording to cookbook this is enought):
>
>    function login() {
>            }
>
> Pablo E. Terradillos
>
> On Thu, Mar 4, 2010 at 2:23 PM, John Andersen <j.andersen...@gmail.com> wrote:
> > Good that you are looking into the issue using the CakePHP book!
> > Now, so that we better may be able to help you, please show the code
> > for the login form, the code for your Auth settings in the
> > beforeFilter method, and the login method itself.
>
> > Enjoy,
> >   John
>
> > On Mar 4, 2:22 pm, Pablo Terradillos <teh...@gmail.com> wrote:
> >> Hi all, i'm a really noob with cakephp and i'm having some problems
> >> that are supposed to be by cake by default but for some kind of
> >> mistery (or stupidity) i can't get it. i'm using cake 1.3.
>
> >> The problem is with an user registration form and the login using the
> >> auth component.
>
> >> I have two tables, "clients" with a user_id field (and some other
> >> stuff) and "users" (with id, username and password fields)
>
> >> My models:
>
> >>   class User extends AppModel {
> >>           var $name = 'User';
> >>           var $hasOne = 'Client';
>
> >>         }
>
> >>     class Client extends appModel {
> >>         var $name = 'Client';
> >>         var $belongsTo = 'User';
> >>     }
>
> >> According to cookbook: "When posting information to an action via a
> >> form, the Auth component automatically hashes the contents of your
> >> password input field if you also have data in the username field"
> >> (http://book.cakephp.org/view/1253/Troubleshooting-Auth-Problems)
>
> >> Well, i have a registration form, with fields for username and
> >> password (and the data that is stored into "clients") but it doesn't
> >> hash anything :(
> >> Also, i tryied to hash it "manually" using
> >> $this->data['User']['password'] =
> >> Security::hash($this->data['User']['password']);
>
> >> But then, when i tryied to use the auth component (following this:http://book.cakephp.org/view/1250/Authentication)  and login...
> >> nothing happens... no errors, no warnings... nothing... i only get the
> >> login and password.
>
> >> I have an username with his password hashed with SHA1. I also tryied
> >> removing the security.salt stuff from core.php but the problem is
> >> still there...
>
> >> Hope you can help me,
>
> >> Thanks!
>
> >> Pablo E. Terradillos
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with their CakePHP related questions.
>
> > 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 athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

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: