MCPcopy Create free account
hub / github.com/monkeytypegame/monkeytype / sendForgotPasswordEmail

Function sendForgotPasswordEmail

backend/src/utils/auth.ts:90–110  ·  view source on GitHub ↗
(email: string)

Source from the content-addressed store, hash-verified

88}
89
90export async function sendForgotPasswordEmail(email: string): Promise<void> {
91 try {
92 const uid = (await FirebaseAdmin().auth().getUserByEmail(email)).uid;
93 const { name } = await UserDAL.getPartialUser(
94 uid,
95 "request forgot password email",
96 ["name"],
97 );
98
99 const link = await FirebaseAdmin()
100 .auth()
101 .generatePasswordResetLink(email, { url: getFrontendUrl() });
102
103 await emailQueue.sendForgotPasswordEmail(email, name, link);
104 } catch (err) {
105 if (isFirebaseError(err) && err.errorInfo.code !== "auth/user-not-found") {
106 // oxlint-disable-next-line only-throw-error
107 throw err;
108 }
109 }
110}

Callers

nothing calls this directly

Calls 3

getFrontendUrlFunction · 0.90
isFirebaseErrorFunction · 0.90

Tested by

no test coverage detected