add email verification step to new user onboarding flow

This commit is contained in:
KS Jannette
2026-05-11 22:13:53 -04:00
parent 3c282c589c
commit 6b07d51cb1
3 changed files with 116 additions and 12 deletions

View File

@@ -4,6 +4,7 @@ import {
signInWithEmailAndPassword,
createUserWithEmailAndPassword,
signOut,
sendEmailVerification as firebaseSendEmailVerification,
} from "firebase/auth";
import { auth } from "../firebase/config";
import { getAccount } from "../api/account";
@@ -68,6 +69,19 @@ export function AuthProvider({ children }) {
await signOut(auth);
}
async function sendEmailVerification() {
if (auth.currentUser) {
await firebaseSendEmailVerification(auth.currentUser);
}
}
async function reloadUser() {
if (auth.currentUser) {
await auth.currentUser.reload();
setCurrentUser({ ...auth.currentUser });
}
}
const value = {
currentUser,
userTier,
@@ -77,6 +91,8 @@ export function AuthProvider({ children }) {
signup,
login,
logout,
sendEmailVerification,
reloadUser,
refreshAccount: fetchAccount,
};