/**
* Show the application registration form.
* @return Response
+ * @throws UserRegistrationException
*/
public function getRegister()
{
/**
* Handle a registration request for the application.
* @param Request|\Illuminate\Http\Request $request
- * @return Response
+ * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
* @throws UserRegistrationException
- * @throws \Illuminate\Validation\ValidationException
*/
public function postRegister(Request $request)
{
$this->checkRegistrationAllowed();
- $validator = $this->validator($request->all());
-
- if ($validator->fails()) {
- $this->throwValidationException(
- $request, $validator
- );
- }
+ $this->validator($request->all())->validate();
$userData = $request->all();
return $this->registerUser($userData);
* @param bool|false|SocialAccount $socialAccount
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
* @throws UserRegistrationException
- * @throws ConfirmationEmailException
*/
protected function registerUser(array $userData, $socialAccount = false)
{
* Redirect to the social site for authentication intended to register.
* @param $socialDriver
* @return mixed
+ * @throws UserRegistrationException
+ * @throws \BookStack\Exceptions\SocialDriverNotConfigured
*/
public function socialRegister($socialDriver)
{
}
$action = session()->pull('social-callback');
- if ($action == 'login') return $this->socialAuthService->handleLoginCallback($socialDriver);
- if ($action == 'register') return $this->socialRegisterCallback($socialDriver);
+ if ($action == 'login') {
+ return $this->socialAuthService->handleLoginCallback($socialDriver);
+ }
+ if ($action == 'register') {
+ return $this->socialRegisterCallback($socialDriver);
+ }
return redirect()->back();
}
* Register a new user after a registration callback.
* @param $socialDriver
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
- * @throws ConfirmationEmailException
* @throws UserRegistrationException
* @throws \BookStack\Exceptions\SocialDriverNotConfigured
*/
];
return $this->registerUser($userData, $socialAccount);
}
-
-}
\ No newline at end of file
+}