mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-05-22 23:59:42 +00:00
Added files missed in previous commit
This commit is contained in:
parent
3470a6a140
commit
e743cd3f60
21 changed files with 139 additions and 229 deletions
app/Http/Controllers/Auth
|
@ -65,7 +65,6 @@ class LoginController extends Controller
|
|||
{
|
||||
$socialDrivers = $this->socialAuthService->getActiveDrivers();
|
||||
$authMethod = config('auth.method');
|
||||
$samlEnabled = config('saml2.enabled') === true;
|
||||
|
||||
if ($request->has('email')) {
|
||||
session()->flashInput([
|
||||
|
@ -77,7 +76,6 @@ class LoginController extends Controller
|
|||
return view('auth.login', [
|
||||
'socialDrivers' => $socialDrivers,
|
||||
'authMethod' => $authMethod,
|
||||
'samlEnabled' => $samlEnabled,
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -129,28 +127,16 @@ class LoginController extends Controller
|
|||
*/
|
||||
protected function validateLogin(Request $request)
|
||||
{
|
||||
$rules = [];
|
||||
$rules = ['password' => 'required|string'];
|
||||
$authMethod = config('auth.method');
|
||||
|
||||
if ($authMethod === 'standard') {
|
||||
$rules = [
|
||||
'email' => 'required|string|email',
|
||||
'password' => 'required|string'
|
||||
];
|
||||
$rules['email'] = 'required|email';
|
||||
}
|
||||
|
||||
if ($authMethod === 'ldap') {
|
||||
$rules = [
|
||||
'username' => 'required|string',
|
||||
'password' => 'required|string',
|
||||
'email' => 'email',
|
||||
];
|
||||
}
|
||||
|
||||
if ($authMethod === 'saml2') {
|
||||
$rules = [
|
||||
'email' => 'email',
|
||||
];
|
||||
$rules['username'] = 'required|string';
|
||||
$rules['email'] = 'email';
|
||||
}
|
||||
|
||||
$request->validate($rules);
|
||||
|
@ -178,10 +164,6 @@ class LoginController extends Controller
|
|||
*/
|
||||
public function logout(Request $request)
|
||||
{
|
||||
if (config('saml2.enabled') && session()->get('last_login_type') === 'saml2') {
|
||||
return redirect('/saml2/logout');
|
||||
}
|
||||
|
||||
$this->guard()->logout();
|
||||
$request->session()->invalidate();
|
||||
|
||||
|
|
|
@ -75,10 +75,8 @@ class RegisterController extends Controller
|
|||
{
|
||||
$this->registrationService->checkRegistrationAllowed();
|
||||
$socialDrivers = $this->socialAuthService->getActiveDrivers();
|
||||
$samlEnabled = (config('saml2.enabled') === true) && (config('saml2.auto_register') === true);
|
||||
return view('auth.register', [
|
||||
'socialDrivers' => $socialDrivers,
|
||||
'samlEnabled' => $samlEnabled,
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,8 @@ class Saml2Controller extends Controller
|
|||
|
||||
// SAML2 access middleware
|
||||
$this->middleware(function ($request, $next) {
|
||||
if (!config('saml2.enabled')) {
|
||||
|
||||
if (config('auth.method') !== 'saml2') {
|
||||
$this->showPermissionError();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue