Add this to the top:
App::uses('Security', 'Utility');
On Jan 10, 6:25 pm, jmail <[email protected]> wrote:
> Hi all!
>
> I am preparing some login action in my app. I have made view
>
> <%=$this->Form->create('User', array('action' =>
> 'login','inputDefaults' => array('label' => false,'div' => false)));%>
> <%=$this->Form->input('mail', array('type' => 'text', 'label'
> =>
> 'Email:<br>'));%><br>
> <%=$this->Form->input('pass', array('type' => 'password',
> 'label' =>
> 'Pass:<br>'));%><br><br>
> <%=$this->Form->end(array('value' => 'Login', 'label' =>
> 'Login',
> 'class' => 'searchsubmit', 'div' => array('class' => 'floatRight')));
> %>
>
> I have build function in UsersController
>
> class UsersController extends AppController{
>
> public function login(){
> if ($this->request->is('post')) {
> $user =
> $this->User->findByMailAndPass($this->request->data["User"]["mail"],
> Security::hash($this->request->data["User"]
>
> ["pass"], null, true));
> if ($user === false) {
> $this->Session->setFlash('Nieprawidłowe dane
> logowania.');
> $this->request->data["User"]["mail"] = '';
> $this->request->data["User"]["pass"] = '';
> } else {
> CakeSession::write('user.id', $user["User"]["id"]);
> CakeSession::write('user.mail', $user["User"]
> ["mail"]);
> $this->redirect(array('controller' => 'users',
> 'action' => 'profile'));
> }
> }
> }
>
> public function logout(){
> CakeSession::delete("user");
> $this->redirect('/');
> }
>
> }
>
> So. When I go to the HOST/users/login everything is ok, but when I try
> to submit login form I get an error
>
> Fatal error: Class 'Security' not found in
>
> and of course I've got
>
> var $helpers = array('Form', 'Html', 'Session', 'Cycle');
>
> in AppController
>
> Can anyone please help me what should I do?
>
> Please do not tell me to change my login to the Cake model - I need
> that this way done.
>
> For end I will add info tha the same action is working good for admin
> login :(
>
> thank's for tips
>
> regards
>
> jmail
--
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
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php