diff --git a/packages/core/src/oidc/init.ts b/packages/core/src/oidc/init.ts index 4cb599726..6f718eb18 100644 --- a/packages/core/src/oidc/init.ts +++ b/packages/core/src/oidc/init.ts @@ -3,7 +3,9 @@ import { readFileSync } from 'fs'; import { userClaims } from '@logto/core-kit'; +import type { I18nKey } from '@logto/phrases'; import { CustomClientMetadataKey, demoAppApplicationId } from '@logto/schemas'; +import i18next from 'i18next'; import Provider, { errors, ResourceServer } from 'oidc-provider'; import snakecaseKeys from 'snakecase-keys'; @@ -37,6 +39,7 @@ export default function initOidc(envSet: EnvSet, queries: Queries, libraries: Li const { findUserScopesForResourceIndicator } = libraries.users; const { findApplicationScopesForResourceIndicator } = libraries.applications; const logoutSource = readFileSync('static/html/logout.html', 'utf8'); + const logoutSuccessSource = readFileSync('static/html/post-logout/index.html', 'utf8'); const cookieConfig = Object.freeze({ sameSite: 'lax', @@ -76,6 +79,13 @@ export default function initOidc(envSet: EnvSet, queries: Queries, libraries: Li // eslint-disable-next-line no-template-curly-in-string ctx.body = logoutSource.replace('${form}', form); }, + postLogoutSuccessSource(ctx) { + ctx.body = logoutSuccessSource.replace( + // eslint-disable-next-line no-template-curly-in-string + '${message}', + i18next.t('oidc.logout_success') + ); + }, }, // https://github.com/panva/node-oidc-provider/blob/main/docs/README.md#featuresresourceindicators resourceIndicators: { diff --git a/packages/core/static/html/post-logout/favicon.ico b/packages/core/static/html/post-logout/favicon.ico new file mode 100644 index 000000000..c41fcdef6 Binary files /dev/null and b/packages/core/static/html/post-logout/favicon.ico differ diff --git a/packages/core/static/html/post-logout/index.html b/packages/core/static/html/post-logout/index.html new file mode 100644 index 000000000..90a0f25f1 --- /dev/null +++ b/packages/core/static/html/post-logout/index.html @@ -0,0 +1,145 @@ + + + + + + + + Sign Out + + +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + +
${message}
+
+ Powered By + + + + + + + + + + + + + + + +
+
+
+ +
+
+ + diff --git a/packages/phrases/src/locales/de/translation/index.ts b/packages/phrases/src/locales/de/translation/index.ts index c8894ec9c..d006e599f 100644 --- a/packages/phrases/src/locales/de/translation/index.ts +++ b/packages/phrases/src/locales/de/translation/index.ts @@ -1,9 +1,11 @@ import admin_console from './admin-console/index.js'; import demo_app from './demo-app.js'; +import oidc from './oidc.js'; const translation = { admin_console, demo_app, + oidc, }; export default translation; diff --git a/packages/phrases/src/locales/de/translation/oidc.ts b/packages/phrases/src/locales/de/translation/oidc.ts new file mode 100644 index 000000000..f3fa03599 --- /dev/null +++ b/packages/phrases/src/locales/de/translation/oidc.ts @@ -0,0 +1,5 @@ +const oidc = { + logout_success: 'You have successfully signed out.', // UNTRANSLATED +}; + +export default oidc; diff --git a/packages/phrases/src/locales/en/translation/index.ts b/packages/phrases/src/locales/en/translation/index.ts index c8894ec9c..d006e599f 100644 --- a/packages/phrases/src/locales/en/translation/index.ts +++ b/packages/phrases/src/locales/en/translation/index.ts @@ -1,9 +1,11 @@ import admin_console from './admin-console/index.js'; import demo_app from './demo-app.js'; +import oidc from './oidc.js'; const translation = { admin_console, demo_app, + oidc, }; export default translation; diff --git a/packages/phrases/src/locales/en/translation/oidc.ts b/packages/phrases/src/locales/en/translation/oidc.ts new file mode 100644 index 000000000..948457720 --- /dev/null +++ b/packages/phrases/src/locales/en/translation/oidc.ts @@ -0,0 +1,5 @@ +const oidc = { + logout_success: 'You have successfully signed out.', +}; + +export default oidc; diff --git a/packages/phrases/src/locales/fr/translation/index.ts b/packages/phrases/src/locales/fr/translation/index.ts index c8894ec9c..d006e599f 100644 --- a/packages/phrases/src/locales/fr/translation/index.ts +++ b/packages/phrases/src/locales/fr/translation/index.ts @@ -1,9 +1,11 @@ import admin_console from './admin-console/index.js'; import demo_app from './demo-app.js'; +import oidc from './oidc.js'; const translation = { admin_console, demo_app, + oidc, }; export default translation; diff --git a/packages/phrases/src/locales/fr/translation/oidc.ts b/packages/phrases/src/locales/fr/translation/oidc.ts new file mode 100644 index 000000000..f3fa03599 --- /dev/null +++ b/packages/phrases/src/locales/fr/translation/oidc.ts @@ -0,0 +1,5 @@ +const oidc = { + logout_success: 'You have successfully signed out.', // UNTRANSLATED +}; + +export default oidc; diff --git a/packages/phrases/src/locales/ko/translation/index.ts b/packages/phrases/src/locales/ko/translation/index.ts index c8894ec9c..d006e599f 100644 --- a/packages/phrases/src/locales/ko/translation/index.ts +++ b/packages/phrases/src/locales/ko/translation/index.ts @@ -1,9 +1,11 @@ import admin_console from './admin-console/index.js'; import demo_app from './demo-app.js'; +import oidc from './oidc.js'; const translation = { admin_console, demo_app, + oidc, }; export default translation; diff --git a/packages/phrases/src/locales/ko/translation/oidc.ts b/packages/phrases/src/locales/ko/translation/oidc.ts new file mode 100644 index 000000000..f3fa03599 --- /dev/null +++ b/packages/phrases/src/locales/ko/translation/oidc.ts @@ -0,0 +1,5 @@ +const oidc = { + logout_success: 'You have successfully signed out.', // UNTRANSLATED +}; + +export default oidc; diff --git a/packages/phrases/src/locales/pt-br/translation/index.ts b/packages/phrases/src/locales/pt-br/translation/index.ts index c8894ec9c..d006e599f 100644 --- a/packages/phrases/src/locales/pt-br/translation/index.ts +++ b/packages/phrases/src/locales/pt-br/translation/index.ts @@ -1,9 +1,11 @@ import admin_console from './admin-console/index.js'; import demo_app from './demo-app.js'; +import oidc from './oidc.js'; const translation = { admin_console, demo_app, + oidc, }; export default translation; diff --git a/packages/phrases/src/locales/pt-br/translation/oidc.ts b/packages/phrases/src/locales/pt-br/translation/oidc.ts new file mode 100644 index 000000000..f3fa03599 --- /dev/null +++ b/packages/phrases/src/locales/pt-br/translation/oidc.ts @@ -0,0 +1,5 @@ +const oidc = { + logout_success: 'You have successfully signed out.', // UNTRANSLATED +}; + +export default oidc; diff --git a/packages/phrases/src/locales/pt-pt/translation/index.ts b/packages/phrases/src/locales/pt-pt/translation/index.ts index c8894ec9c..d006e599f 100644 --- a/packages/phrases/src/locales/pt-pt/translation/index.ts +++ b/packages/phrases/src/locales/pt-pt/translation/index.ts @@ -1,9 +1,11 @@ import admin_console from './admin-console/index.js'; import demo_app from './demo-app.js'; +import oidc from './oidc.js'; const translation = { admin_console, demo_app, + oidc, }; export default translation; diff --git a/packages/phrases/src/locales/pt-pt/translation/oidc.ts b/packages/phrases/src/locales/pt-pt/translation/oidc.ts new file mode 100644 index 000000000..f3fa03599 --- /dev/null +++ b/packages/phrases/src/locales/pt-pt/translation/oidc.ts @@ -0,0 +1,5 @@ +const oidc = { + logout_success: 'You have successfully signed out.', // UNTRANSLATED +}; + +export default oidc; diff --git a/packages/phrases/src/locales/tr-tr/translation/index.ts b/packages/phrases/src/locales/tr-tr/translation/index.ts index c8894ec9c..d006e599f 100644 --- a/packages/phrases/src/locales/tr-tr/translation/index.ts +++ b/packages/phrases/src/locales/tr-tr/translation/index.ts @@ -1,9 +1,11 @@ import admin_console from './admin-console/index.js'; import demo_app from './demo-app.js'; +import oidc from './oidc.js'; const translation = { admin_console, demo_app, + oidc, }; export default translation; diff --git a/packages/phrases/src/locales/tr-tr/translation/oidc.ts b/packages/phrases/src/locales/tr-tr/translation/oidc.ts new file mode 100644 index 000000000..f3fa03599 --- /dev/null +++ b/packages/phrases/src/locales/tr-tr/translation/oidc.ts @@ -0,0 +1,5 @@ +const oidc = { + logout_success: 'You have successfully signed out.', // UNTRANSLATED +}; + +export default oidc; diff --git a/packages/phrases/src/locales/zh-cn/translation/index.ts b/packages/phrases/src/locales/zh-cn/translation/index.ts index c8894ec9c..d006e599f 100644 --- a/packages/phrases/src/locales/zh-cn/translation/index.ts +++ b/packages/phrases/src/locales/zh-cn/translation/index.ts @@ -1,9 +1,11 @@ import admin_console from './admin-console/index.js'; import demo_app from './demo-app.js'; +import oidc from './oidc.js'; const translation = { admin_console, demo_app, + oidc, }; export default translation; diff --git a/packages/phrases/src/locales/zh-cn/translation/oidc.ts b/packages/phrases/src/locales/zh-cn/translation/oidc.ts new file mode 100644 index 000000000..948457720 --- /dev/null +++ b/packages/phrases/src/locales/zh-cn/translation/oidc.ts @@ -0,0 +1,5 @@ +const oidc = { + logout_success: 'You have successfully signed out.', +}; + +export default oidc;