Saturday, December 15, 2012

Re: authentication and authorization is not working

add something like this into your User model:

public function beforeSave() {
   if (isset($this->data[$this->alias]['before_password'])) {
     $this->data[$this->alias]['password'] = AuthComponent::password($this->data[$this->alias]['before_password']);
   }
return true;
}

accordingly you need to set into your view:

<?php echo $this->Form->input('User.username'); ?>
<?php echo $this->Form->input('User.before_password', array('type' => password)); ?>

try that.
cheers




On Sat, Dec 15, 2012 at 1:17 PM, polutan <linspirell@gmail.com> wrote:
repeat and repeat again your effort.. try and error..


2012/12/13 ashy <ashcsi1322@gmail.com>
Hello All,

I am following the tutorial below
http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#identifying-users-and-logging-them-in

The password is not getting hashed by user add method. Thats the reason, authentication is not getting completed. Any ideas?

thanks
    ashy

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 



--
Coklat Stroberi -- Web Dev Training Centre
Jl. Raya Padang Luwih (Dalung) No.141 - Telp. (0361) 9006118 atau 08174128301 - Badung, Bali. Sebelah timur traffic light pertigaan perumahan dalung permai.


--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 



--
Ivan Rimac
tel: +385 95 555 99 66

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

No comments: