bug fix #3
|
|
@ -1,6 +1,12 @@
|
||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
import api from '../utils/api'
|
import api from '../utils/api'
|
||||||
|
|
||||||
|
function isEmailVerifiedRow(p) {
|
||||||
|
if (!p) return false
|
||||||
|
const v = p.email_verified
|
||||||
|
return v === true || v === 't' || v === 1 || v === 'true'
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hinweis + „Erneut senden“, wenn eingeloggt aber E-Mail noch nicht verifiziert (wie Mitai).
|
* Hinweis + „Erneut senden“, wenn eingeloggt aber E-Mail noch nicht verifiziert (wie Mitai).
|
||||||
*/
|
*/
|
||||||
|
|
@ -9,7 +15,7 @@ export default function EmailVerificationBanner({ profile }) {
|
||||||
const [success, setSuccess] = useState(false)
|
const [success, setSuccess] = useState(false)
|
||||||
const [error, setError] = useState('')
|
const [error, setError] = useState('')
|
||||||
|
|
||||||
if (!profile?.email || profile.email_verified !== false) return null
|
if (!profile?.email || isEmailVerifiedRow(profile)) return null
|
||||||
|
|
||||||
const handleResend = async () => {
|
const handleResend = async () => {
|
||||||
if (!profile.email) return
|
if (!profile.email) return
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,12 @@ function AccountSettingsPage() {
|
||||||
setName(typeof user?.name === 'string' ? user.name : '')
|
setName(typeof user?.name === 'string' ? user.name : '')
|
||||||
}, [user])
|
}, [user])
|
||||||
|
|
||||||
const verified = !!user?.email_verified
|
/** API: boolean true / Legacy: fehlt oder false → als „nicht verifiziert“ behandeln */
|
||||||
|
const emailExplicitlyVerified =
|
||||||
|
user?.email_verified === true ||
|
||||||
|
user?.email_verified === 't' ||
|
||||||
|
user?.email_verified === 1 ||
|
||||||
|
user?.email_verified === 'true'
|
||||||
|
|
||||||
const showOk = (text) => {
|
const showOk = (text) => {
|
||||||
setMessage(text)
|
setMessage(text)
|
||||||
|
|
@ -69,6 +74,7 @@ function AccountSettingsPage() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleChangePassword = async (e) => {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
if (newPw1.length < 4) {
|
if (newPw1.length < 4) {
|
||||||
showErr('Neues Passwort: mindestens 4 Zeichen.')
|
showErr('Neues Passwort: mindestens 4 Zeichen.')
|
||||||
|
|
@ -133,7 +139,7 @@ function AccountSettingsPage() {
|
||||||
<strong style={{ color: 'var(--text1)' }}>E-Mail</strong>
|
<strong style={{ color: 'var(--text1)' }}>E-Mail</strong>
|
||||||
<br />
|
<br />
|
||||||
{user?.email || '—'}{' '}
|
{user?.email || '—'}{' '}
|
||||||
{verified ? (
|
{emailExplicitlyVerified ? (
|
||||||
<span
|
<span
|
||||||
style={{
|
style={{
|
||||||
marginLeft: '0.5rem',
|
marginLeft: '0.5rem',
|
||||||
|
|
@ -160,7 +166,7 @@ function AccountSettingsPage() {
|
||||||
noch nicht bestätigt
|
noch nicht bestätigt
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
{!verified && user?.email ? (
|
{!emailExplicitlyVerified && user?.email ? (
|
||||||
<div style={{ marginTop: '0.75rem' }}>
|
<div style={{ marginTop: '0.75rem' }}>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user