feat: implement email verification flow and enhance user experience
- Added EmailVerificationBanner component to notify users about unverified email status and provide a resend verification option. - Introduced VerifyPage for handling email verification via a token in the URL, including success and error handling. - Updated LoginPage and AccountSettingsPage to allow users to resend verification emails directly from these pages. - Enhanced API utility with new functions for verifying emails and resending verification requests. - Updated routing to include the new verification page and improved link structure for verification links.
This commit is contained in:
1 parent
c6569abe1a
commit
2646bc776a
10 files changed
+390
-17
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import { createContext, useContext, useState, useEffect } from 'react'
|
||||
import { createContext, useContext, useState, useEffect, useCallback } from 'react'
|
||||
import api from '../utils/api'
|
||||
|
||||
const AuthContext = createContext(null)
|
||||
@@ -7,11 +7,7 @@ export function AuthProvider({ children }) {
|
||||
const [user, setUser] = useState(null)
|
||||
const [loading, setLoading] = useState(true)
|
||||
|
||||
useEffect(() => {
|
||||
checkAuth()
|
||||
}, [])
|
||||
|
||||
const checkAuth = async () => {
|
||||
const checkAuth = useCallback(async () => {
|
||||
const token = localStorage.getItem('authToken')
|
||||
if (!token) {
|
||||
setLoading(false)
|
||||
@@ -27,7 +23,11 @@ export function AuthProvider({ children }) {
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
}
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
checkAuth()
|
||||
}, [checkAuth])
|
||||
|
||||
/** Fallback, falls ohne checkAuth gesetzt wird (Legacy / Token-Injektion) */
|
||||
const login = (payload) => {
|
||||
|
||||
Reference in new issue
Block a user