X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/9249addb5c458d30a5b06ff1ccc3a4e1b5d29acb..refs/pull/3693/head:/app/Http/Controllers/Auth/RegisterController.php diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index 4008439bc..b0aec1177 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -6,12 +6,14 @@ use BookStack\Auth\Access\LoginService; use BookStack\Auth\Access\RegistrationService; use BookStack\Auth\Access\SocialAuthService; use BookStack\Auth\User; +use BookStack\Exceptions\StoppedAuthenticationException; use BookStack\Exceptions\UserRegistrationException; use BookStack\Http\Controllers\Controller; use Illuminate\Foundation\Auth\RegistersUsers; use Illuminate\Http\Request; use Illuminate\Support\Facades\Hash; -use Validator; +use Illuminate\Support\Facades\Validator; +use Illuminate\Validation\Rules\Password; class RegisterController extends Controller { @@ -28,9 +30,9 @@ class RegisterController extends Controller use RegistersUsers; - protected $socialAuthService; - protected $registrationService; - protected $loginService; + protected SocialAuthService $socialAuthService; + protected RegistrationService $registrationService; + protected LoginService $loginService; /** * Where to redirect users after login / registration. @@ -47,8 +49,7 @@ class RegisterController extends Controller SocialAuthService $socialAuthService, RegistrationService $registrationService, LoginService $loginService - ) - { + ) { $this->middleware('guest'); $this->middleware('guard:standard'); @@ -68,9 +69,9 @@ class RegisterController extends Controller protected function validator(array $data) { return Validator::make($data, [ - 'name' => 'required|min:2|max:255', - 'email' => 'required|email|max:255|unique:users', - 'password' => 'required|min:8', + 'name' => ['required', 'min:2', 'max:100'], + 'email' => ['required', 'email', 'max:255', 'unique:users'], + 'password' => ['required', Password::default()], ]); } @@ -93,6 +94,7 @@ class RegisterController extends Controller * Handle a registration request for the application. * * @throws UserRegistrationException + * @throws StoppedAuthenticationException */ public function postRegister(Request $request) {