mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-07-30 04:23:11 +03:00
Set more appropriate login validation and broken up LDAP guide a bit
This commit is contained in:
@ -119,6 +119,43 @@ class LoginController extends Controller
|
||||
return $this->sendFailedLoginResponse($request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate the user login request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return void
|
||||
*
|
||||
* @throws \Illuminate\Validation\ValidationException
|
||||
*/
|
||||
protected function validateLogin(Request $request)
|
||||
{
|
||||
$rules = [];
|
||||
$authMethod = config('auth.method');
|
||||
|
||||
if ($authMethod === 'standard') {
|
||||
$rules = [
|
||||
'email' => 'required|string|email',
|
||||
'password' => 'required|string'
|
||||
];
|
||||
}
|
||||
|
||||
if ($authMethod === 'ldap') {
|
||||
$rules = [
|
||||
'username' => 'required|string',
|
||||
'password' => 'required|string',
|
||||
'email' => 'email',
|
||||
];
|
||||
}
|
||||
|
||||
if ($authMethod === 'saml2') {
|
||||
$rules = [
|
||||
'email' => 'email',
|
||||
];
|
||||
}
|
||||
|
||||
$request->validate($rules);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a response when a login attempt exception occurs.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user