mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: fix lostpass send mail limit (#659)
This commit is contained in:
1 parent
84962bfc64
commit
7b80e4d2a5
1 file changed
+5
@@ -332,6 +332,11 @@ class UserLostPassHandler extends Handler {
|
|||||||
if (!system.get('smtp.user')) throw new SystemError('Cannot send mail');
|
if (!system.get('smtp.user')) throw new SystemError('Cannot send mail');
|
||||||
const udoc = await user.getByEmail('system', mail);
|
const udoc = await user.getByEmail('system', mail);
|
||||||
if (!udoc) throw new UserNotFoundError(mail);
|
if (!udoc) throw new UserNotFoundError(mail);
|
||||||
|
await Promise.all([
|
||||||
|
this.limitRate('send_mail', 3600, 30, false),
|
||||||
|
this.limitRate(`user_lostpass_${mail}`, 60, 5, false),
|
||||||
|
oplog.log(this, 'user.lostpass', {}),
|
||||||
|
]);
|
||||||
const [tid] = await token.add(
|
const [tid] = await token.add(
|
||||||
token.TYPE_LOSTPASS,
|
token.TYPE_LOSTPASS,
|
||||||
system.get('session.unsaved_expire_seconds'),
|
system.get('session.unsaved_expire_seconds'),
|
||||||
|
|||||||
Reference in new issue
Block a user