@sbc-connect/nuxt-auth 0.8.1 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/app/components/Connect/Account/Create/index.vue +4 -2
- package/app/components/Connect/Modal/InvalidIdp.vue +2 -6
- package/app/middleware/03.app-config-presets.global.ts +0 -3
- package/app/middleware/04.idp-enforcement.global.ts +14 -24
- package/app/middleware/connect-auth.ts +3 -0
- package/app/pages/auth/account/select.vue +0 -3
- package/app/pages/auth/login.vue +5 -2
- package/app/stores/connect-account.ts +17 -4
- package/i18n/locales/en-CA.ts +7 -7
- package/package.json +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @sbc-connect/nuxt-auth
|
|
2
2
|
|
|
3
|
+
## 0.9.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#149](https://github.com/bcgov/connect-nuxt/pull/149) [`467e679`](https://github.com/bcgov/connect-nuxt/commit/467e679f8bf4b2f3b9ec2294fd28a2a6c5ef3dba) Thanks [@deetz99](https://github.com/deetz99)! - Update dependencies
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`467e679`](https://github.com/bcgov/connect-nuxt/commit/467e679f8bf4b2f3b9ec2294fd28a2a6c5ef3dba)]:
|
|
10
|
+
- @sbc-connect/nuxt-forms@0.7.1
|
|
11
|
+
- @sbc-connect/nuxt-base@0.7.2
|
|
12
|
+
|
|
13
|
+
## 0.9.0
|
|
14
|
+
|
|
15
|
+
### Minor Changes
|
|
16
|
+
|
|
17
|
+
- [#147](https://github.com/bcgov/connect-nuxt/pull/147) [`d96fef6`](https://github.com/bcgov/connect-nuxt/commit/d96fef61258f7749b8097aad9f1ae73bca3a0702) Thanks [@deetz99](https://github.com/deetz99)! - Fix IDP Enforcement modal being hidden by loading spinner
|
|
18
|
+
|
|
19
|
+
- [#146](https://github.com/bcgov/connect-nuxt/pull/146) [`32f2375`](https://github.com/bcgov/connect-nuxt/commit/32f23755ab656239730599f02d9802b491469d7e) Thanks [@cameron-eyds](https://github.com/cameron-eyds)! - Minor text and layout changes to Auth Login, Select and Create
|
|
20
|
+
|
|
3
21
|
## 0.8.1
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -5,7 +5,9 @@ import { getAccountCreateSchema } from '#auth/app/utils/schemas/account'
|
|
|
5
5
|
|
|
6
6
|
const statusCode = ref<number | undefined>(undefined)
|
|
7
7
|
|
|
8
|
-
const
|
|
8
|
+
const accountStore = useConnectAccountStore()
|
|
9
|
+
const { accountFormState, userFullName } = storeToRefs(accountStore)
|
|
10
|
+
const { submitCreateAccount } = accountStore
|
|
9
11
|
const accountProfileSchema = computed(() => getAccountCreateSchema(statusCode.value))
|
|
10
12
|
const formRef = useTemplateRef<Form<AccountProfileSchema>>('account-create-form')
|
|
11
13
|
|
|
@@ -59,7 +61,7 @@ watch(() => statusCode.value, async () => {
|
|
|
59
61
|
>
|
|
60
62
|
<!-- Legal Name -->
|
|
61
63
|
<ConnectFormFieldWrapper
|
|
62
|
-
:label="$t('connect.page.createAccount.
|
|
64
|
+
:label="$t('connect.page.createAccount.contactLabel')"
|
|
63
65
|
orientation="horizontal"
|
|
64
66
|
class="py-6 sm:py-8"
|
|
65
67
|
>
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
const props = defineProps<{
|
|
3
3
|
currentIdp: ConnectLoginSource
|
|
4
|
+
redirectUrl: string
|
|
4
5
|
}>()
|
|
5
|
-
const emit = defineEmits<{ close: [] }>()
|
|
6
|
-
|
|
7
|
-
function closeModal() {
|
|
8
|
-
emit('close')
|
|
9
|
-
}
|
|
10
6
|
</script>
|
|
11
7
|
|
|
12
8
|
<template>
|
|
@@ -36,7 +32,7 @@ function closeModal() {
|
|
|
36
32
|
:aria-label="$t('connect.label.logout')"
|
|
37
33
|
size="xl"
|
|
38
34
|
class="font-bold"
|
|
39
|
-
@click="
|
|
35
|
+
@click="useConnectAuth().logout(redirectUrl)"
|
|
40
36
|
/>
|
|
41
37
|
</div>
|
|
42
38
|
</div>
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import { useAppConfig } from '#imports'
|
|
2
|
-
import { useConnectAppConfig } from '#auth/app/composables/useConnectAppConfig'
|
|
3
|
-
|
|
4
1
|
export default defineNuxtRouteMiddleware((to) => {
|
|
5
2
|
const appConfig = useAppConfig()
|
|
6
3
|
const { mergeAppConfigOverrides } = useConnectAppConfig()
|
|
@@ -1,40 +1,30 @@
|
|
|
1
|
-
import { useConnectAuth } from '#auth/app/composables/useConnectAuth'
|
|
2
1
|
import { withQuery } from 'ufo'
|
|
3
|
-
import
|
|
4
|
-
import { useAppConfig } from '#imports'
|
|
5
|
-
// import { ConnectModalInvalidIdp } from '#components'
|
|
2
|
+
import { ConnectModalInvalidIdp } from '#components'
|
|
6
3
|
|
|
7
4
|
export default defineNuxtRouteMiddleware(async (to) => {
|
|
8
5
|
const localePath = useLocalePath()
|
|
9
6
|
const appConfig = useAppConfig()
|
|
10
|
-
const { authUser
|
|
7
|
+
const { authUser } = useConnectAuth()
|
|
11
8
|
|
|
12
9
|
// IDP Enforcement Config
|
|
13
10
|
const connectConfig = appConfig.connect as ConnectConfig
|
|
14
11
|
const idpEnforcement = connectConfig?.login?.idpEnforcement
|
|
15
12
|
const allowedIdps = connectConfig?.login?.idps
|
|
16
13
|
|
|
17
|
-
// Idp overlay
|
|
18
|
-
// const overlay = useOverlay()
|
|
19
|
-
// const modal = overlay.create(ConnectModalInvalidIdp)
|
|
20
|
-
|
|
21
|
-
/** Show Invalid IDP Modal and Logout on modal close */
|
|
22
|
-
async function showInvalidIdpModal() {
|
|
23
|
-
// Prompt user with invalid IDP modal
|
|
24
|
-
// FUTURE: Fix this in #32610. Currently it doesn't work - loading overlay covers it.
|
|
25
|
-
// await modal.open({ currentIdp: authUser.value?.loginSource })
|
|
26
|
-
|
|
27
|
-
// Logout and Preserve any query param
|
|
28
|
-
const pathWithQuery = withQuery(localePath('/auth/login'), to.query)
|
|
29
|
-
|
|
30
|
-
const url = `${window.location.origin}${pathWithQuery}`
|
|
31
|
-
return await logout(url)
|
|
32
|
-
}
|
|
33
|
-
|
|
34
14
|
if (idpEnforcement && authUser.value?.loginSource) {
|
|
35
|
-
// User's IDP is not allowed,
|
|
15
|
+
// User's IDP is not allowed, display idp enforcement modal
|
|
36
16
|
if (!allowedIdps?.includes(authUser.value?.loginSource.toLowerCase() as unknown as ConnectIdpHint)) {
|
|
37
|
-
|
|
17
|
+
// Pass redirect url to preserve any query params
|
|
18
|
+
const pathWithQuery = withQuery(localePath('/auth/login'), to.query)
|
|
19
|
+
const url = `${window.location.origin}${pathWithQuery}`
|
|
20
|
+
|
|
21
|
+
const overlay = useOverlay()
|
|
22
|
+
const modal = overlay.create(ConnectModalInvalidIdp)
|
|
23
|
+
|
|
24
|
+
modal.open({
|
|
25
|
+
currentIdp: authUser.value?.loginSource,
|
|
26
|
+
redirectUrl: url
|
|
27
|
+
})
|
|
38
28
|
}
|
|
39
29
|
}
|
|
40
30
|
})
|
|
@@ -29,6 +29,9 @@ export default defineNuxtRouteMiddleware(async (to) => {
|
|
|
29
29
|
const hasAccepted = data.value?.userTerms.isTermsOfUseAccepted
|
|
30
30
|
if (!hasAccepted && !isTosPage) {
|
|
31
31
|
const query = { ...to.query }
|
|
32
|
+
if (!query.return) {
|
|
33
|
+
query.return = `${rtc.baseUrl}${to.fullPath.slice(1)}`
|
|
34
|
+
}
|
|
32
35
|
return navigateTo({ path: localePath('/auth/terms-of-use'), query })
|
|
33
36
|
} else if (hasAccepted && (isTosPage || isLoginPage)) {
|
|
34
37
|
return finalRedirect(to, true)
|
|
@@ -46,9 +46,6 @@ const toggleCreateNewAccount = () => {
|
|
|
46
46
|
<ConnectTransitionFade>
|
|
47
47
|
<div class="space-y-6 sm:space-y-10">
|
|
48
48
|
<h1>{{ !addNew ? $t('connect.label.existingAccountFound') : $t('connect.label.sbcAccountCreation') }}</h1>
|
|
49
|
-
<p v-if="addNew">
|
|
50
|
-
{{ $t('connect.label.createNewAccountCont') }}
|
|
51
|
-
</p>
|
|
52
49
|
<ConnectAccountExistingAlert v-if="!addNew" />
|
|
53
50
|
</div>
|
|
54
51
|
</ConnectTransitionFade>
|
package/app/pages/auth/login.vue
CHANGED
|
@@ -46,7 +46,7 @@ const loginOptions = computed(() => {
|
|
|
46
46
|
|
|
47
47
|
<template>
|
|
48
48
|
<div class="flex grow flex-col items-center justify-center py-10">
|
|
49
|
-
<div class="flex flex-col items-center gap-
|
|
49
|
+
<div class="flex flex-col items-center gap-4">
|
|
50
50
|
<!-- Alert message from app config -->
|
|
51
51
|
<UAlert
|
|
52
52
|
v-if="ac.alert"
|
|
@@ -64,6 +64,9 @@ const loginOptions = computed(() => {
|
|
|
64
64
|
<h1>
|
|
65
65
|
{{ $t('connect.page.login.h1') }}
|
|
66
66
|
</h1>
|
|
67
|
+
<p class="max-w-[40rem]">
|
|
68
|
+
{{ $t('connect.page.login.description') }}
|
|
69
|
+
</p>
|
|
67
70
|
<UAlert
|
|
68
71
|
v-if="isSessionExpired"
|
|
69
72
|
color="warning"
|
|
@@ -73,7 +76,7 @@ const loginOptions = computed(() => {
|
|
|
73
76
|
icon="i-mdi-alert"
|
|
74
77
|
/>
|
|
75
78
|
<UCard
|
|
76
|
-
class="
|
|
79
|
+
class="mt-[12px] max-w-md"
|
|
77
80
|
data-testid="login-card"
|
|
78
81
|
>
|
|
79
82
|
<img
|
|
@@ -14,6 +14,7 @@ export const useConnectAccountStore = defineStore('connect-auth-account-store',
|
|
|
14
14
|
const currentAccountName = computed<string>(() => currentAccount.value?.label || '')
|
|
15
15
|
const pendingApprovalCount = ref<number>(0)
|
|
16
16
|
const user = computed(() => authUser.value)
|
|
17
|
+
const userEmail = ref<string>('')
|
|
17
18
|
const userFirstName = ref<string>(user.value?.firstName || '-')
|
|
18
19
|
const userLastName = ref<string>(user.value?.lastName || '')
|
|
19
20
|
const userFullName = computed(() => `${userFirstName.value} ${userLastName.value}`)
|
|
@@ -113,17 +114,26 @@ export const useConnectAccountStore = defineStore('connect-auth-account-store',
|
|
|
113
114
|
}
|
|
114
115
|
}
|
|
115
116
|
|
|
116
|
-
/** Set user name
|
|
117
|
+
/** Set user name and default email from profile */
|
|
117
118
|
async function setUserName() {
|
|
118
119
|
const { data, refresh } = await getAuthUserProfile()
|
|
119
120
|
await refresh()
|
|
120
121
|
if (data.value?.firstname && data.value?.lastname) {
|
|
121
122
|
userFirstName.value = data.value.firstname
|
|
122
123
|
userLastName.value = data.value.lastname
|
|
123
|
-
|
|
124
|
+
} else {
|
|
125
|
+
userFirstName.value = user.value?.firstName || '-'
|
|
126
|
+
userLastName.value = user.value?.lastName || ''
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// Pre-populate email from the user's existing contact if available
|
|
130
|
+
const contactEmail = data.value?.contacts?.[0]?.email
|
|
131
|
+
if (contactEmail) {
|
|
132
|
+
userEmail.value = contactEmail
|
|
133
|
+
if (!accountFormState.emailAddress) {
|
|
134
|
+
accountFormState.emailAddress = contactEmail
|
|
135
|
+
}
|
|
124
136
|
}
|
|
125
|
-
userFirstName.value = user.value?.firstName || '-'
|
|
126
|
-
userLastName.value = user.value?.lastName || ''
|
|
127
137
|
}
|
|
128
138
|
|
|
129
139
|
/** Get the user's account list */
|
|
@@ -229,6 +239,9 @@ export const useConnectAccountStore = defineStore('connect-auth-account-store',
|
|
|
229
239
|
|
|
230
240
|
function clearAccountState() {
|
|
231
241
|
Object.assign(accountFormState, createAccountProfileSchema.parse({}))
|
|
242
|
+
if (userEmail.value) {
|
|
243
|
+
accountFormState.emailAddress = userEmail.value
|
|
244
|
+
}
|
|
232
245
|
}
|
|
233
246
|
|
|
234
247
|
return {
|
package/i18n/locales/en-CA.ts
CHANGED
|
@@ -13,11 +13,10 @@ export default {
|
|
|
13
13
|
bcsc: 'BC Services Card',
|
|
14
14
|
createAccount: 'Create Account',
|
|
15
15
|
createNewAccount: 'Create New Account',
|
|
16
|
-
createNewAccountCont: 'Create a new account to continue',
|
|
17
16
|
decline: 'Decline',
|
|
18
17
|
declineTermsOfUse: 'Decline Terms of Use',
|
|
19
18
|
editProfile: 'Edit Profile',
|
|
20
|
-
existingAccountFound: '
|
|
19
|
+
existingAccountFound: 'Select Your Account or Create a New One',
|
|
21
20
|
idir: 'IDIR',
|
|
22
21
|
logout: 'Log out',
|
|
23
22
|
login: 'Log in',
|
|
@@ -38,9 +37,10 @@ export default {
|
|
|
38
37
|
login: {
|
|
39
38
|
h1: 'SBC Connect Account Login',
|
|
40
39
|
title: 'Log in - SBC Connect',
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
description: '',
|
|
41
|
+
loginBCSC: 'Continue with BC Services Card',
|
|
42
|
+
loginBCEID: 'Continue with BCeID',
|
|
43
|
+
loginIDIR: 'Continue with IDIR',
|
|
44
44
|
sessionExpiredAlert: {
|
|
45
45
|
title: 'Session Expired',
|
|
46
46
|
description: 'Your session has expired. Please log in again to continue.'
|
|
@@ -51,10 +51,10 @@ export default {
|
|
|
51
51
|
title: 'Terms of Use - Service BC Connect'
|
|
52
52
|
},
|
|
53
53
|
createAccount: {
|
|
54
|
-
|
|
54
|
+
contactLabel: 'Primary Contact',
|
|
55
55
|
yourNameHelp: 'This is your legal name as it appears on your BC Services Card.',
|
|
56
56
|
accountNameLabel: 'Account Name',
|
|
57
|
-
accountNameHelp: '
|
|
57
|
+
accountNameHelp: 'Create a unique name for your account e.g., Andy’s Business',
|
|
58
58
|
emailLabel: 'Email',
|
|
59
59
|
emailPlaceholder: 'Enter email address',
|
|
60
60
|
phoneLabel: 'Phone',
|
package/package.json
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sbc-connect/nuxt-auth",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.9.1",
|
|
5
5
|
"repository": "github:bcgov/connect-nuxt",
|
|
6
6
|
"license": "BSD-3-Clause",
|
|
7
7
|
"main": "./nuxt.config.ts",
|
|
8
8
|
"devDependencies": {
|
|
9
|
-
"@axe-core/playwright": "4.11.
|
|
10
|
-
"dotenv": "17.
|
|
9
|
+
"@axe-core/playwright": "4.11.1",
|
|
10
|
+
"dotenv": "17.3.1",
|
|
11
11
|
"nuxt": "4.2.2",
|
|
12
12
|
"typescript": "5.9.3",
|
|
13
|
-
"vue-tsc": "3.2.
|
|
13
|
+
"vue-tsc": "3.2.5",
|
|
14
14
|
"@sbc-connect/eslint-config": "0.0.8",
|
|
15
15
|
"@sbc-connect/playwright-config": "0.1.1",
|
|
16
|
-
"@sbc-connect/vitest-config": "0.1.
|
|
16
|
+
"@sbc-connect/vitest-config": "0.1.1"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@pinia/colada": "0.
|
|
20
|
-
"@pinia/colada-nuxt": "0.3.
|
|
19
|
+
"@pinia/colada": "1.0.0",
|
|
20
|
+
"@pinia/colada-nuxt": "0.3.2",
|
|
21
21
|
"@pinia/nuxt": "0.11.3",
|
|
22
|
-
"keycloak-js": "26.2.
|
|
22
|
+
"keycloak-js": "26.2.3",
|
|
23
23
|
"pinia": "3.0.4",
|
|
24
24
|
"pinia-plugin-persistedstate": "4.7.1",
|
|
25
|
-
"@sbc-connect/nuxt-base": "0.7.
|
|
26
|
-
"@sbc-connect/nuxt-forms": "0.7.
|
|
25
|
+
"@sbc-connect/nuxt-base": "0.7.2",
|
|
26
|
+
"@sbc-connect/nuxt-forms": "0.7.1"
|
|
27
27
|
},
|
|
28
28
|
"scripts": {
|
|
29
29
|
"preinstall": "npx only-allow pnpm",
|