add email verification step to new user onboarding flow
This commit is contained in:
@@ -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,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user