mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-18 02:03:40 +00:00
Reformat various code.
This commit is contained in:
@@ -100,13 +100,36 @@ class RegisterController extends Controller
|
||||
|
||||
$this->guard()->login($user);
|
||||
|
||||
session()->flash('success', (string)trans('firefly.registered'));
|
||||
session()->flash('success', (string) trans('firefly.registered'));
|
||||
|
||||
$this->registered($request, $user);
|
||||
|
||||
return redirect($this->redirectPath());
|
||||
}
|
||||
|
||||
/**
|
||||
* @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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the application registration form.
|
||||
*
|
||||
@@ -118,7 +141,7 @@ class RegisterController extends Controller
|
||||
public function showRegistrationForm(Request $request)
|
||||
{
|
||||
$isDemoSite = app('fireflyconfig')->get('is_demo_site', config('firefly.configuration.is_demo_site'))->data;
|
||||
$pageTitle = (string)trans('firefly.register_page_title');
|
||||
$pageTitle = (string) trans('firefly.register_page_title');
|
||||
$allowRegistration = $this->allowedToRegister();
|
||||
|
||||
if (false === $allowRegistration) {
|
||||
@@ -131,26 +154,4 @@ 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