mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-15 16:57:09 +00:00
Remove LDAP support.
This commit is contained in:
@@ -36,6 +36,8 @@ use Illuminate\Routing\Redirector;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use Illuminate\View\View;
|
||||
use Log;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
|
||||
/**
|
||||
* Class RegisterController
|
||||
@@ -85,18 +87,7 @@ class RegisterController extends Controller
|
||||
*/
|
||||
public function register(Request $request)
|
||||
{
|
||||
// is allowed to?
|
||||
$allowRegistration = true;
|
||||
$singleUserMode = app('fireflyconfig')->get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;
|
||||
$userCount = User::count();
|
||||
$guard = config('auth.defaults.guard');
|
||||
if (true === $singleUserMode && $userCount > 0 && 'ldap' !== $guard) {
|
||||
$allowRegistration = false;
|
||||
}
|
||||
|
||||
if ('ldap' === $guard) {
|
||||
$allowRegistration = false;
|
||||
}
|
||||
$allowRegistration = $this->allowedToRegister();
|
||||
|
||||
if (false === $allowRegistration) {
|
||||
throw new FireflyException('Registration is currently not available :(');
|
||||
@@ -126,24 +117,9 @@ class RegisterController extends Controller
|
||||
*/
|
||||
public function showRegistrationForm(Request $request)
|
||||
{
|
||||
$allowRegistration = true;
|
||||
$isDemoSite = app('fireflyconfig')->get('is_demo_site', config('firefly.configuration.is_demo_site'))->data;
|
||||
$singleUserMode = app('fireflyconfig')->get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;
|
||||
$userCount = User::count();
|
||||
$pageTitle = (string)trans('firefly.register_page_title');
|
||||
$guard = config('auth.defaults.guard');
|
||||
|
||||
if (true === $isDemoSite) {
|
||||
$allowRegistration = false;
|
||||
}
|
||||
|
||||
if (true === $singleUserMode && $userCount > 0 && 'ldap' !== $guard) {
|
||||
$allowRegistration = false;
|
||||
}
|
||||
|
||||
if ('ldap' === $guard) {
|
||||
$allowRegistration = false;
|
||||
}
|
||||
$allowRegistration = $this->allowedToRegister();
|
||||
|
||||
if (false === $allowRegistration) {
|
||||
$message = 'Registration is currently not available.';
|
||||
@@ -156,4 +132,25 @@ class RegisterController extends Controller
|
||||
return view('auth.register', compact('isDemoSite', 'email', 'pageTitle'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function allowedToRegister(): bool {
|
||||
// is allowed to register?
|
||||
$allowRegistration = true;
|
||||
try {
|
||||
$singleUserMode = app('fireflyconfig')->get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;
|
||||
} catch (ContainerExceptionInterface|NotFoundExceptionInterface $e) {
|
||||
$singleUserMode = true;
|
||||
}
|
||||
$userCount = User::count();
|
||||
$guard = config('auth.defaults.guard');
|
||||
if (true === $singleUserMode && $userCount > 0 && 'web' === $guard) {
|
||||
$allowRegistration = false;
|
||||
}
|
||||
if('web' !== $guard) {
|
||||
$allowRegistration = false;
|
||||
}
|
||||
return $allowRegistration;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user