Reformat various code.

This commit is contained in:
James Cole
2022-03-29 14:58:06 +02:00
parent 1209c4e76a
commit 29bed2547c
140 changed files with 1004 additions and 1010 deletions

View File

@@ -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;
}
}