php - CakePHP authentication tutorial doesn't work -


i'm new cakephp, , i'm using version 2.8.5. have followed tutorial adding authentication website here: http://book.cakephp.org/2.0/en/tutorials-and-examples/blog-auth-example/auth.html, having problems trying login.

i can add new users, whenever try login returns false , get:

invalid username or password, try again.

i get:

warning (512): invalid salt: pass01 blowfish please visit http://www.php.net/crypt , read appropriate section building blowfish salts. [core/cake/utility/security.php, line 323]

(pass01 password). have followed instructions of tutorial regards blowfish hashing, passwords in database don't appear hashed (they appear are).

user.php

app::uses('appmodel', 'model'); app::uses('blowfishpasswordhasher', 'controller/component/auth');  class user extends appmodel {     public $validate = array(         'username' => array(             'required' => array(                 'rule' => 'notblank',                 'message' => 'a username required'             )         ),         'password' => array(             'required' => array(                 'rule' => 'notblank',                 'message' => 'a password required'             )         ),         'role' => array(             'valid' => array(                 'rule' => array('inlist', array('admin', 'author')),                 'message' => 'please enter valid role',                 'allowempty' => false             )         )     );      public function beforesave($options = array()) {         if (isset($this->data[$this->alias]['password'])) {             $passwordhasher = new blowfishpasswordhasher();             $this->data[$this->alias]['password'] = $passwordhasher->hash(                 $this->data[$this->alias]['password']             );         }         return true;     } } 

the login function userscontroller.php

public function login() {     if ($this->request->is('post')) {         if ($this->auth->login()) {             return $this->redirect($this->auth->redirecturl());             }         $this->flash->error(__('invalid username or password, try again'));     } } 

login.ctp

<div class="users form"> <?php echo $this->flash->render('auth'); ?> <?php echo $this->form->create('user'); ?>     <fieldset>         <legend>             <?php echo __('please enter username , password'); ?>         </legend>         <?php echo $this->form->input('username');         echo $this->form->input('password');     ?>     </fieldset> <?php echo $this->form->end(__('login')); ?> </div> 

i have looked around similar questions, none of solutions seem have worked me. appreciate this.


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -