Wednesday, August 31, 2011

Re: Using Auth WIth Another Table instead of Users

I know you dont want to hear this, but ...

I would really reccomend going back to using a user table. That's
where you store the username, passwoprd, email, user_group_id,
visit_count, last_visit_id etc. (i.e. the fields that define a User
object)

I would then create a hasOne <-> belongsTo relationship to your
Artiste model where you store all the other fields you need to define
an Artiste object

Et Voila!

HTH, Paul.

On Aug 31, 2:42 am, tubiz <tayi...@gmail.com> wrote:
> I am not using the User table for authentication instead I am using an
> artiste table but the problem is that I havent been able to lgoin
> using the username and password I registered with. I have already
> hashed the password using  Security::hash($this->data['Artiste']
> ['password'], null, true). Would like to know how to hash the password
> a user is using to login before checking if his details is right.
>
> Would also like ot know how to use auth with another table.
> I have already added this to the beforeFilter but I still cant login,
>
>         $this->Auth->authorize = 'controller';
>         $this->Auth->userModel = 'Artiste';
>         $this->Auth->fields = array('username' => 'email','password'
> => 'password');
>         $this->Auth->loginAction = array('admin' => false,
> 'controller' => 'artistes', 'action' => 'login');
>         $this->Auth->allow('login','add','view');
>         $this->Auth->loginRedirect = array('controller' => 'artistes',
> 'action' => 'home');

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