{
  "sha": "14d8ade60d4b0d5af9e0ca745550d79708996650",
  "node_id": "C_kwDOKDyQLdoAKDE0ZDhhZGU2MGQ0YjBkNWFmOWUwY2E3NDU1NTBkNzk3MDg5OTY2NTA",
  "commit": {
    "author": {
      "name": "gunzi-666",
      "email": "kinghao113@gmail.com",
      "date": "2026-05-22T16:29:05Z"
    },
    "committer": {
      "name": "GitHub",
      "email": "noreply@github.com",
      "date": "2026-05-22T16:29:05Z"
    },
    "message": "完整对齐一下验证 (#362)\n\n* emmm 具体复现就不描述了  xiao佬自己看\n\n* 哎  还是那个问题  完整修一下吧",
    "tree": {
      "sha": "bcd9981cb803fce0d527f23a196c8e56739f2fb4",
      "url": "https://api.github.com/repos/wyx2685/v2board/git/trees/bcd9981cb803fce0d527f23a196c8e56739f2fb4"
    },
    "url": "https://api.github.com/repos/wyx2685/v2board/git/commits/14d8ade60d4b0d5af9e0ca745550d79708996650",
    "comment_count": 0,
    "verification": {
      "verified": true,
      "reason": "valid",
      "signature": "-----BEGIN PGP SIGNATURE-----\n\nwsFcBAABCAAQBQJqEIRRCRC1aQ7uu5UhlAAA6AcQAK0/uZ63HA4tpxGE6Mwlhe5C\nv8GQkFdcOVkiVMu/C+V/aPSz26QK0HIaZCna7/xD6D/gT9/k9QC1wyyNXvgSvg3z\nWIi3r0UkIchfmUPjrMq11k6W26Bou2xbmYe90jZV3A94n0EA0u4uKoNYWCvnafV6\nD61HqSnZOFPBMUh1b+2x262yslfLan/qgZ3jyNsC6tzB/pG6RRlMJC2gzvasyS66\nxnB8ow8S2g5zMYBXJi9R4IfM9rsdPQptoe7TPrFoQzYYvevMqu/dm8dO0P90EoIA\nEnRoCSLRJ7uSOZclgF6lJQ8cI5fpShO9l0AssnATuOTYA8LRlzgS/184ErNcHdpU\nXwI+KLr/2qMmby7hFL7Qtpyy5xhVKS9F697LxeBMgSaVox8FJNTOs+7mYLfooA8d\nL2aaL4EJ4BuWbbIkGMMQf22E4nGieeBLSfdUXEwVJvBXKwP+P1yscwpX2s3XNBiw\nQSwrTeaNZn3gy+3eFA7ApAau8gipL+LX22/Trx9cpi35xgHBaAKdh1/vJHaksfB4\nPIqIHtvBVXLlP284E7OEQWxlYI/jp64e2tCvWGGPXYgd0CIVi/gVABs/2q6jk/Zh\n6BYcYvdNkrkI2eGjBXIme3kjrP0VGpS0fVaZ8s8tAApqRn930n4MNDX/f368QB+0\ncOxKadk+sKvugHxG+v7w\n=zH0n\n-----END PGP SIGNATURE-----\n",
      "payload": "tree bcd9981cb803fce0d527f23a196c8e56739f2fb4\nparent 3ef38b9ea49e8493acc7766963f6d8d7f9c9f6c3\nauthor gunzi-666 <kinghao113@gmail.com> 1779467345 +0800\ncommitter GitHub <noreply@github.com> 1779467345 +0800\n\n完整对齐一下验证 (#362)\n\n* emmm 具体复现就不描述了  xiao佬自己看\n\n* 哎  还是那个问题  完整修一下吧",
      "verified_at": "2026-05-22T16:29:06Z"
    }
  },
  "url": "https://api.github.com/repos/wyx2685/v2board/commits/14d8ade60d4b0d5af9e0ca745550d79708996650",
  "html_url": "https://github.com/wyx2685/v2board/commit/14d8ade60d4b0d5af9e0ca745550d79708996650",
  "comments_url": "https://api.github.com/repos/wyx2685/v2board/commits/14d8ade60d4b0d5af9e0ca745550d79708996650/comments",
  "author": {
    "login": "gunzi-666",
    "id": 190101158,
    "node_id": "U_kgDOC1S2pg",
    "avatar_url": "https://avatars.githubusercontent.com/u/190101158?v=4",
    "gravatar_id": "",
    "url": "https://api.github.com/users/gunzi-666",
    "html_url": "https://github.com/gunzi-666",
    "followers_url": "https://api.github.com/users/gunzi-666/followers",
    "following_url": "https://api.github.com/users/gunzi-666/following{/other_user}",
    "gists_url": "https://api.github.com/users/gunzi-666/gists{/gist_id}",
    "starred_url": "https://api.github.com/users/gunzi-666/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/gunzi-666/subscriptions",
    "organizations_url": "https://api.github.com/users/gunzi-666/orgs",
    "repos_url": "https://api.github.com/users/gunzi-666/repos",
    "events_url": "https://api.github.com/users/gunzi-666/events{/privacy}",
    "received_events_url": "https://api.github.com/users/gunzi-666/received_events",
    "type": "User",
    "user_view_type": "public",
    "site_admin": false
  },
  "committer": {
    "login": "web-flow",
    "id": 19864447,
    "node_id": "MDQ6VXNlcjE5ODY0NDQ3",
    "avatar_url": "https://avatars.githubusercontent.com/u/19864447?v=4",
    "gravatar_id": "",
    "url": "https://api.github.com/users/web-flow",
    "html_url": "https://github.com/web-flow",
    "followers_url": "https://api.github.com/users/web-flow/followers",
    "following_url": "https://api.github.com/users/web-flow/following{/other_user}",
    "gists_url": "https://api.github.com/users/web-flow/gists{/gist_id}",
    "starred_url": "https://api.github.com/users/web-flow/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/web-flow/subscriptions",
    "organizations_url": "https://api.github.com/users/web-flow/orgs",
    "repos_url": "https://api.github.com/users/web-flow/repos",
    "events_url": "https://api.github.com/users/web-flow/events{/privacy}",
    "received_events_url": "https://api.github.com/users/web-flow/received_events",
    "type": "User",
    "user_view_type": "public",
    "site_admin": false
  },
  "parents": [
    {
      "sha": "3ef38b9ea49e8493acc7766963f6d8d7f9c9f6c3",
      "url": "https://api.github.com/repos/wyx2685/v2board/commits/3ef38b9ea49e8493acc7766963f6d8d7f9c9f6c3",
      "html_url": "https://github.com/wyx2685/v2board/commit/3ef38b9ea49e8493acc7766963f6d8d7f9c9f6c3"
    }
  ],
  "stats": {
    "total": 62,
    "additions": 37,
    "deletions": 25
  },
  "files": [
    {
      "sha": "3d6febfb4a8f2095b22b5b067ca0b189020ff52a",
      "filename": "app/Http/Controllers/V1/Passport/AuthController.php",
      "status": "modified",
      "additions": 21,
      "deletions": 16,
      "changes": 37,
      "blob_url": "https://github.com/wyx2685/v2board/blob/14d8ade60d4b0d5af9e0ca745550d79708996650/app%2FHttp%2FControllers%2FV1%2FPassport%2FAuthController.php",
      "raw_url": "https://github.com/wyx2685/v2board/raw/14d8ade60d4b0d5af9e0ca745550d79708996650/app%2FHttp%2FControllers%2FV1%2FPassport%2FAuthController.php",
      "contents_url": "https://api.github.com/repos/wyx2685/v2board/contents/app%2FHttp%2FControllers%2FV1%2FPassport%2FAuthController.php?ref=14d8ade60d4b0d5af9e0ca745550d79708996650",
      "patch": "@@ -59,15 +59,18 @@ public function register(AuthRegister $request)\n                 abort(500, __('You must use the invitation code to register'));\n             }\n         }\n+        $email = $request->input('email');\n+        $cacheKeyEmail = is_string($email) ? strtolower(trim($email)) : '';\n         if ((int)config('v2board.email_verify', 0)) {\n-            if (empty($request->input('email_code'))) {\n-                abort(500, __('Email verification code cannot be empty'));\n+            $inputCode = $request->input('email_code');\n+            if (!is_string($inputCode) || !preg_match('/^\\d{6}$/', $inputCode)) {\n+                abort(500, __('Incorrect email verification code'));\n             }\n-            if ((string)Cache::get(CacheKey::get('EMAIL_VERIFY_CODE', $request->input('email'))) !== (string)$request->input('email_code')) {\n+            $cachedCode = Cache::get(CacheKey::get('EMAIL_VERIFY_CODE', $cacheKeyEmail));\n+            if ($cachedCode === null || $cachedCode === '' || !hash_equals((string)$cachedCode, $inputCode)) {\n                 abort(500, __('Incorrect email verification code'));\n             }\n         }\n-        $email = $request->input('email');\n         $password = $request->input('password');\n         $exist = User::where('email', $email)->first();\n         if ($exist) {\n@@ -112,7 +115,7 @@ public function register(AuthRegister $request)\n             abort(500, __('Register failed'));\n         }\n         if ((int)config('v2board.email_verify', 0)) {\n-            Cache::forget(CacheKey::get('EMAIL_VERIFY_CODE', $request->input('email')));\n+            Cache::forget(CacheKey::get('EMAIL_VERIFY_CODE', $cacheKeyEmail));\n         }\n \n         $user->last_login_at = time();\n@@ -234,41 +237,43 @@ public function getQuickLoginUrl(Request $request)\n \n     public function forget(AuthForget $request)\n     {\n-        $email     = strtolower(trim((string)$request->input('email')));\n-        $inputCode = (string)$request->input('email_code');\n-        $password  = (string)$request->input('password');\n+        $email     = $request->input('email');\n+        $inputCode = $request->input('email_code');\n+        $password  = $request->input('password');\n \n+        if (!is_string($email) || !is_string($inputCode) || !is_string($password)) {\n+            abort(500, __('Incorrect email verification code'));\n+        }\n         if (!preg_match('/^\\d{6}$/', $inputCode)) {\n             abort(500, __('Incorrect email verification code'));\n         }\n \n-        $forgetRequestLimitKey = CacheKey::get('FORGET_REQUEST_LIMIT', $email);\n+        $cacheKeyEmail         = strtolower(trim($email));\n+        $forgetRequestLimitKey = CacheKey::get('FORGET_REQUEST_LIMIT', $cacheKeyEmail);\n         $forgetRequestLimit    = (int)Cache::get($forgetRequestLimitKey);\n         if ($forgetRequestLimit >= 3) {\n             abort(500, __('Reset failed, Please try again later'));\n         }\n \n-        $cachedCode = Cache::get(CacheKey::get('EMAIL_VERIFY_CODE', $email));\n+        $cachedCode = Cache::get(CacheKey::get('EMAIL_VERIFY_CODE', $cacheKeyEmail));\n         if ($cachedCode === null || $cachedCode === '' || !hash_equals((string)$cachedCode, $inputCode)) {\n             Cache::put($forgetRequestLimitKey, $forgetRequestLimit + 1, 300);\n             abort(500, __('Incorrect email verification code'));\n         }\n-\n         $user = User::where('email', $email)->first();\n         if (!$user) {\n             abort(500, __('This email is not registered in the system'));\n         }\n-\n         $user->password      = password_hash($password, PASSWORD_DEFAULT);\n         $user->password_algo = null;\n         $user->password_salt = null;\n         if (!$user->save()) {\n             abort(500, __('Reset failed'));\n         }\n-\n-        Cache::forget(CacheKey::get('EMAIL_VERIFY_CODE', $email));\n+        Cache::forget(CacheKey::get('EMAIL_VERIFY_CODE', $cacheKeyEmail));\n         (new AuthService($user))->removeAllSession();\n-\n-        return response(['data' => true]);\n+        return response([\n+            'data' => true\n+        ]);\n     }\n }"
    },
    {
      "sha": "55acef7fcb444d74064390759e349a1559fd6827",
      "filename": "app/Http/Controllers/V1/Passport/CommController.php",
      "status": "modified",
      "additions": 5,
      "deletions": 4,
      "changes": 9,
      "blob_url": "https://github.com/wyx2685/v2board/blob/14d8ade60d4b0d5af9e0ca745550d79708996650/app%2FHttp%2FControllers%2FV1%2FPassport%2FCommController.php",
      "raw_url": "https://github.com/wyx2685/v2board/raw/14d8ade60d4b0d5af9e0ca745550d79708996650/app%2FHttp%2FControllers%2FV1%2FPassport%2FCommController.php",
      "contents_url": "https://api.github.com/repos/wyx2685/v2board/contents/app%2FHttp%2FControllers%2FV1%2FPassport%2FCommController.php?ref=14d8ade60d4b0d5af9e0ca745550d79708996650",
      "patch": "@@ -44,6 +44,7 @@ public function sendEmailVerify(CommSendEmailVerify $request)\n             }\n         }\n         $email = $request->input('email');\n+        $cacheKeyEmail = strtolower(trim((string)$email));\n         $isforget = $request->input('isforget');\n         $email_exists = User::where('email', $email)->exists();\n         //检查是否在白名单内\n@@ -70,10 +71,10 @@ public function sendEmailVerify(CommSendEmailVerify $request)\n                 abort(500, __('This email is not registered in the system'));\n             }\n         }\n-        if (Cache::get(CacheKey::get('LAST_SEND_EMAIL_VERIFY_TIMESTAMP', $email))) {\n+        if (Cache::get(CacheKey::get('LAST_SEND_EMAIL_VERIFY_TIMESTAMP', $cacheKeyEmail))) {\n             abort(500, __('Email verification code has been sent, please request again later'));\n         }\n-        $code = rand(100000, 999999);\n+        $code = (string)rand(100000, 999999);\n         $subject = config('v2board.app_name', 'V2Board') . __('Email verification code');\n \n         SendEmailJob::dispatch([\n@@ -87,8 +88,8 @@ public function sendEmailVerify(CommSendEmailVerify $request)\n             ]\n         ]);\n \n-        Cache::put(CacheKey::get('EMAIL_VERIFY_CODE', $email), $code, 300);\n-        Cache::put(CacheKey::get('LAST_SEND_EMAIL_VERIFY_TIMESTAMP', $email), time(), 60);\n+        Cache::put(CacheKey::get('EMAIL_VERIFY_CODE', $cacheKeyEmail), $code, 300);\n+        Cache::put(CacheKey::get('LAST_SEND_EMAIL_VERIFY_TIMESTAMP', $cacheKeyEmail), time(), 60);\n         return response([\n             'data' => true\n         ]);"
    },
    {
      "sha": "b002db1715d873af2f2920e798363f70be706039",
      "filename": "app/Http/Requests/Passport/AuthForget.php",
      "status": "modified",
      "additions": 11,
      "deletions": 5,
      "changes": 16,
      "blob_url": "https://github.com/wyx2685/v2board/blob/14d8ade60d4b0d5af9e0ca745550d79708996650/app%2FHttp%2FRequests%2FPassport%2FAuthForget.php",
      "raw_url": "https://github.com/wyx2685/v2board/raw/14d8ade60d4b0d5af9e0ca745550d79708996650/app%2FHttp%2FRequests%2FPassport%2FAuthForget.php",
      "contents_url": "https://api.github.com/repos/wyx2685/v2board/contents/app%2FHttp%2FRequests%2FPassport%2FAuthForget.php?ref=14d8ade60d4b0d5af9e0ca745550d79708996650",
      "patch": "@@ -23,11 +23,17 @@ public function rules()\n     public function messages()\n     {\n         return [\n-            'email.required' => __('Email can not be empty'),\n-            'email.email' => __('Email format is incorrect'),\n-            'password.required' => __('Password can not be empty'),\n-            'password.min' => __('Password must be greater than 8 digits'),\n-            'email_code.required' => __('Email verification code cannot be empty')\n+            'email.required'      => __('Email can not be empty'),\n+            'email.string'        => __('Email format is incorrect'),\n+            'email.email'         => __('Email format is incorrect'),\n+            'email.max'           => __('Email format is incorrect'),\n+            'password.required'   => __('Password can not be empty'),\n+            'password.string'     => __('Password can not be empty'),\n+            'password.min'        => __('Password must be greater than 8 digits'),\n+            'password.max'        => __('Password must be greater than 8 digits'),\n+            'email_code.required' => __('Email verification code cannot be empty'),\n+            'email_code.string'   => __('Incorrect email verification code'),\n+            'email_code.digits'   => __('Incorrect email verification code'),\n         ];\n     }\n }"
    }
  ]
}
