I am trying to follow Solution given here.
getAuthPassword()
returns the correct hash value yet I am not being authenticated. Code snippet given below:
In Controller:
public function doLogin()
{
// View::composer('layouts.master', function($view)
// {
//
// $view->with('login_status');
// });
$rules = array(
'username' => 'required',
'password' => 'required'
);
// run the validation rules on the inputs from the form
$validator = Validator::make(Input::all(), $rules);
if ($validator->fails())
{
return Redirect::to('login')
->withErrors($validator)
->withInput(Input::except('password'));
}
else
{
$credentials['username'] = trim(Input::get('username'));
$credentials['password'] = trim(Input::get('password'));
//if (Auth::attempt(array($credentials), true))
if (Auth::attempt($credentials))
{
echo 'Success';
}
else
{
print 'faled';
dd(DB::getQueryLog());
exit;
return Redirect::to('login');
}
}
User Model
class User extends Eloquent implements UserInterface, RemindableInterface {
use UserTrait, RemindableTrait;
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'users';
/**
* The attributes excluded from the model's JSON form.
*
* @var array
*/
protected $hidden = array('password', 'remember_token');
public function getAuthPassword()
{
return $this->password;
}
}
Data in Db
if it is running correct password the why is it getting failed?