@sowell/quasar-app-extension-auth 1.1.0 → 1.1.2
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/package.json +2 -1
- package/src/boot/axios.ts +0 -1
- package/src/boot/register.ts +0 -1
- package/src/boot/router.ts +0 -1
- package/src/boot/store.ts +0 -1
- package/src/components/dialogs/Message.vue +32 -32
- package/src/components/pages/AdminAuth.vue +0 -2
- package/src/components/pages/Auth.vue +6 -11
- package/src/components/pages/AuthReporter.vue +32 -41
- package/src/components/pages/OtpValidation.vue +0 -2
- package/src/components/pages/ResetPassword.vue +0 -2
- package/src/components/pages/WebAuth.vue +42 -43
- package/src/composables/auth.ts +2 -2
- package/src/routes/index.ts +0 -4
- package/tsconfig.json +4 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sowell/quasar-app-extension-auth",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "A Quasar app extension to manage Authentication",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"repository": "https://github.com/sowell-ai/quasar.extension.auth",
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"yarn": ">= 1.6.0"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
+
"@quasar/app-webpack": "^4.0.0-beta.16",
|
|
24
25
|
"@quasar/cli": "^2.2.3",
|
|
25
26
|
"@types/node": "^16.9.1",
|
|
26
27
|
"@types/validator": "^13.6.3",
|
package/src/boot/axios.ts
CHANGED
package/src/boot/register.ts
CHANGED
package/src/boot/router.ts
CHANGED
package/src/boot/store.ts
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<q-card
|
|
2
|
+
<q-card
|
|
3
|
+
style="max-width: 343px; border-radius: 10px; background: #f4f5f6"
|
|
4
|
+
data-testid="feedback-dialog">
|
|
3
5
|
<q-card-section class="text-center q-mt-lg">
|
|
4
6
|
<img
|
|
5
7
|
v-if="emailSended"
|
|
6
8
|
src="../../assets/mailbox.svg"
|
|
7
|
-
style="width: 175px; height: 150px"
|
|
8
|
-
/>
|
|
9
|
+
style="width: 175px; height: 150px" />
|
|
9
10
|
<img
|
|
10
11
|
v-if="passwordUpdated"
|
|
11
12
|
src="../../assets/success.svg"
|
|
12
|
-
style="width: 100px; height: 80px"
|
|
13
|
-
/>
|
|
13
|
+
style="width: 100px; height: 80px" />
|
|
14
14
|
<img
|
|
15
15
|
v-if="emailNotSend"
|
|
16
16
|
src="../../assets/error.svg"
|
|
17
|
-
style="width: 100px; height: 80px"
|
|
18
|
-
/>
|
|
17
|
+
style="width: 100px; height: 80px" />
|
|
19
18
|
</q-card-section>
|
|
20
19
|
|
|
21
20
|
<q-card-section class="q-pt-none q-pl-lg q-pr-lg">
|
|
@@ -23,29 +22,26 @@
|
|
|
23
22
|
class="text-subtitle1 q-mt-sm q-mb-md text-center text-dark"
|
|
24
23
|
style="font-size: 24px; font-weight: 600"
|
|
25
24
|
data-cy="resetErrorMessage"
|
|
26
|
-
data-testid="header-dialog"
|
|
27
|
-
>
|
|
25
|
+
data-testid="header-dialog">
|
|
28
26
|
{{ messageTitle }}
|
|
29
27
|
</div>
|
|
30
28
|
<div
|
|
31
29
|
data-cy="resetMessage"
|
|
32
30
|
data-testid="message-dialog"
|
|
33
31
|
class="text-subtitle1 q-mt-sm text-center"
|
|
34
|
-
style="font-size: 16px; font-weight: 400"
|
|
35
|
-
>
|
|
32
|
+
style="font-size: 16px; font-weight: 400">
|
|
36
33
|
{{ messageSubtitle }}
|
|
37
34
|
</div>
|
|
38
35
|
<div
|
|
39
36
|
class="q-mt-sm text-center q-mb-xl"
|
|
40
37
|
style="font-size: 15px; color: #737676"
|
|
41
|
-
v-if="
|
|
42
|
-
>
|
|
38
|
+
v-if="sendEmailCode === 200">
|
|
43
39
|
{{ emailResetPassword }}
|
|
44
40
|
</div>
|
|
45
41
|
</q-card-section>
|
|
46
42
|
<q-card-actions class="q-ml-lg q-mr-lg q-mb-lg">
|
|
47
43
|
<q-btn
|
|
48
|
-
v-if="emailNotSend"
|
|
44
|
+
v-if="emailNotSend && sendEmailCode !== 403"
|
|
49
45
|
data-cy="submit-login"
|
|
50
46
|
:label="$t('auth.reSend')"
|
|
51
47
|
color="primary"
|
|
@@ -55,8 +51,7 @@
|
|
|
55
51
|
unelevated
|
|
56
52
|
type="submit"
|
|
57
53
|
@click="retypeEmail"
|
|
58
|
-
class="full-width"
|
|
59
|
-
/>
|
|
54
|
+
class="full-width" />
|
|
60
55
|
<slot>
|
|
61
56
|
<q-btn
|
|
62
57
|
data-testid="close-btn"
|
|
@@ -68,24 +63,23 @@
|
|
|
68
63
|
no-caps
|
|
69
64
|
:label="$t('auth.close')"
|
|
70
65
|
color="dark"
|
|
71
|
-
v-close-popup
|
|
72
|
-
/>
|
|
66
|
+
v-close-popup />
|
|
73
67
|
</slot>
|
|
74
68
|
</q-card-actions>
|
|
75
69
|
</q-card>
|
|
76
70
|
</template>
|
|
77
71
|
|
|
78
72
|
<script lang="ts">
|
|
79
|
-
import { defineComponent, computed } from "vue"
|
|
80
|
-
import { useI18n } from "vue-i18n"
|
|
73
|
+
import { defineComponent, computed } from "vue"
|
|
74
|
+
import { useI18n } from "vue-i18n"
|
|
81
75
|
|
|
82
76
|
export default defineComponent({
|
|
83
77
|
props: {
|
|
84
78
|
emailResetPassword: {
|
|
85
79
|
type: String
|
|
86
80
|
},
|
|
87
|
-
|
|
88
|
-
type:
|
|
81
|
+
sendEmailCode: {
|
|
82
|
+
type: Number
|
|
89
83
|
},
|
|
90
84
|
loading: {
|
|
91
85
|
type: Boolean
|
|
@@ -98,34 +92,40 @@ export default defineComponent({
|
|
|
98
92
|
setup(props: any, { emit }: any) {
|
|
99
93
|
const { t } = useI18n()
|
|
100
94
|
|
|
101
|
-
const messageSubtitle = computed(() =>
|
|
102
|
-
props.
|
|
95
|
+
const messageSubtitle = computed(() => {
|
|
96
|
+
if (props.sendEmailCode === 403) {
|
|
97
|
+
return t("auth.forbidden.subtitle")
|
|
98
|
+
}
|
|
99
|
+
return props.sendEmailCode === 200
|
|
103
100
|
? t("auth.emailSent")
|
|
104
101
|
: !props.passwordUpdated
|
|
105
102
|
? t("auth.emailNotRecognize")
|
|
106
103
|
: t("auth.passwordUpdated")
|
|
107
|
-
)
|
|
108
|
-
const messageTitle = computed(() =>
|
|
109
|
-
props.
|
|
104
|
+
})
|
|
105
|
+
const messageTitle = computed(() => {
|
|
106
|
+
if (props.sendEmailCode === 403) {
|
|
107
|
+
return t("auth.forbidden.title")
|
|
108
|
+
}
|
|
109
|
+
return props.sendEmailCode === 200
|
|
110
110
|
? t("auth.emailVerification")
|
|
111
111
|
: !props.passwordUpdated
|
|
112
112
|
? t("auth.loginFailed")
|
|
113
113
|
: t("auth.passwordChanged")
|
|
114
|
-
)
|
|
114
|
+
})
|
|
115
115
|
|
|
116
116
|
const emailNotSend = computed(
|
|
117
|
-
() =>
|
|
117
|
+
() => props.sendEmailCode !== 200 && !props.passwordUpdated
|
|
118
118
|
)
|
|
119
119
|
const emailSended = computed(
|
|
120
|
-
() => props.
|
|
120
|
+
() => props.sendEmailCode === 200 && !props.passwordUpdated
|
|
121
121
|
)
|
|
122
122
|
|
|
123
123
|
const retypeEmail = () => {
|
|
124
124
|
emit("retypeEmail")
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
const handlePasswordUpdate = () =>{
|
|
128
|
-
if(props.passwordUpdated){
|
|
127
|
+
const handlePasswordUpdate = () => {
|
|
128
|
+
if (props.passwordUpdated) {
|
|
129
129
|
emit("goToLoginPage")
|
|
130
130
|
} else {
|
|
131
131
|
emit("close")
|
|
@@ -119,8 +119,6 @@
|
|
|
119
119
|
</template>
|
|
120
120
|
|
|
121
121
|
<script lang="ts">
|
|
122
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
123
|
-
//@ts-ignore
|
|
124
122
|
import { defineComponent, ref, computed } from "vue"
|
|
125
123
|
import { useI18n } from "vue-i18n"
|
|
126
124
|
import isEmail from "validator/es/lib/isEmail"
|
|
@@ -134,7 +134,7 @@
|
|
|
134
134
|
<q-dialog v-model="isReset" persistent>
|
|
135
135
|
<sowell-message
|
|
136
136
|
:emailResetPassword="emailResetPassword"
|
|
137
|
-
:
|
|
137
|
+
:sendEmailCode="sendEmailCode"
|
|
138
138
|
:loading="loading"
|
|
139
139
|
@retypeEmail="retypeEmail"
|
|
140
140
|
@close="() => isReset= false"/>
|
|
@@ -154,20 +154,15 @@
|
|
|
154
154
|
</template>
|
|
155
155
|
|
|
156
156
|
<script lang="ts">
|
|
157
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
158
|
-
//@ts-ignore
|
|
159
157
|
import { defineComponent, reactive, onMounted } from "vue"
|
|
160
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
161
|
-
//@ts-ignore
|
|
162
158
|
import * as packageInfo from "app/package.json"
|
|
163
159
|
|
|
164
160
|
import SendEmail from "../dialogs/SendEmail.vue"
|
|
165
161
|
import SowellMessage from "../dialogs/Message.vue"
|
|
166
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
167
|
-
//@ts-ignore
|
|
168
162
|
import MicrosoftLogo from "../../assets/logo-microsoft.svg"
|
|
169
163
|
|
|
170
164
|
import { useAuth } from "composables/auth"
|
|
165
|
+
import { send } from "process"
|
|
171
166
|
|
|
172
167
|
export default defineComponent({
|
|
173
168
|
name: "Auth",
|
|
@@ -183,7 +178,7 @@ export default defineComponent({
|
|
|
183
178
|
forgottenPassword,
|
|
184
179
|
emailResetPassword,
|
|
185
180
|
isReset,
|
|
186
|
-
|
|
181
|
+
sendEmailCode,
|
|
187
182
|
authState,
|
|
188
183
|
APP_SERVER_BASE_URL,
|
|
189
184
|
icons,
|
|
@@ -207,11 +202,11 @@ export default defineComponent({
|
|
|
207
202
|
try {
|
|
208
203
|
forgottenPassword.value = false
|
|
209
204
|
await authState.resetPassword(data).then(() => {
|
|
210
|
-
|
|
205
|
+
sendEmailCode.value = 200
|
|
211
206
|
isReset.value = true
|
|
212
207
|
})
|
|
213
208
|
} catch {
|
|
214
|
-
|
|
209
|
+
sendEmailCode.value = 404
|
|
215
210
|
isReset.value = true
|
|
216
211
|
}
|
|
217
212
|
}
|
|
@@ -234,7 +229,7 @@ export default defineComponent({
|
|
|
234
229
|
forgottenPassword,
|
|
235
230
|
emailResetPassword,
|
|
236
231
|
isReset,
|
|
237
|
-
|
|
232
|
+
sendEmailCode,
|
|
238
233
|
icons,
|
|
239
234
|
appVersion,
|
|
240
235
|
USE_SSO,
|
|
@@ -7,13 +7,11 @@
|
|
|
7
7
|
<img
|
|
8
8
|
src="../../assets/Logo.svg"
|
|
9
9
|
class="q-mb-sm q-mr-md"
|
|
10
|
-
style="width: 27px; height: 47px"
|
|
11
|
-
/>
|
|
10
|
+
style="width: 27px; height: 47px" />
|
|
12
11
|
<img
|
|
13
12
|
src="../../assets/Sowell.svg"
|
|
14
13
|
class="q-mb-sm"
|
|
15
|
-
style="width: 146px; height: 38px"
|
|
16
|
-
/>
|
|
14
|
+
style="width: 146px; height: 38px" />
|
|
17
15
|
</div>
|
|
18
16
|
</div>
|
|
19
17
|
<div class="login-page">
|
|
@@ -21,8 +19,7 @@
|
|
|
21
19
|
<div>
|
|
22
20
|
<div
|
|
23
21
|
class="q-ml-xs q-mb-xs"
|
|
24
|
-
style="font-size: 14px; font-weight: 600"
|
|
25
|
-
>
|
|
22
|
+
style="font-size: 14px; font-weight: 600">
|
|
26
23
|
{{ $t("auth.email") }}
|
|
27
24
|
</div>
|
|
28
25
|
<q-input
|
|
@@ -32,8 +29,7 @@
|
|
|
32
29
|
borderless
|
|
33
30
|
:rules="validations['email']"
|
|
34
31
|
lazy-rules
|
|
35
|
-
:input-style="{ fontSize: '14px', fontWeight: '500' }"
|
|
36
|
-
>
|
|
32
|
+
:input-style="{ fontSize: '14px', fontWeight: '500' }">
|
|
37
33
|
<template #prepend>
|
|
38
34
|
<q-icon :name="icons.ionMailOutline" />
|
|
39
35
|
</template>
|
|
@@ -42,8 +38,7 @@
|
|
|
42
38
|
<div>
|
|
43
39
|
<div
|
|
44
40
|
class="q-ml-xs q-mb-xs"
|
|
45
|
-
style="font-size: 14px; font-weight: 600"
|
|
46
|
-
>
|
|
41
|
+
style="font-size: 14px; font-weight: 600">
|
|
47
42
|
{{ $t("auth.password") }}
|
|
48
43
|
</div>
|
|
49
44
|
<q-input
|
|
@@ -54,8 +49,7 @@
|
|
|
54
49
|
lazy-rules
|
|
55
50
|
borderless
|
|
56
51
|
dense
|
|
57
|
-
:input-style="{ fontSize: '14px', fontWeight: '600' }"
|
|
58
|
-
>
|
|
52
|
+
:input-style="{ fontSize: '14px', fontWeight: '600' }">
|
|
59
53
|
<template #prepend>
|
|
60
54
|
<q-icon :name="icons.ionLockClosedOutline" />
|
|
61
55
|
</template>
|
|
@@ -67,15 +61,13 @@
|
|
|
67
61
|
: icons.ionEyeOutline
|
|
68
62
|
"
|
|
69
63
|
class="cursor-pointer q-mr-sm"
|
|
70
|
-
@click="showPassword = !showPassword"
|
|
71
|
-
/>
|
|
64
|
+
@click="showPassword = !showPassword" />
|
|
72
65
|
</template>
|
|
73
66
|
</q-input>
|
|
74
67
|
</div>
|
|
75
68
|
<div
|
|
76
69
|
v-if="errorEmailMessage || errorPasswordMessage"
|
|
77
|
-
class="q-pl-sm text-red column justify-center error_input"
|
|
78
|
-
>
|
|
70
|
+
class="q-pl-sm text-red column justify-center error_input">
|
|
79
71
|
<div>{{ errorEmailMessage }}</div>
|
|
80
72
|
<div>{{ errorPasswordMessage }}</div>
|
|
81
73
|
</div>
|
|
@@ -89,8 +81,7 @@
|
|
|
89
81
|
:loading="loading"
|
|
90
82
|
type="submit"
|
|
91
83
|
class="full-width q-mt-lg"
|
|
92
|
-
:disable="isSubmitBtnDisabled()"
|
|
93
|
-
>
|
|
84
|
+
:disable="isSubmitBtnDisabled()">
|
|
94
85
|
<div style="font-weight: 600; font-size: 16px">
|
|
95
86
|
{{ $t("auth.login") }}
|
|
96
87
|
</div>
|
|
@@ -101,8 +92,7 @@
|
|
|
101
92
|
@click="forgottenPassword = true"
|
|
102
93
|
data-testid="ask-password-change-btn"
|
|
103
94
|
data-cy="forgot-password"
|
|
104
|
-
style="font-size: 14px; cursor: pointer; width: 350px"
|
|
105
|
-
>
|
|
95
|
+
style="font-size: 14px; cursor: pointer; width: 350px">
|
|
106
96
|
{{ $t("auth.forgottenPassword") }}
|
|
107
97
|
</div>
|
|
108
98
|
</div>
|
|
@@ -117,20 +107,20 @@
|
|
|
117
107
|
transition-show="fade"
|
|
118
108
|
transition-hide="fade"
|
|
119
109
|
persistent
|
|
120
|
-
data-testid="ask-password-change-modal"
|
|
121
|
-
|
|
122
|
-
|
|
110
|
+
data-testid="ask-password-change-modal">
|
|
111
|
+
<send-email
|
|
112
|
+
@resetPassword="resetPassword"
|
|
113
|
+
@close="() => (forgottenPassword = false)" />
|
|
123
114
|
</q-dialog>
|
|
124
115
|
<q-dialog v-model="isReset" persistent>
|
|
125
116
|
<sowell-message
|
|
126
117
|
:emailResetPassword="emailResetPassword"
|
|
127
|
-
:
|
|
118
|
+
:sendEmailCode="sendEmailCode"
|
|
128
119
|
:loading="loading"
|
|
129
120
|
@retypeEmail="retypeEmail"
|
|
130
|
-
@close="() => isReset = false"
|
|
131
|
-
>
|
|
121
|
+
@close="() => (isReset = false)">
|
|
132
122
|
<q-btn
|
|
133
|
-
v-if="
|
|
123
|
+
v-if="sendEmailCode === 200 && isOtp"
|
|
134
124
|
data-testid="next-btn"
|
|
135
125
|
class="q-mt-md full-width"
|
|
136
126
|
unelevated
|
|
@@ -140,8 +130,7 @@
|
|
|
140
130
|
no-caps
|
|
141
131
|
:label="$t('auth.next')"
|
|
142
132
|
color="dark"
|
|
143
|
-
v-close-popup
|
|
144
|
-
/>
|
|
133
|
+
v-close-popup />
|
|
145
134
|
</sowell-message>
|
|
146
135
|
</q-dialog>
|
|
147
136
|
</div>
|
|
@@ -159,15 +148,12 @@
|
|
|
159
148
|
</template>
|
|
160
149
|
|
|
161
150
|
<script lang="ts">
|
|
162
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
163
|
-
//@ts-ignore
|
|
164
151
|
import { defineComponent, reactive, onMounted, computed } from "vue"
|
|
165
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
166
|
-
//@ts-ignore
|
|
167
152
|
import * as packageInfo from "app/package.json"
|
|
168
153
|
import SendEmail from "../dialogs/SendEmail.vue"
|
|
169
154
|
import SowellMessage from "../dialogs/Message.vue"
|
|
170
155
|
import { useAuth } from "composables/auth"
|
|
156
|
+
import { AxiosError } from "axios"
|
|
171
157
|
|
|
172
158
|
export default defineComponent({
|
|
173
159
|
name: "Auth",
|
|
@@ -184,7 +170,7 @@ export default defineComponent({
|
|
|
184
170
|
forgottenPassword,
|
|
185
171
|
emailResetPassword,
|
|
186
172
|
isReset,
|
|
187
|
-
|
|
173
|
+
sendEmailCode,
|
|
188
174
|
authState,
|
|
189
175
|
APP_SERVER_BASE_URL,
|
|
190
176
|
IS_OTP,
|
|
@@ -210,20 +196,26 @@ export default defineComponent({
|
|
|
210
196
|
auth: {
|
|
211
197
|
email,
|
|
212
198
|
base: APP_SERVER_BASE_URL
|
|
213
|
-
}
|
|
199
|
+
}
|
|
214
200
|
}
|
|
215
201
|
try {
|
|
216
202
|
forgottenPassword.value = false
|
|
217
203
|
await authState.resetPassword(data).then(() => {
|
|
218
204
|
localStorage.setItem("emailResetPassword", email)
|
|
219
|
-
|
|
205
|
+
sendEmailCode.value = 200
|
|
220
206
|
isReset.value = true
|
|
221
207
|
})
|
|
222
|
-
} catch {
|
|
223
|
-
|
|
208
|
+
} catch (error) {
|
|
209
|
+
if ((error as AxiosError).response?.status === 403) {
|
|
210
|
+
// NOTE: 403 is returned when the user is not allowed to reset the password
|
|
211
|
+
sendEmailCode.value = 403
|
|
212
|
+
}
|
|
213
|
+
else {
|
|
214
|
+
sendEmailCode.value = 404
|
|
215
|
+
}
|
|
224
216
|
isReset.value = true
|
|
225
217
|
}
|
|
226
|
-
}
|
|
218
|
+
}
|
|
227
219
|
|
|
228
220
|
onMounted(() => {
|
|
229
221
|
appVersion.versionNumber = packageInfo.version
|
|
@@ -240,7 +232,7 @@ export default defineComponent({
|
|
|
240
232
|
forgottenPassword,
|
|
241
233
|
emailResetPassword,
|
|
242
234
|
isReset,
|
|
243
|
-
|
|
235
|
+
sendEmailCode,
|
|
244
236
|
icons,
|
|
245
237
|
appVersion,
|
|
246
238
|
isOtp,
|
|
@@ -268,4 +260,3 @@ export default defineComponent({
|
|
|
268
260
|
display: none;
|
|
269
261
|
}
|
|
270
262
|
</style>
|
|
271
|
-
|
|
@@ -77,8 +77,6 @@
|
|
|
77
77
|
</template>
|
|
78
78
|
|
|
79
79
|
<script lang="ts">
|
|
80
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
81
|
-
//@ts-ignore
|
|
82
80
|
import { defineComponent } from "vue"
|
|
83
81
|
import SowellMessage from "../dialogs/Message.vue"
|
|
84
82
|
import { useResetPassword } from "composables/resetPassword"
|
|
@@ -22,24 +22,21 @@
|
|
|
22
22
|
:icon="`img:${MicrosoftLogo}`"
|
|
23
23
|
class="full-width q-mt-lg"
|
|
24
24
|
@click="msalAuth"
|
|
25
|
-
outline
|
|
26
|
-
/>
|
|
25
|
+
outline />
|
|
27
26
|
<div
|
|
28
27
|
style="
|
|
29
28
|
display: flex;
|
|
30
29
|
justify-content: center;
|
|
31
30
|
align-items: center;
|
|
32
31
|
margin-top: 16px;
|
|
33
|
-
"
|
|
34
|
-
>
|
|
32
|
+
">
|
|
35
33
|
<div
|
|
36
34
|
style="
|
|
37
35
|
width: 20%;
|
|
38
36
|
border: 1px solid #bcc3c7;
|
|
39
37
|
height: 1px;
|
|
40
38
|
margin-right: 16px;
|
|
41
|
-
"
|
|
42
|
-
></div>
|
|
39
|
+
"></div>
|
|
43
40
|
<div class="text-weight-bold">{{ $t("common.or") }}</div>
|
|
44
41
|
<div
|
|
45
42
|
style="
|
|
@@ -47,8 +44,7 @@
|
|
|
47
44
|
border: 1px solid #bcc3c7;
|
|
48
45
|
height: 1px;
|
|
49
46
|
margin-left: 16px;
|
|
50
|
-
"
|
|
51
|
-
></div>
|
|
47
|
+
"></div>
|
|
52
48
|
</div>
|
|
53
49
|
</div>
|
|
54
50
|
<q-form @submit="handleSubmit">
|
|
@@ -64,8 +60,7 @@
|
|
|
64
60
|
data-cy="email"
|
|
65
61
|
dense
|
|
66
62
|
outlined
|
|
67
|
-
input-class="text-subtitle2 text-weight-medium"
|
|
68
|
-
/>
|
|
63
|
+
input-class="text-subtitle2 text-weight-medium" />
|
|
69
64
|
<div class="q-ml-xs q-mb-xs text-subtitle2 text-weight-bold">
|
|
70
65
|
{{ $t("auth.password") }}
|
|
71
66
|
</div>
|
|
@@ -77,16 +72,14 @@
|
|
|
77
72
|
lazy-rules
|
|
78
73
|
dense
|
|
79
74
|
outlined
|
|
80
|
-
input-class="text-subtitle2 text-weight-bold"
|
|
81
|
-
>
|
|
75
|
+
input-class="text-subtitle2 text-weight-bold">
|
|
82
76
|
<template #append>
|
|
83
77
|
<q-icon
|
|
84
78
|
:name="
|
|
85
79
|
showPassword ? icons.ionEyeOffSharp : icons.ionEyeSharp
|
|
86
80
|
"
|
|
87
81
|
class="cursor-pointer q-mr-sm lightenDark"
|
|
88
|
-
@click="showPassword = !showPassword"
|
|
89
|
-
/>
|
|
82
|
+
@click="showPassword = !showPassword" />
|
|
90
83
|
</template>
|
|
91
84
|
</q-input>
|
|
92
85
|
</div>
|
|
@@ -101,14 +94,12 @@
|
|
|
101
94
|
:loading="loading"
|
|
102
95
|
type="submit"
|
|
103
96
|
:disable="isSubmitBtnDisabled() || loading || msalLoading"
|
|
104
|
-
class="submitBtn text-subtitle2 text-weight-bold"
|
|
105
|
-
/>
|
|
97
|
+
class="submitBtn text-subtitle2 text-weight-bold" />
|
|
106
98
|
<div
|
|
107
99
|
class="cursor-pointer text-primary text-subtitle2"
|
|
108
100
|
data-testid="ask-password-change-btn"
|
|
109
101
|
data-cy="forgot-password"
|
|
110
|
-
@click="forgottenPassword = true"
|
|
111
|
-
>
|
|
102
|
+
@click="forgottenPassword = true">
|
|
112
103
|
{{ $t("auth.forgottenPassword") }}
|
|
113
104
|
</div>
|
|
114
105
|
</div>
|
|
@@ -119,18 +110,15 @@
|
|
|
119
110
|
<div
|
|
120
111
|
class="column col justify-center content-center mobile"
|
|
121
112
|
:style="IS_MANAGER ? 'background: #eef8fd' : ''"
|
|
122
|
-
:class="!IS_MANAGER ? 'bgBlue' : ''"
|
|
123
|
-
>
|
|
113
|
+
:class="!IS_MANAGER ? 'bgBlue' : ''">
|
|
124
114
|
<img
|
|
125
115
|
v-if="IS_MANAGER"
|
|
126
116
|
src="../../assets/illustration-login.svg"
|
|
127
|
-
class="q-pl-md q-pr-md logoWhite"
|
|
128
|
-
/>
|
|
117
|
+
class="q-pl-md q-pr-md logoWhite" />
|
|
129
118
|
<img
|
|
130
119
|
v-else
|
|
131
120
|
src="../../assets/SowellWhite.svg"
|
|
132
|
-
class="q-pl-md q-pr-md logoWhite"
|
|
133
|
-
/>
|
|
121
|
+
class="q-pl-md q-pr-md logoWhite" />
|
|
134
122
|
</div>
|
|
135
123
|
</div>
|
|
136
124
|
<div>
|
|
@@ -141,9 +129,10 @@
|
|
|
141
129
|
transition-show="fade"
|
|
142
130
|
transition-hide="fade"
|
|
143
131
|
persistent
|
|
144
|
-
data-testid="ask-password-change-modal"
|
|
145
|
-
|
|
146
|
-
|
|
132
|
+
data-testid="ask-password-change-modal">
|
|
133
|
+
<web-send-email
|
|
134
|
+
@resetPassword="resetPassword"
|
|
135
|
+
@close="() => (forgottenPassword = false)" />
|
|
147
136
|
</q-dialog>
|
|
148
137
|
<q-dialog v-model="isNotification" persistent>
|
|
149
138
|
<sw-info-dialog
|
|
@@ -151,8 +140,7 @@
|
|
|
151
140
|
:content="infoDialog.content"
|
|
152
141
|
:image="infoDialog.image"
|
|
153
142
|
:isOtp="isOtp"
|
|
154
|
-
@close="() => isNotification = false"
|
|
155
|
-
>
|
|
143
|
+
@close="() => (isNotification = false)">
|
|
156
144
|
<q-btn
|
|
157
145
|
:data-testid="infoDialog.canGoNext ? 'next-btn' : 'close-btn'"
|
|
158
146
|
v-if="isOtp"
|
|
@@ -163,8 +151,7 @@
|
|
|
163
151
|
:label="infoDialog.canGoNext ? $t('auth.next') : $t('auth.close')"
|
|
164
152
|
color="primary"
|
|
165
153
|
@click="handleInfoDialog"
|
|
166
|
-
v-close-popup
|
|
167
|
-
/>
|
|
154
|
+
v-close-popup />
|
|
168
155
|
</sw-info-dialog>
|
|
169
156
|
</q-dialog>
|
|
170
157
|
</div>
|
|
@@ -181,6 +168,7 @@ import WebSendEmail from "../dialogs/WebSendEmail.vue"
|
|
|
181
168
|
|
|
182
169
|
import { useAuth } from "composables/auth"
|
|
183
170
|
import MicrosoftLogo from "../../assets/logo-microsoft.svg"
|
|
171
|
+
import { AxiosError } from "axios"
|
|
184
172
|
|
|
185
173
|
export default defineComponent({
|
|
186
174
|
name: "Auth",
|
|
@@ -212,9 +200,12 @@ export default defineComponent({
|
|
|
212
200
|
msalAuth
|
|
213
201
|
} = useAuth()
|
|
214
202
|
|
|
215
|
-
const IS_MANAGER = [
|
|
216
|
-
|
|
217
|
-
|
|
203
|
+
const IS_MANAGER = [
|
|
204
|
+
"manager",
|
|
205
|
+
"clean_manager",
|
|
206
|
+
"incivility_manager",
|
|
207
|
+
"admin"
|
|
208
|
+
].includes(X_REQUESTED_ROLES)
|
|
218
209
|
const isNotification = ref(false)
|
|
219
210
|
const infoDialog = ref({
|
|
220
211
|
title: "",
|
|
@@ -237,7 +228,7 @@ export default defineComponent({
|
|
|
237
228
|
const data = {
|
|
238
229
|
auth: {
|
|
239
230
|
email,
|
|
240
|
-
base: APP_SERVER_BASE_URL
|
|
231
|
+
base: APP_SERVER_BASE_URL
|
|
241
232
|
}
|
|
242
233
|
}
|
|
243
234
|
try {
|
|
@@ -255,14 +246,22 @@ export default defineComponent({
|
|
|
255
246
|
forgottenPassword.value = false
|
|
256
247
|
isNotification.value = true
|
|
257
248
|
})
|
|
258
|
-
} catch {
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
249
|
+
} catch (error) {
|
|
250
|
+
if ((error as AxiosError).response?.status === 403) {
|
|
251
|
+
// NOTE: 403 is returned when the user is not allowed to reset the password
|
|
252
|
+
infoDialog.value = {
|
|
253
|
+
canGoNext: false,
|
|
254
|
+
title: t("auth.forbidden.title"),
|
|
255
|
+
content: t("auth.forbidden.subtitle"),
|
|
256
|
+
image: "userNotFound"
|
|
257
|
+
}
|
|
258
|
+
} else {
|
|
259
|
+
infoDialog.value = {
|
|
260
|
+
canGoNext: false,
|
|
261
|
+
title: t("auth.userNotFoundTitle"),
|
|
262
|
+
content: t("auth.userNotFoundSubtitle"),
|
|
263
|
+
image: "userNotFound"
|
|
264
|
+
}
|
|
266
265
|
}
|
|
267
266
|
|
|
268
267
|
isNotification.value = true
|
package/src/composables/auth.ts
CHANGED
|
@@ -61,7 +61,7 @@ export function useAuth() {
|
|
|
61
61
|
const showPassword = ref(false)
|
|
62
62
|
const forgottenPassword = ref(false)
|
|
63
63
|
const isReset = ref(false)
|
|
64
|
-
const
|
|
64
|
+
const sendEmailCode = ref(0)
|
|
65
65
|
const emailResetPassword = ref("")
|
|
66
66
|
const errorEmailMessage = ref("")
|
|
67
67
|
const errorPasswordMessage = ref("")
|
|
@@ -227,7 +227,7 @@ export function useAuth() {
|
|
|
227
227
|
forgottenPassword,
|
|
228
228
|
emailResetPassword,
|
|
229
229
|
isReset,
|
|
230
|
-
|
|
230
|
+
sendEmailCode,
|
|
231
231
|
authState,
|
|
232
232
|
APP_SERVER_BASE_URL,
|
|
233
233
|
WELCOME_TITLE,
|
package/src/routes/index.ts
CHANGED
package/tsconfig.json
CHANGED