Przeglądaj źródła

Update RegisterController, bump min password length from 6 to 8

Daniel Supernault 5 lat temu
rodzic
commit
f22a4b2d75
1 zmienionych plików z 10 dodań i 7 usunięć
  1. 10 7
      app/Http/Controllers/Auth/RegisterController.php

+ 10 - 7
app/Http/Controllers/Auth/RegisterController.php

@@ -76,7 +76,7 @@ class RegisterController extends Controller
             'name'     => 'required|string|max:'.config('pixelfed.max_name_length'),
             'name'     => 'required|string|max:'.config('pixelfed.max_name_length'),
             'username' => $usernameRules,
             'username' => $usernameRules,
             'email'    => 'required|string|email|max:255|unique:users',
             'email'    => 'required|string|email|max:255|unique:users',
-            'password' => 'required|string|min:6|confirmed',
+            'password' => 'required|string|min:8|confirmed',
         ];
         ];
 
 
         return Validator::make($data, $rules);
         return Validator::make($data, $rules);
@@ -123,14 +123,17 @@ class RegisterController extends Controller
      */
      */
     public function showRegistrationForm()
     public function showRegistrationForm()
     {
     {
-        $count = User::count();
-        $limit = config('pixelfed.max_users');
-        if($limit && $limit <= $count) {
-            $view = 'site.closed-registration';
+        if(config('pixelfed.open_registration')) {
+            $limit = config('pixelfed.max_users');
+            if($limit) {
+                abort_if($limit <= User::count(), 404);
+                return view('auth.register');
+            } else {
+                return view('auth.register');
+            }
         } else {
         } else {
-            $view = config('pixelfed.open_registration') == true ? 'auth.register' : 'site.closed-registration';
+            abort(404);
         }
         }
-        return view($view);
     }
     }
 
 
     /**
     /**