]> BookStack Code Mirror - bookstack/blobdiff - app/Http/Controllers/Auth/RegisterController.php
Fixed local_secure_restricted preventing attachment uploads
[bookstack] / app / Http / Controllers / Auth / RegisterController.php
index 4008439bc7e69a7816b6dd9f504dc2f49e658d26..b0aec117791bc1a64fec7ceb713a898099b0353b 100644 (file)
@@ -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)
     {