Răsfoiți Sursa

Update AppRegisterController

Daniel Supernault 1 lună în urmă
părinte
comite
3977137d02
1 a modificat fișierele cu 6 adăugiri și 6 ștergeri
  1. 6 6
      app/Http/Controllers/AppRegisterController.php

+ 6 - 6
app/Http/Controllers/AppRegisterController.php

@@ -51,9 +51,9 @@ class AppRegisterController extends Controller
 
         DB::beginTransaction();
 
-        $exists = AppRegister::whereEmail($email)->where('created_at', '>', now()->subHours(24))->count();
+        $exists = AppRegister::whereEmail($email)->count();
 
-        if ($exists && $exists > 3) {
+        if ($exists) {
             $errorParams = http_build_query([
                 'status' => 'error',
                 'message' => 'Too many attempts, please try again later.',
@@ -102,7 +102,7 @@ class AppRegisterController extends Controller
         }
 
         $this->validate($request, [
-            'email' => 'required|email:rfc,dns,spoof,strict|unique:users,email',
+            'email' => 'required|email:rfc,dns,spoof,strict|unique:users,email|exists:app_registers,email',
             'verify_code' => ['required', 'digits:6', 'numeric'],
         ]);
 
@@ -111,7 +111,7 @@ class AppRegisterController extends Controller
 
         $exists = AppRegister::whereEmail($email)
             ->whereVerifyCode($code)
-            ->where('created_at', '>', now()->subHours(4))
+            ->where('created_at', '>', now()->subDays(220))
             ->exists();
 
         return response()->json([
@@ -204,7 +204,7 @@ class AppRegisterController extends Controller
         }
 
         $this->validate($request, [
-            'email' => 'required|email:rfc,dns,spoof,strict|unique:users,email',
+            'email' => 'required|email:rfc,dns,spoof,strict|unique:users,email|exists:app_registers,email',
             'verify_code' => ['required', 'digits:6', 'numeric'],
             'username' => $this->validateUsernameRule(),
             'name' => 'nullable|string|max:'.config('pixelfed.max_name_length'),
@@ -219,7 +219,7 @@ class AppRegisterController extends Controller
 
         $exists = AppRegister::whereEmail($email)
             ->whereVerifyCode($code)
-            ->where('created_at', '>', now()->subHours(4))
+            ->where('created_at', '>', now()->subDays(220))
             ->exists();
 
         if (! $exists) {