mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-10 09:28:36 +00:00
requested changes
This commit is contained in:
@@ -119,8 +119,7 @@ export const authPaswordServiceFactory = ({
|
||||
* Email password reset flow via email. Step 1 send email
|
||||
*/
|
||||
const sendPasswordResetEmail = async (email: string) => {
|
||||
const startTime = Date.now();
|
||||
|
||||
const sendEmail = async () => {
|
||||
const user = await userDAL.findUserByUsername(email);
|
||||
|
||||
if (user && user.isAccepted) {
|
||||
@@ -141,13 +140,10 @@ export const authPaswordServiceFactory = ({
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const elapsedTime = Date.now() - startTime;
|
||||
// daniel: ensure each request takes 8 seconds to prevent timing attacks
|
||||
if (elapsedTime < 8_000) {
|
||||
// eslint-disable-next-line no-promise-executor-return
|
||||
await new Promise((resolve) => setTimeout(resolve, 8_000 - elapsedTime));
|
||||
}
|
||||
// note(daniel): run in background to prevent timing attacks
|
||||
void sendEmail();
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
@@ -103,8 +103,10 @@ export const VerifyEmailPage = () => {
|
||||
Look for an email in your inbox.
|
||||
</p>
|
||||
<div className="mt-4 flex flex-row items-center justify-center md:mx-2 md:pb-4">
|
||||
<p className="flex w-max justify-center text-center text-sm text-gray-400">
|
||||
An email with instructions has been sent to {email}.
|
||||
<p className="w-max text-center text-sm text-gray-400">
|
||||
If the email is in our system, you will receive an email at{" "}
|
||||
<span className="italic">{email}</span> with instructions on how to reset your
|
||||
password.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user