I resolved this problem yesterday, you are right though. Posted
solution in CakeQ's:
http://cakeqs.org/eng/questions/view/change_hash_function_problem_in_1_3

On Jun 9, 3:48 am, John Andersen <[email protected]> wrote:
> CakePHP is using the AppModel, because your User model is named
> incorrect!
>
> Name it User, not UserModel!
> Enjoy,
>    John
>
> On Jun 8, 9:04 pm, Matthew <[email protected]> wrote:
>
> > I followed the Simple ACL Tutorial but have a database of plain md5
> > passwords.
>
> > This line is storing an object of type of AppModel instead of Users.
> > $this->Auth->authenticate = ClassRegistry::init('Users');
>
> > The problem is when auth.php calls this (hashPasswords function):
> > method_exists($this->authenticate, 'hashPasswords')
>
> > It returns false.
>
> > How can I get Auth to see my custom hashPasswords function?
>
> > Here is my Users model:
> > lass UsersModel extends AppModel
> > {
> >     var $actsAs = array('Acl' => array('type' => 'requester'));
>
> >     function parentNode( ) {
>
> >         if (!$this->id) {
> >             return null;
> >         }
>
> >         $data = $this->read();
>
> >         if (!$data['Users']['group_id']){
> >             return null;
> >         } else {
> >             return array('model' => 'Groups', 'foreign_key' =>
> > $data['Users']['group_id']);
> >         }
> >     }
>
> >     function hashPasswords($data) {
> >         if (isset($data['Users']['password'])) {
> >             $data['Users']['password'] = md5($data['Users']
> > ['password']);
> >             return $data;
> >         }
> >         return $data;
> >     }
>
> > }
>
> > And here is my AppController controller:
> > class AppController extends Controller {
>
> >     var $components = array('Acl','Auth','Session');
> >     var $helpers = array('Session', 'Form');
>
> >     var $allowed = array ('pages' => '*');
>
> >     function beforeFilter(){
>
> >         $this->Auth->authenticate = ClassRegistry::init('Users');
> >         debug($this->Auth->authenticate);
>
> >         //Security::setHash('md5'); //Passwords are stored as md5
>
> >         $this->Auth->userModel = 'Users'; // User model is called
> > "Users"
>
> >         $this->Auth->fields = array('username' => 'email', 'password'
> > => 'password'); //Field is called email instead of username in db
>
> >         //$this->Auth->autoRedirect = false;
>
> >         $this->Auth->actionPath = "controllers/";
>
> >         $this->Auth->authorize = 'actions';
> >         //$this->Auth->authorize = 'controller';
>
> >         $this->Auth->loginAction = array('controller' => 'users',
> > 'action' => 'login');
> >         $this->Auth->logoutRedirect = array('controller' => 'users',
> > 'action' => 'login');
> >         $this->Auth->loginRedirect = array('controller' => 'news',
> > 'action' => 'index');
> >         //$this->Auth->allow('display');
>
> >     }
>
> >     //function isAuthorized() {
> >     //  return true;
> >     //}
>
> > }

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