refactor: improve email verification handling in components
Deploy Development / deploy (push) Successful in 36s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 15s
Test Suite / playwright-tests (push) Failing after 2m3s

- Introduced a utility function to standardize email verification checks across EmailVerificationBanner and AccountSettingsPage.
- Updated conditional logic to enhance clarity and maintainability regarding email verification status.
- Ensured consistent treatment of various representations of email verification status in user profiles.
This commit is contained in:
Lars committed 2026-04-29 11:48:04 +02:00
1 parent 2646bc776a
commit a748f4607d
2 files changed
+16 -4

No files matched your search

+9 -3
View File
@@ -22,7 +22,12 @@ function AccountSettingsPage() {
setName(typeof user?.name === 'string' ? user.name : '')
}, [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) => {
setMessage(text)
@@ -69,6 +74,7 @@ function AccountSettingsPage() {
}
}
const handleChangePassword = async (e) => {
e.preventDefault()
if (newPw1.length < 4) {
showErr('Neues Passwort: mindestens 4 Zeichen.')
@@ -133,7 +139,7 @@ function AccountSettingsPage() {
<strong style={{ color: 'var(--text1)' }}>E-Mail</strong>
<br />
{user?.email || '—'}{' '}
{verified ? (
{emailExplicitlyVerified ? (
<span
style={{
marginLeft: '0.5rem',
@@ -160,7 +166,7 @@ function AccountSettingsPage() {
noch nicht bestätigt
</span>
)}
{!verified && user?.email ? (
{!emailExplicitlyVerified && user?.email ? (
<div style={{ marginTop: '0.75rem' }}>
<button
type="button"