mirror of
https://github.com/v2board/v2board.git
synced 2025-01-10 16:19:10 +08:00
update: prevention of blasting
This commit is contained in:
parent
61f1d8a623
commit
757e605921
@ -286,7 +286,11 @@ class AuthController extends Controller
|
|||||||
|
|
||||||
public function forget(AuthForget $request)
|
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')) {
|
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'));
|
abort(500, __('Incorrect email verification code'));
|
||||||
}
|
}
|
||||||
$user = User::where('email', $request->input('email'))->first();
|
$user = User::where('email', $request->input('email'))->first();
|
||||||
|
@ -25,7 +25,8 @@ class CacheKey
|
|||||||
'REGISTER_IP_RATE_LIMIT' => '注册频率限制',
|
'REGISTER_IP_RATE_LIMIT' => '注册频率限制',
|
||||||
'LAST_SEND_LOGIN_WITH_MAIL_LINK_TIMESTAMP' => '最后一次发送登入链接时间',
|
'LAST_SEND_LOGIN_WITH_MAIL_LINK_TIMESTAMP' => '最后一次发送登入链接时间',
|
||||||
'PASSWORD_ERROR_LIMIT' => '密码错误次数限制',
|
'PASSWORD_ERROR_LIMIT' => '密码错误次数限制',
|
||||||
'USER_SESSIONS' => '用户session'
|
'USER_SESSIONS' => '用户session',
|
||||||
|
'FORGET_REQUEST_LIMIT' => '找回密码次数限制'
|
||||||
];
|
];
|
||||||
|
|
||||||
public static function get(string $key, $uniqueValue)
|
public static function get(string $key, $uniqueValue)
|
||||||
|
@ -94,5 +94,6 @@
|
|||||||
"Login to :name": "Login to :name",
|
"Login to :name": "Login to :name",
|
||||||
"Sending frequently, please try again later": "Sending frequently, please try again later",
|
"Sending frequently, please try again later": "Sending frequently, please try again later",
|
||||||
"Current product is sold out": "Current product is sold out",
|
"Current product is sold out": "Current product is sold out",
|
||||||
"There are too many password errors, please try again after :minute minutes.": "There are too many password errors, please try again after :minute minutes."
|
"There are too many password errors, please try again after :minute minutes.": "There are too many password errors, please try again after :minute minutes.",
|
||||||
|
"Reset failed, Please try again later": "Reset failed, Please try again later"
|
||||||
}
|
}
|
||||||
|
@ -94,5 +94,6 @@
|
|||||||
"Login to :name": "登入到 :name",
|
"Login to :name": "登入到 :name",
|
||||||
"Sending frequently, please try again later": "发送频繁,请稍后再试",
|
"Sending frequently, please try again later": "发送频繁,请稍后再试",
|
||||||
"Current product is sold out": "当前商品已售罄",
|
"Current product is sold out": "当前商品已售罄",
|
||||||
"There are too many password errors, please try again after :minute minutes.": "密码错误次数过多,请 :minute 分钟后再试"
|
"There are too many password errors, please try again after :minute minutes.": "密码错误次数过多,请 :minute 分钟后再试",
|
||||||
|
"Reset failed, Please try again later": "重置失败,请稍后再试"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user