Commit 62afdf3f by Colin Viebrock

Allow password field to be configured.

Signed-off-by: Colin Viebrock <colin@viebrock.ca>
parent 8edd8fcb
...@@ -33,6 +33,19 @@ return array( ...@@ -33,6 +33,19 @@ return array(
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Authentication Password
|--------------------------------------------------------------------------
|
| Here you may specify the database column that should be considered the
| "password" for your users. Typically, this will be "password" but, again
| you're free to change the value to anything.
|
*/
'password' => 'password',
/*
|--------------------------------------------------------------------------
| Authentication Model | Authentication Model
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
......
...@@ -15,7 +15,7 @@ class Eloquent extends Driver { ...@@ -15,7 +15,7 @@ class Eloquent extends Driver {
if (filter_var($id, FILTER_VALIDATE_INT) !== false) if (filter_var($id, FILTER_VALIDATE_INT) !== false)
{ {
return $this->model()->find($id); return $this->model()->find($id);
} }
} }
/** /**
...@@ -35,7 +35,9 @@ class Eloquent extends Driver { ...@@ -35,7 +35,9 @@ class Eloquent extends Driver {
// log the user into the application and remember them if asked. // log the user into the application and remember them if asked.
$password = $arguments['password']; $password = $arguments['password'];
if ( ! is_null($user) and Hash::check($password, $user->password)) $password_field = Config::get('auth.password');
if ( ! is_null($user) and Hash::check($password, $user->get_attribute($password_field)))
{ {
return $this->login($user->id, array_get($arguments, 'remember')); return $this->login($user->id, array_get($arguments, 'remember'));
} }
......
...@@ -19,7 +19,7 @@ class Fluent extends Driver { ...@@ -19,7 +19,7 @@ class Fluent extends Driver {
if (filter_var($id, FILTER_VALIDATE_INT) !== false) if (filter_var($id, FILTER_VALIDATE_INT) !== false)
{ {
return DB::table(Config::get('auth.table'))->find($id); return DB::table(Config::get('auth.table'))->find($id);
} }
} }
/** /**
...@@ -33,11 +33,13 @@ class Fluent extends Driver { ...@@ -33,11 +33,13 @@ class Fluent extends Driver {
$user = $this->get_user($arguments['username']); $user = $this->get_user($arguments['username']);
// This driver uses a basic username and password authentication scheme // This driver uses a basic username and password authentication scheme
// so if the credentials mmatch what is in the database we will just // so if the credentials match what is in the database we will just
// log the user into the application and remember them if asked. // log the user into the application and remember them if asked.
$password = $arguments['password']; $password = $arguments['password'];
if ( ! is_null($user) and Hash::check($password, $user->password)) $password_field = Config::get('auth.password');
if ( ! is_null($user) and Hash::check($password, $user->get_attribute($password_field)))
{ {
return $this->login($user->id, array_get($arguments, 'remember')); return $this->login($user->id, array_get($arguments, 'remember'));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment