public function unauthorized()
    {
        $this->loadModel('User.Users');
        if ($this->request->is('post')) {
            $user = $this->Auth->identify();
            if ($user) {
                $this->Auth->setUser($user);

                return $this->redirect($this->Auth->redirectUrl());
            } else {
                $this->Flash->danger(__d('user', 'Username or password is incorrect'));
            }
        }
    }
public function unauthorized()
    {
        $this->loadModel('User.Users');
        if ($this->request->is('post')) {
            $user = $this->Auth->identify();
            if ($user) {
                $this->Auth->setUser($user);

                return $this->redirect($this->Auth->redirectUrl());
            } else {
                $this->Flash->danger(__d('user', 'Username or password is incorrect'));
            }
        }
    }
public function unauthorized ( ) { $ this -> loadModel ( 'User.Users' ) ; if ( $ this -> request -> is ( 'post' ) ) { $ user = $ this -> Auth -> identify ( ) ; if ( $ user ) { $ this -> Auth -> setUser ( $ user ) ; return $ this -> redirect ( $ this -> Auth -> redirectUrl ( ) ) ; } else { $ this -> Flash -> danger ( __d ( 'user' , 'Username or password is incorrect' ) ) ; } } }
Renders the "unauthorized" screen, when an user attempts to access
to a restricted area.

@return \Cake\Network\Response|null
Renders the unauthorized screen when an user attempts to access to a restricted area .