requested changes

This commit is contained in:
Daniel Hougaard
2025-03-07 19:59:29 +04:00
parent c48c9ae628
commit 67f2e4671a
2 changed files with 26 additions and 28 deletions
@@ -119,8 +119,7 @@ export const authPaswordServiceFactory = ({
* Email password reset flow via email. Step 1 send email * Email password reset flow via email. Step 1 send email
*/ */
const sendPasswordResetEmail = async (email: string) => { const sendPasswordResetEmail = async (email: string) => {
const startTime = Date.now(); const sendEmail = async () => {
const user = await userDAL.findUserByUsername(email); const user = await userDAL.findUserByUsername(email);
if (user && user.isAccepted) { if (user && user.isAccepted) {
@@ -141,13 +140,10 @@ export const authPaswordServiceFactory = ({
} }
}); });
} }
};
const elapsedTime = Date.now() - startTime; // note(daniel): run in background to prevent timing attacks
// daniel: ensure each request takes 8 seconds to prevent timing attacks void sendEmail();
if (elapsedTime < 8_000) {
// eslint-disable-next-line no-promise-executor-return
await new Promise((resolve) => setTimeout(resolve, 8_000 - elapsedTime));
}
}; };
/* /*
@@ -103,8 +103,10 @@ export const VerifyEmailPage = () => {
Look for an email in your inbox. Look for an email in your inbox.
</p> </p>
<div className="mt-4 flex flex-row items-center justify-center md:mx-2 md:pb-4"> <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"> <p className="w-max text-center text-sm text-gray-400">
An email with instructions has been sent to {email}. 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> </p>
</div> </div>
</div> </div>