diff --git a/config/multiauth.php b/config/multiauth.php index 8bc27fa..37ef65f 100644 --- a/config/multiauth.php +++ b/config/multiauth.php @@ -75,4 +75,17 @@ 'role' => Bitfumes\Multiauth\Model\Role::class, 'permission' => Bitfumes\Multiauth\Model\Permission::class, ], + + /* + |-------------------------------------------------------------------------- + | Admin Credentials + |-------------------------------------------------------------------------- + | + | When attempting a login the following additional credentials are + | provided to the authenticator to check in the admins table. + | + */ + 'credentials' => [ + 'active' => 1, + ], ]; diff --git a/docs/settings.md b/docs/settings.md index 8210a28..34c0e8a 100644 --- a/docs/settings.md +++ b/docs/settings.md @@ -132,6 +132,30 @@ You can set your own model and define here to use by package. 'role' => Bitfumes\Multiauth\Model\Role::class, 'permission' => Bitfumes\Multiauth\Model\Permission::class, ], + +... +``` + +## Credentials + +You can set your own credentials to be passed to the authenticator with the username and password. + +By default we check that the `active` column of the `admins` table is true. + +```php{11,12,13} +... + /* + |-------------------------------------------------------------------------- + | Admin Credentials + |-------------------------------------------------------------------------- + | + | When attempting a login the following additional credentials are + | provided to the authenticator to check in the admins table. + | + */ + 'credentials' => [ + 'active' => 1, + ], ]; diff --git a/src/Http/Controllers/LoginController.php b/src/Http/Controllers/LoginController.php index 0c94c97..5b27141 100755 --- a/src/Http/Controllers/LoginController.php +++ b/src/Http/Controllers/LoginController.php @@ -61,9 +61,16 @@ public function showLoginForm() */ protected function credentials(Request $request) { - $request['active'] = 1; + $extraCredentials = config('multiauth.credentials', [ + 'active' => 1, + ]); + + $request->merge($extraCredentials); - return $request->only($this->username(), 'password', 'active'); + return $request->only(array_merge( + [$this->username(), 'password'], + array_keys($extraCredentials), + )); } /**