1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-30 04:23:11 +03:00

Checked over and aligned registration option behavior across all auth options

- Added tests to cover
This commit is contained in:
Dan Brown
2020-02-02 17:31:00 +00:00
parent e6c6de0848
commit 3991fbe726
20 changed files with 200 additions and 178 deletions

View File

@ -74,7 +74,7 @@ class RegisterController extends Controller
*/
public function getRegister()
{
$this->registrationService->checkRegistrationAllowed();
$this->registrationService->ensureRegistrationAllowed();
$socialDrivers = $this->socialAuthService->getActiveDrivers();
return view('auth.register', [
'socialDrivers' => $socialDrivers,
@ -87,12 +87,13 @@ class RegisterController extends Controller
*/
public function postRegister(Request $request)
{
$this->registrationService->checkRegistrationAllowed();
$this->registrationService->ensureRegistrationAllowed();
$this->validator($request->all())->validate();
$userData = $request->all();
try {
$this->registrationService->registerUser($userData);
$user = $this->registrationService->registerUser($userData);
auth()->login($user);
} catch (UserRegistrationException $exception) {
if ($exception->getMessage()) {
$this->showErrorNotification($exception->getMessage());