From ab4b98d14dbd67e978c406e5e852d1a273a33049 Mon Sep 17 00:00:00 2001 From: simeng-li Date: Fri, 24 Feb 2023 10:20:53 +0800 Subject: [PATCH] feat(core): update the OIDC post signout page (#3183) --- packages/core/src/oidc/init.ts | 10 ++ .../core/static/html/post-logout/favicon.ico | Bin 0 -> 15086 bytes .../core/static/html/post-logout/index.html | 145 ++++++++++++++++++ .../src/locales/de/translation/index.ts | 2 + .../src/locales/de/translation/oidc.ts | 5 + .../src/locales/en/translation/index.ts | 2 + .../src/locales/en/translation/oidc.ts | 5 + .../src/locales/fr/translation/index.ts | 2 + .../src/locales/fr/translation/oidc.ts | 5 + .../src/locales/ko/translation/index.ts | 2 + .../src/locales/ko/translation/oidc.ts | 5 + .../src/locales/pt-br/translation/index.ts | 2 + .../src/locales/pt-br/translation/oidc.ts | 5 + .../src/locales/pt-pt/translation/index.ts | 2 + .../src/locales/pt-pt/translation/oidc.ts | 5 + .../src/locales/tr-tr/translation/index.ts | 2 + .../src/locales/tr-tr/translation/oidc.ts | 5 + .../src/locales/zh-cn/translation/index.ts | 2 + .../src/locales/zh-cn/translation/oidc.ts | 5 + 19 files changed, 211 insertions(+) create mode 100644 packages/core/static/html/post-logout/favicon.ico create mode 100644 packages/core/static/html/post-logout/index.html create mode 100644 packages/phrases/src/locales/de/translation/oidc.ts create mode 100644 packages/phrases/src/locales/en/translation/oidc.ts create mode 100644 packages/phrases/src/locales/fr/translation/oidc.ts create mode 100644 packages/phrases/src/locales/ko/translation/oidc.ts create mode 100644 packages/phrases/src/locales/pt-br/translation/oidc.ts create mode 100644 packages/phrases/src/locales/pt-pt/translation/oidc.ts create mode 100644 packages/phrases/src/locales/tr-tr/translation/oidc.ts create mode 100644 packages/phrases/src/locales/zh-cn/translation/oidc.ts 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 0000000000000000000000000000000000000000..c41fcdef65a4848dd884fc996ffde8ca2c335b8b GIT binary patch literal 15086 zcmeHOX>e5MmF+1{m4C&PnyL9S<0?~AnHv9^5IMo)#2yojafHQU7O{v$fF#5kkN_dI zKr8|YY<9EQG8V+x5HR2s4-sGtVqYazNnm3z2%)9B)%&J9=X|eU_fvP? zT8ck-8h?XZOzC*?=j!n@?ee#;fBick$qSzF^;@3gO<6I_KVXg7H*jOQZ_wM7{vqWJ z{?zyU{$bl|0wZ?~_)G4DJUi_P=L=JkT)&-}>h3km?0%`B-1GAMO3y2c8a&BM#rx`V z@%CFKz5(k5_{BGHnzo(14XO6gg%@KERvv~RxiRX8V#hY9L{I3K5YT$oUe6MX1 z-{5zEe+%%xFM;8I1peLPAN}#F9}EB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Pnk@I MAM4ta_s|#pUzC;yfdBvi literal 0 HcmV?d00001 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;