mirror of
https://github.com/v2board/v2board.git
synced 2025-08-01 21:09:23 +08:00
update: prevention of blasting
This commit is contained in:
@ -286,7 +286,11 @@ class AuthController extends Controller
|
||||
|
||||
public function forget(AuthForget $request)
|
||||
{
|
||||
$forgetRequestLimitKey = CacheKey::get('FORGET_REQUEST_LIMIT', $request->input('email'));
|
||||
$forgetRequestLimit = (int)Cache::get($forgetRequestLimitKey);
|
||||
if ($forgetRequestLimit >= 3) abort(500, __('Reset failed, Please try again later'));
|
||||
if ((string)Cache::get(CacheKey::get('EMAIL_VERIFY_CODE', $request->input('email'))) !== (string)$request->input('email_code')) {
|
||||
Cache::put($forgetRequestLimitKey, $forgetRequestLimit ? $forgetRequestLimit + 1 : 1, 300);
|
||||
abort(500, __('Incorrect email verification code'));
|
||||
}
|
||||
$user = User::where('email', $request->input('email'))->first();
|
||||
|
@ -25,7 +25,8 @@ class CacheKey
|
||||
'REGISTER_IP_RATE_LIMIT' => '注册频率限制',
|
||||
'LAST_SEND_LOGIN_WITH_MAIL_LINK_TIMESTAMP' => '最后一次发送登入链接时间',
|
||||
'PASSWORD_ERROR_LIMIT' => '密码错误次数限制',
|
||||
'USER_SESSIONS' => '用户session'
|
||||
'USER_SESSIONS' => '用户session',
|
||||
'FORGET_REQUEST_LIMIT' => '找回密码次数限制'
|
||||
];
|
||||
|
||||
public static function get(string $key, $uniqueValue)
|
||||
|
Reference in New Issue
Block a user