From 7aa75df87d73f18b21698d97101b6ea264333c65 Mon Sep 17 00:00:00 2001 From: deetz99 Date: Thu, 12 Dec 2024 11:41:23 -0800 Subject: [PATCH 1/3] update base login page, add bceid to hosts --- strr-base-web/app/app.config.ts | 21 +---- strr-base-web/app/locales/en-CA.ts | 8 +- strr-base-web/app/pages/auth/login.vue | 79 +++++++++++-------- .../app/types/strr-base-app-config.d.ts | 39 +++++++++ strr-host-pm-web/app/app.config.ts | 27 ++++++- strr-host-pm-web/app/locales/en-CA.ts | 3 +- .../app/middleware/choose-account-page.ts | 3 +- .../app/middleware/create-account-page.ts | 8 ++ .../pages/auth/account/choose-existing.vue | 4 +- .../app/pages/auth/account/create-new.vue | 2 +- strr-host-pm-web/nuxt.config.ts | 4 +- strr-host-pm-web/package.json | 2 +- 12 files changed, 138 insertions(+), 62 deletions(-) create mode 100644 strr-base-web/app/types/strr-base-app-config.d.ts create mode 100644 strr-host-pm-web/app/middleware/create-account-page.ts diff --git a/strr-base-web/app/app.config.ts b/strr-base-web/app/app.config.ts index 04c07f1d1..c3fef9d2d 100644 --- a/strr-base-web/app/app.config.ts +++ b/strr-base-web/app/app.config.ts @@ -6,7 +6,10 @@ export default defineAppConfig({ redirectPath: '', options: { createAccount: true, - idps: ['bcsc', 'bceid', 'idir'] + idps: ['bcsc', 'bceid', 'idir'], + bcscSubtext: undefined, + bceidSubtext: undefined, + idirSubtext: undefined } } } @@ -95,19 +98,3 @@ export default defineAppConfig({ } } }) - -declare module 'nuxt/schema' { - interface AppConfig { - strrBaseLayer: { - page: { - login: { - redirectPath: string, - options: { - createAccount: boolean, - idps: Array<'bcsc' | 'bceid' | 'idir'> - } - } - } - } - } -} diff --git a/strr-base-web/app/locales/en-CA.ts b/strr-base-web/app/locales/en-CA.ts index edc3c0b06..ceecd6305 100644 --- a/strr-base-web/app/locales/en-CA.ts +++ b/strr-base-web/app/locales/en-CA.ts @@ -253,9 +253,9 @@ export default { platAppStepLabel: 'Platform Application Step Navigation', stepUnfinished: 'This step is unfinished.', returnStepToFinish: 'Return to this step to finish it', - loginBceid: 'Log in with BCeID', - loginBcsc: 'Log in with BC Services Card', - loginIdir: 'Log in with IDIR', + continueBceid: 'Continue with BCeID', + continueBcsc: 'Continue with BC Services Card', + continueIdir: 'Continue with IDIR', // Each app could overwrite this if they wanted login: 'Login', selectAccount: 'Select Account', @@ -364,7 +364,7 @@ export default { }, login: { // Each app could overwrite this if they wanted. Default would be different - h1: 'Log In to Short-Term Rental Registry' + h1: 'Short-Term Rental Registry' }, tos: { title: 'Terms of Use - Short Term Rental Registry', diff --git a/strr-base-web/app/pages/auth/login.vue b/strr-base-web/app/pages/auth/login.vue index 8f3f87234..ce4aa433e 100644 --- a/strr-base-web/app/pages/auth/login.vue +++ b/strr-base-web/app/pages/auth/login.vue @@ -11,17 +11,20 @@ const redirectUrl = loginConfig.redirectPath const loginOptionsMap = { bcsc: { - label: t('label.loginBcsc'), + label: t('label.continueBcsc'), + subtext: loginConfig.options.bcscSubtext, icon: 'i-mdi-account-card-details-outline', click: () => keycloak.login(IdpHint.BCSC, redirectUrl) }, bceid: { - label: t('label.loginBceid'), + label: t('label.continueBceid'), + subtext: loginConfig.options.bceidSubtext, icon: 'i-mdi-two-factor-authentication', click: () => keycloak.login(IdpHint.BCEID, redirectUrl) }, idir: { - label: t('label.loginIdir'), + label: t('label.continueIdir'), + subtext: loginConfig.options.idirSubtext, icon: 'i-mdi-account-group-outline', click: () => keycloak.login(IdpHint.IDIR, redirectUrl) } @@ -51,37 +54,49 @@ onMounted(() => { }) diff --git a/strr-base-web/app/types/strr-base-app-config.d.ts b/strr-base-web/app/types/strr-base-app-config.d.ts new file mode 100644 index 000000000..4e23d3a84 --- /dev/null +++ b/strr-base-web/app/types/strr-base-app-config.d.ts @@ -0,0 +1,39 @@ +declare module 'nuxt/schema' { + interface AppConfigInput { + strrBaseLayer: { + page: { + login: { + redirectPath: string, + options: { + createAccount: boolean, + idps: Array<'bcsc' | 'bceid' | 'idir'>, + bcscSubtext: string | undefined, + bceidSubtext: string | undefined, + idirSubtext: string | undefined + } + } + } + } + } +} + +declare module 'nuxt/schema' { + interface AppConfig { + strrBaseLayer: { + page: { + login: { + redirectPath: string, + options: { + createAccount: boolean, + idps: Array<'bcsc' | 'bceid' | 'idir'>, + bcscSubtext: string | undefined, + bceidSubtext: string | undefined, + idirSubtext: string | undefined + } + } + } + } + } +} + +export {} \ No newline at end of file diff --git a/strr-host-pm-web/app/app.config.ts b/strr-host-pm-web/app/app.config.ts index e5a62aaef..4ffff9146 100644 --- a/strr-host-pm-web/app/app.config.ts +++ b/strr-host-pm-web/app/app.config.ts @@ -1,11 +1,34 @@ export default defineAppConfig({ + connect: { + core: { + login: { + redirectPath: '', + idps: () => [] + }, + header: { + options: { + localeSelect: false, + unauthenticated: { + whatsNew: false, + loginMenu: false, + createAccount: false + }, + authenticated: { + notifications: true, + accountOptionsMenu: true + } + } + } + } + }, strrBaseLayer: { page: { login: { redirectPath: '/auth/account/choose-existing', options: { - createAccount: true, - idps: () => ['bcsc'] // function required to overwrite default value, will merge if no function + createAccount: false, + idps: () => ['bcsc', 'bceid'], // function required to overwrite default value, will merge if no function + bceidSubtext: 'text.bceidSubtext' } } } diff --git a/strr-host-pm-web/app/locales/en-CA.ts b/strr-host-pm-web/app/locales/en-CA.ts index de13aebb1..09368abf1 100644 --- a/strr-host-pm-web/app/locales/en-CA.ts +++ b/strr-host-pm-web/app/locales/en-CA.ts @@ -365,7 +365,8 @@ export default { unitAddressIntro: 'Include the Residential Address of your short-term rental by looking up the address, or if the address cannot be found in the lookup, you can enter the address manually.', unitAddressIntroNote: 'Note: the address cannot be a Mailing Address (e.g., PO Box, etc.).', unitAddressUnitNumberInfo: 'Unit Number is required if the short-term rental unit has a Unit Number. Enter a Site Name if the address does not have a Street Number and Name.', - noDocsUploaded: 'No supporting documentation uploaded.' + noDocsUploaded: 'No supporting documentation uploaded.', + bceidSubtext: 'Requires an existing BCeID login account' }, hint: { strataRefCode: 'This is a unique code for each registered strata hotel. Ask the strata hotel management for this code.', diff --git a/strr-host-pm-web/app/middleware/choose-account-page.ts b/strr-host-pm-web/app/middleware/choose-account-page.ts index 238076a69..fbe4f279f 100644 --- a/strr-host-pm-web/app/middleware/choose-account-page.ts +++ b/strr-host-pm-web/app/middleware/choose-account-page.ts @@ -1,8 +1,9 @@ export default defineNuxtRouteMiddleware(() => { const accountStore = useConnectAccountStore() const localePath = useLocalePath() + const { kcUser } = useKeycloak() - if (accountStore.userAccounts.length === 0) { + if (accountStore.userAccounts.length === 0 && kcUser.value.loginSource !== LoginSource.BCEID) { return navigateTo({ path: localePath('/auth/account/create-new') }) // TODO: add return url param for redirect? } }) diff --git a/strr-host-pm-web/app/middleware/create-account-page.ts b/strr-host-pm-web/app/middleware/create-account-page.ts new file mode 100644 index 000000000..5ce1992c8 --- /dev/null +++ b/strr-host-pm-web/app/middleware/create-account-page.ts @@ -0,0 +1,8 @@ +export default defineNuxtRouteMiddleware(() => { + const { kcUser } = useKeycloak() + + if (kcUser.value.loginSource !== LoginSource.BCSC) { + const localePath = useLocalePath() + return navigateTo({ path: localePath('/auth/account/choose-existing') }) + } +}) \ No newline at end of file diff --git a/strr-host-pm-web/app/pages/auth/account/choose-existing.vue b/strr-host-pm-web/app/pages/auth/account/choose-existing.vue index 668ef965c..bdc74ebb6 100644 --- a/strr-host-pm-web/app/pages/auth/account/choose-existing.vue +++ b/strr-host-pm-web/app/pages/auth/account/choose-existing.vue @@ -137,7 +137,9 @@ function handleAccountSwitch (id: string) { icon="i-mdi-chevron-right" trailing :block="isSmallScreen" - :to="localePath('/auth/account/create-new')" + :to="$keycloak.tokenParsed.loginSource === LoginSource.BCSC ? localePath('/auth/account/create-new') : useConnectNav().createAccountUrl()" + :external="$keycloak.tokenParsed.loginSource !== LoginSource.BCSC" + :target="$keycloak.tokenParsed.loginSource === LoginSource.BCSC ? '_self' : '_blank'" /> diff --git a/strr-host-pm-web/app/pages/auth/account/create-new.vue b/strr-host-pm-web/app/pages/auth/account/create-new.vue index 3a029b3be..0b44ed3e0 100644 --- a/strr-host-pm-web/app/pages/auth/account/create-new.vue +++ b/strr-host-pm-web/app/pages/auth/account/create-new.vue @@ -91,7 +91,7 @@ useHead({ }) definePageMeta({ - middleware: ['auth', 'check-tos'], + middleware: ['auth', 'check-tos', 'create-account-page'], hideBreadcrumbs: true }) diff --git a/strr-host-pm-web/nuxt.config.ts b/strr-host-pm-web/nuxt.config.ts index ca8647626..079470c61 100644 --- a/strr-host-pm-web/nuxt.config.ts +++ b/strr-host-pm-web/nuxt.config.ts @@ -39,8 +39,8 @@ export default defineNuxtConfig({ }, extends: [ - // '../strr-base-web' // dev only - ['github:bcgov/STRR/strr-base-web', { install: true }] + '../strr-base-web' // dev only + // ['github:bcgov/STRR/strr-base-web', { install: true }] ], imports: { diff --git a/strr-host-pm-web/package.json b/strr-host-pm-web/package.json index c6ad40351..b9ceed25d 100644 --- a/strr-host-pm-web/package.json +++ b/strr-host-pm-web/package.json @@ -2,7 +2,7 @@ "name": "strr-host-pm-web", "private": true, "type": "module", - "version": "0.0.5", + "version": "0.0.6", "scripts": { "build-check": "nuxt build", "build": "nuxt generate", From 27cf5ed1344af1d8bb4c3ecb1d598e44386f2065 Mon Sep 17 00:00:00 2001 From: deetz99 Date: Thu, 12 Dec 2024 11:47:56 -0800 Subject: [PATCH 2/3] update login screen for platform and strata --- strr-host-pm-web/nuxt.config.ts | 4 ++-- strr-platform-web/app/app.config.ts | 22 ++++++++++++++++++++ strr-platform-web/package.json | 2 +- strr-strata-web/app/app.config.ts | 32 ++++++++++++++++++++++++----- strr-strata-web/package.json | 2 +- 5 files changed, 53 insertions(+), 9 deletions(-) diff --git a/strr-host-pm-web/nuxt.config.ts b/strr-host-pm-web/nuxt.config.ts index 079470c61..ca8647626 100644 --- a/strr-host-pm-web/nuxt.config.ts +++ b/strr-host-pm-web/nuxt.config.ts @@ -39,8 +39,8 @@ export default defineNuxtConfig({ }, extends: [ - '../strr-base-web' // dev only - // ['github:bcgov/STRR/strr-base-web', { install: true }] + // '../strr-base-web' // dev only + ['github:bcgov/STRR/strr-base-web', { install: true }] ], imports: { diff --git a/strr-platform-web/app/app.config.ts b/strr-platform-web/app/app.config.ts index ab98cb378..898c6df8e 100644 --- a/strr-platform-web/app/app.config.ts +++ b/strr-platform-web/app/app.config.ts @@ -1,4 +1,26 @@ export default defineAppConfig({ + connect: { + core: { + login: { + redirectPath: '', + idps: () => [] + }, + header: { + options: { + localeSelect: false, + unauthenticated: { + whatsNew: false, + loginMenu: false, + createAccount: false + }, + authenticated: { + notifications: true, + accountOptionsMenu: true + } + } + } + } + }, strrBaseLayer: { page: { login: { diff --git a/strr-platform-web/package.json b/strr-platform-web/package.json index c65fb6d9c..3a9892ca2 100644 --- a/strr-platform-web/package.json +++ b/strr-platform-web/package.json @@ -2,7 +2,7 @@ "name": "strr-platform-web", "private": true, "type": "module", - "version": "0.0.19", + "version": "0.0.20", "scripts": { "build-check": "nuxt build", "build": "nuxt generate", diff --git a/strr-strata-web/app/app.config.ts b/strr-strata-web/app/app.config.ts index 096399d3c..29a9b5065 100644 --- a/strr-strata-web/app/app.config.ts +++ b/strr-strata-web/app/app.config.ts @@ -1,12 +1,34 @@ export default defineAppConfig({ + connect: { + core: { + login: { + redirectPath: '', + idps: () => [] + }, + header: { + options: { + localeSelect: false, + unauthenticated: { + whatsNew: false, + loginMenu: false, + createAccount: false + }, + authenticated: { + notifications: true, + accountOptionsMenu: true + } + } + } + } + }, strrBaseLayer: { page: { login: { - redirectPath: '/auth/account/choose-existing' - // options: { // allow all options? - // createAccount: false, - // idps: () => ['bceid', 'bcsc'] // function required to overwrite default value, will merge if no function - // } + redirectPath: '/auth/account/choose-existing', + options: { + createAccount: false, + idps: () => ['bcsc', 'bceid', 'idir'] // function required to overwrite default value, will merge if no function + } } } }, diff --git a/strr-strata-web/package.json b/strr-strata-web/package.json index b4365dbfe..608d8838c 100644 --- a/strr-strata-web/package.json +++ b/strr-strata-web/package.json @@ -2,7 +2,7 @@ "name": "strr-strata-web", "private": true, "type": "module", - "version": "0.0.15", + "version": "0.0.16", "scripts": { "build-check": "nuxt build", "build": "nuxt generate", From 7365dc38168394828f25f3ae8f0a3193dd2a151f Mon Sep 17 00:00:00 2001 From: deetz99 Date: Thu, 12 Dec 2024 11:58:58 -0800 Subject: [PATCH 3/3] middleware update --- strr-host-pm-web/app/middleware/choose-account-page.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/strr-host-pm-web/app/middleware/choose-account-page.ts b/strr-host-pm-web/app/middleware/choose-account-page.ts index fbe4f279f..502b2cd2a 100644 --- a/strr-host-pm-web/app/middleware/choose-account-page.ts +++ b/strr-host-pm-web/app/middleware/choose-account-page.ts @@ -3,7 +3,7 @@ export default defineNuxtRouteMiddleware(() => { const localePath = useLocalePath() const { kcUser } = useKeycloak() - if (accountStore.userAccounts.length === 0 && kcUser.value.loginSource !== LoginSource.BCEID) { + if (accountStore.userAccounts.length === 0 && kcUser.value.loginSource === LoginSource.BCSC) { return navigateTo({ path: localePath('/auth/account/create-new') }) // TODO: add return url param for redirect? } })