Final Feature 9c #10
|
|
@ -42,15 +42,23 @@ export default function Verify() {
|
|||
setError('Verifizierung erfolgreich, aber Login fehlgeschlagen')
|
||||
}
|
||||
} catch (err) {
|
||||
const errorMsg = err.message || 'Verifizierung fehlgeschlagen'
|
||||
let errorMsg = err.message || 'Verifizierung fehlgeschlagen'
|
||||
|
||||
// Try to parse JSON error response
|
||||
try {
|
||||
const parsed = JSON.parse(errorMsg)
|
||||
if (parsed.detail) errorMsg = parsed.detail
|
||||
} catch (e) {
|
||||
// Not JSON, use as-is
|
||||
}
|
||||
|
||||
// Check if already verified or already used
|
||||
if (errorMsg.includes('bereits bestätigt') || errorMsg.includes('already verified') ||
|
||||
errorMsg.includes('bereits verwendet') || errorMsg.includes('already used')) {
|
||||
setStatus('already_verified')
|
||||
setError(errorMsg) // Show the actual message
|
||||
// Auto-redirect to login after 3 seconds
|
||||
setTimeout(() => { window.location.href = '/login' }, 3000)
|
||||
// Auto-redirect to dashboard after 3 seconds (let App.jsx decide login vs dashboard)
|
||||
setTimeout(() => { window.location.href = '/' }, 3000)
|
||||
}
|
||||
// Check if token expired
|
||||
else if (errorMsg.includes('abgelaufen') || errorMsg.includes('expired')) {
|
||||
|
|
@ -218,10 +226,10 @@ export default function Verify() {
|
|||
</div>
|
||||
|
||||
<button
|
||||
onClick={() => navigate('/login')}
|
||||
onClick={() => { window.location.href = '/' }}
|
||||
className="btn btn-primary btn-full"
|
||||
>
|
||||
Jetzt anmelden
|
||||
Weiter zum Dashboard
|
||||
</button>
|
||||
</div>
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user