Skip to content

Commit 72e260f

Browse files
committed
fix error page
1 parent 942d0fe commit 72e260f

6 files changed

Lines changed: 31 additions & 34 deletions

File tree

locales/de-DE.arb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,10 @@
400400
"pageTitleForgotPassword": "Passwort vergessen",
401401
"pageTitleInfo": "Information",
402402
"pageTitleError": "Fehler",
403+
"pageTitlePageDisabled": "Seite deaktiviert",
404+
"@pageTitlePageDisabled": {
405+
"description": "Titel für deaktivierte/Fehlerseite"
406+
},
403407
"pageTitleCode": "Bestätigungscode",
404408
"pageTitleLogoutConfirm": "Abmelden",
405409
"pageTitleTerms": "Allgemeine Geschäftsbedingungen",

locales/en-US.arb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,10 @@
400400
"pageTitleForgotPassword": "Forgot Password",
401401
"pageTitleInfo": "Information",
402402
"pageTitleError": "Error",
403+
"pageTitlePageDisabled": "Page disabled",
404+
"@pageTitlePageDisabled": {
405+
"description": "Title for disabled/error page"
406+
},
403407
"pageTitleCode": "Verification Code",
404408
"pageTitleLogoutConfirm": "Log Out",
405409
"pageTitleTerms": "Terms and Conditions",

src/account/pages/AccountSettings.tsx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,20 @@ function getDisplayName(kcContext: Extract<KcContext, { pageId: 'account.ftl' }>
1717
return account.username ?? ''
1818
}
1919

20+
function getDeleteAccountUrl(accountUrl: string): string {
21+
const base = accountUrl.replace(/\/$/, '')
22+
const realmPath = base.replace(/\/account$/, '')
23+
const authUrl = `${realmPath}/protocol/openid-connect/auth`
24+
const params = new URLSearchParams({
25+
client_id: 'account-console',
26+
redirect_uri: accountUrl,
27+
response_type: 'code',
28+
scope: 'openid',
29+
kc_action: 'delete_account'
30+
})
31+
return `${authUrl}?${params.toString()}`
32+
}
33+
2034
export default function AccountSettings({ kcContext }: AccountSettingsProps) {
2135
const t = useTranslation()
2236
const translateError = useTranslatedFieldError()
@@ -196,11 +210,11 @@ export default function AccountSettings({ kcContext }: AccountSettingsProps) {
196210
onCancel={() => setDeleteAccountDialogOpen(false)}
197211
onConfirm={() => {
198212
setDeleteAccountDialogOpen(false)
199-
window.location.href = url.accountUrl.replace(/\/$/, '') + '/delete-account'
213+
window.location.href = getDeleteAccountUrl(url.accountUrl)
200214
}}
201215
buttonOverwrites={[
202216
{ text: t('doCancel') },
203-
undefined,
217+
{},
204218
{ text: t('doDeleteAccount') }
205219
]}
206220
/>

src/i18n/translations.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ export type HelpwaveIdTranslationEntries = {
113113
'pageTitleLogoutConfirm': string,
114114
'pageTitleOauth2DeviceVerifyUserCode': string,
115115
'pageTitleOauthGrant': string,
116+
'pageTitlePageDisabled': string,
116117
'pageTitlePageExpired': string,
117118
'pageTitlePasskeysConditionalAuthenticate': string,
118119
'pageTitleRecoveryCodeConfig': string,
@@ -276,6 +277,7 @@ export const helpwaveIdTranslation: Translation<HelpwaveIdTranslationLocales, Pa
276277
'pageTitleLogoutConfirm': `Abmelden`,
277278
'pageTitleOauth2DeviceVerifyUserCode': `Geräte-Anmeldung`,
278279
'pageTitleOauthGrant': `Zugriff gewähren`,
280+
'pageTitlePageDisabled': `Seite deaktiviert`,
279281
'pageTitlePageExpired': `Seite abgelaufen`,
280282
'pageTitlePasskeysConditionalAuthenticate': `Passkey-Anmeldung`,
281283
'pageTitleRecoveryCodeConfig': `Wiederherstellungscodes`,
@@ -438,6 +440,7 @@ Der Anmeldevorgang wird von vorne begonnen.`,
438440
'pageTitleLogoutConfirm': `Log Out`,
439441
'pageTitleOauth2DeviceVerifyUserCode': `Device Login`,
440442
'pageTitleOauthGrant': `Grant Access`,
443+
'pageTitlePageDisabled': `Page disabled`,
441444
'pageTitlePageExpired': `Page Expired`,
442445
'pageTitlePasskeysConditionalAuthenticate': `Passkey Login`,
443446
'pageTitleRecoveryCodeConfig': `Recovery Codes`,

src/login/components/RealmChip.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Chip } from '@helpwave/hightide'
22
import { getRealmColor } from '../utils/realmColor'
33

44
type RealmChipProps = {
5-
kcContext: { realm: { name?: string, realm?: string } },
5+
kcContext: { realm: Record<string, unknown> },
66
};
77

88
export function RealmChip({ kcContext }: RealmChipProps) {

src/login/pages/Error.tsx

Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1-
import { Button } from '@helpwave/hightide'
21
import type { KcContext } from '../KcContext'
32
import { useI18n } from '../i18n'
43
import Template from 'keycloakify/login/Template'
54
import { PageLayout } from '../components/PageLayout'
65
import { AlertBox } from '../components/AlertBox'
7-
import { ArrowLeft, RotateCcw } from 'lucide-react'
86
import { useTranslation } from '../../i18n/useTranslation'
9-
import { getPageTitleKey } from '../utils/pageTitles'
107

118
type ErrorProps = {
129
kcContext: Extract<KcContext, { pageId: 'error.ftl' }>,
@@ -15,6 +12,7 @@ type ErrorProps = {
1512
export default function Error({ kcContext }: ErrorProps) {
1613
const { i18n } = useI18n({ kcContext })
1714
const t = useTranslation()
15+
const documentTitle = `${t('pageTitlePageDisabled')} | ${t('helpwaveId')}`
1816

1917
return (
2018
<Template
@@ -23,37 +21,11 @@ export default function Error({ kcContext }: ErrorProps) {
2321
displayMessage={false}
2422
headerNode={null}
2523
doUseDefaultCss={false}
26-
documentTitle={t(getPageTitleKey(kcContext.pageId))}
24+
documentTitle={documentTitle}
2725
>
2826
<PageLayout kcContext={kcContext}>
27+
<h1 className="text-xl font-bold text-center mb-4">{t('pageTitlePageDisabled')}</h1>
2928
{kcContext.message && <AlertBox message={kcContext.message} />}
30-
31-
<div style={{ display: 'flex', flexDirection: 'column', gap: '1rem' }}>
32-
<Button
33-
type="button"
34-
color="primary"
35-
onClick={() => {
36-
window.location.href = kcContext.url.loginRestartFlowUrl
37-
}}
38-
>
39-
<RotateCcw className="w-4 h-4" />
40-
{t('doRestart') || t('doContinue')}
41-
</Button>
42-
43-
{kcContext.url.loginUrl && (
44-
<Button
45-
type="button"
46-
color="neutral"
47-
coloringStyle="outline"
48-
onClick={() => {
49-
window.location.href = kcContext.url.loginUrl
50-
}}
51-
>
52-
<ArrowLeft className="w-4 h-4" />
53-
{t('backToLogin')}
54-
</Button>
55-
)}
56-
</div>
5729
</PageLayout>
5830
</Template>
5931
)

0 commit comments

Comments
 (0)