fix: introduce artificial delay + delay fudging on invalid email during reset token generation

v1.18.x
Julian Lam 4 years ago
parent 229f96f872
commit f6c14d6b62

@ -86,9 +86,10 @@ SocketUser.reset.send = async function (socket, email) {
try {
await user.reset.send(email);
await logEvent('[[success:success]]');
await sleep(2500);
await sleep(2500 + ((Math.random() * 500) - 250));
} catch (err) {
await logEvent(err.message);
await sleep(2500 + ((Math.random() * 500) - 250));
const internalErrors = ['[[error:invalid-email]]', '[[error:reset-rate-limited]]'];
if (!internalErrors.includes(err.message)) {
throw err;

Loading…
Cancel
Save