cakephp 3.0 - Cakephp3.0 Authentication issue -


problem facing can authenticate using blog tutorial when doing same thing patients table , want login through url/patients/login everytime authenticate said incorrect username , password , in adding user how can add hash password .

or can suggest me code in users login access can redirect user based on role admin , author how can check if user admin redirect admin dashboard , if author possible if yes please give login function code

i searching on net how add multi level user authentication system find solution using blog example full code , in login system added code :

 public function login()  if ($this->request->is('post')) {     $user = $this->auth->identify();     if ($user['role'] === 'admin') {         $this->auth->setuser($user);         return $this->redirect(['controller' => 'articles']);     }      else if ($user['role'] === 'author'){          $this->auth->setuser($user);         return $this->redirect(['action' => 'login' ,'controller' => 'users']);     }     $this->flash->error(__('invalid username or password, try again')); } } 

this simple solution have added few lines of code


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -