Fix authenticating User

pull/2154/head
Isaac Connor 2018-07-10 13:19:51 -04:00
parent 930d929427
commit 21438d17ac
1 changed files with 2 additions and 11 deletions

View File

@ -35,16 +35,6 @@ class AppController extends Controller {
public $components = [
'Session', // We are going to use SessionHelper to check PHP session vars
'Auth' => [
'authenticate' => [
'Form' => [
'fields' => [
'username' => 'Username' ,
'password' => 'Password'
]
]
]
],
'RequestHandler',
'Crud.Crud' => [
'actions' => [
@ -92,12 +82,13 @@ class AppController extends Controller {
if ( isset($_REQUEST['user']) and isset($_REQUEST['pass']) ) {
$user = $this->User->find('first', array ('conditions' => array (
'User.Username' => $_REQUEST['user'],
'User.Password' => $_REQUEST['pass'],
'User.Password' => DboSource::expression('PASSWORD(\''.$_REQUEST['pass'].'\')'),
)) );
if ( ! $user ) {
throw new UnauthorizedException(__('User not found'));
return;
} else {
$this->Session->Write( 'user', $user['User'] );
$this->Session->Write( 'user.Username', $user['User']['Username'] );
$this->Session->Write( 'user.Enabled', $user['User']['Enabled'] );
}