@sowell/quasar-app-extension-auth 0.5.1 → 1.0.0
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/.eslintrc.js +7 -3
- package/.prettierrc +9 -0
- package/package.json +5 -6
- package/src/components/dialogs/Message.vue +21 -19
- package/src/components/dialogs/SendEmail.vue +26 -22
- package/src/components/dialogs/WebSendEmail.vue +18 -15
- package/src/components/dialogs/sw-info-dialog.vue +9 -6
- package/src/components/pages/AdminAuth.vue +41 -45
- package/src/components/pages/Auth.vue +63 -73
- package/src/components/pages/AuthReporter.vue +41 -35
- package/src/components/pages/OtpValidation.vue +45 -40
- package/src/components/pages/ResetPassword.vue +12 -10
- package/src/components/pages/WebAuth.vue +48 -50
- package/src/components/pages/WebResetPassword.vue +24 -36
- package/src/composables/auth.ts +94 -89
- package/src/composables/resetPassword.ts +91 -91
- package/src/index.js +20 -20
- package/src/injects/api.ts +5 -5
- package/src/injects/index.ts +4 -4
- package/src/injects/prompts.ts +24 -24
- package/src/injects/router.ts +6 -6
- package/src/injects/states.ts +60 -60
- package/src/interfaces/Boot.ts +4 -4
- package/src/interfaces/index.ts +2 -2
- package/src/routes/index.ts +28 -22
- package/src/shims-vue.d.ts +4 -4
- package/tsconfig.json +10 -7
|
@@ -7,24 +7,20 @@
|
|
|
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
|
class="text-subtitle1 text-center head q-mt-xl"
|
|
20
|
-
style="font-weight: 600; font-size: 34px"
|
|
21
|
-
>
|
|
18
|
+
style="font-weight: 600; font-size: 34px">
|
|
22
19
|
{{ $t("auth.title") }}
|
|
23
20
|
</div>
|
|
24
21
|
<div
|
|
25
22
|
class="q-mt-lg q-mb-xl text-subtitle1 text-center"
|
|
26
|
-
style="font-size: 16px"
|
|
27
|
-
>
|
|
23
|
+
style="font-size: 16px">
|
|
28
24
|
{{ $t("auth.loginHelp") }}
|
|
29
25
|
</div>
|
|
30
26
|
</div>
|
|
@@ -32,8 +28,7 @@
|
|
|
32
28
|
<div>
|
|
33
29
|
<div
|
|
34
30
|
class="q-ml-xs q-mb-xs"
|
|
35
|
-
style="font-size: 14px; font-weight: 600"
|
|
36
|
-
>
|
|
31
|
+
style="font-size: 14px; font-weight: 600">
|
|
37
32
|
{{ $t("auth.email") }}
|
|
38
33
|
</div>
|
|
39
34
|
<q-input
|
|
@@ -44,8 +39,7 @@
|
|
|
44
39
|
:rules="validations['email']"
|
|
45
40
|
lazy-rules
|
|
46
41
|
dense
|
|
47
|
-
:input-style="{ fontSize: '14px', fontWeight: '500' }"
|
|
48
|
-
>
|
|
42
|
+
:input-style="{ fontSize: '14px', fontWeight: '500' }">
|
|
49
43
|
<template #prepend>
|
|
50
44
|
<q-icon :name="icons.ionMailOutline" />
|
|
51
45
|
</template>
|
|
@@ -54,8 +48,7 @@
|
|
|
54
48
|
<div>
|
|
55
49
|
<div
|
|
56
50
|
class="q-ml-xs q-mb-xs"
|
|
57
|
-
style="font-size: 14px; font-weight: 600"
|
|
58
|
-
>
|
|
51
|
+
style="font-size: 14px; font-weight: 600">
|
|
59
52
|
{{ $t("auth.password") }}
|
|
60
53
|
</div>
|
|
61
54
|
<q-input
|
|
@@ -66,19 +59,16 @@
|
|
|
66
59
|
lazy-rules
|
|
67
60
|
borderless
|
|
68
61
|
dense
|
|
69
|
-
:input-style="{ fontSize: '14px', fontWeight: '600' }"
|
|
70
|
-
>
|
|
62
|
+
:input-style="{ fontSize: '14px', fontWeight: '600' }">
|
|
71
63
|
<template #prepend>
|
|
72
64
|
<q-icon :name="icons.ionLockClosedOutline" />
|
|
73
65
|
</template>
|
|
74
66
|
<template #append>
|
|
75
67
|
<q-icon
|
|
76
|
-
:name="
|
|
77
|
-
|
|
78
|
-
"
|
|
68
|
+
:name="showPassword ? icons.ionEyeOffOutline : icons.ionEyeOutline
|
|
69
|
+
"
|
|
79
70
|
class="cursor-pointer q-mr-sm"
|
|
80
|
-
@click="showPassword = !showPassword"
|
|
81
|
-
/>
|
|
71
|
+
@click="showPassword = !showPassword" />
|
|
82
72
|
</template>
|
|
83
73
|
</q-input>
|
|
84
74
|
</div>
|
|
@@ -92,15 +82,13 @@
|
|
|
92
82
|
:loading="loading"
|
|
93
83
|
type="submit"
|
|
94
84
|
class="full-width q-mt-lg"
|
|
95
|
-
:disable="isSubmitBtnDisabled() || loading || msalLoading"
|
|
96
|
-
/>
|
|
85
|
+
:disable="isSubmitBtnDisabled() || loading || msalLoading" />
|
|
97
86
|
<div
|
|
98
87
|
class="q-mb-lg q-mt-xl text-primary"
|
|
99
88
|
@click="forgottenPassword = true"
|
|
100
89
|
data-cy="forgot-password"
|
|
101
90
|
data-testid="ask-password-change-btn"
|
|
102
|
-
style="font-size: 16px; font-weight: 500; cursor: pointer"
|
|
103
|
-
>
|
|
91
|
+
style="font-size: 16px; font-weight: 500; cursor: pointer">
|
|
104
92
|
{{ $t("auth.forgottenPassword") }}
|
|
105
93
|
</div>
|
|
106
94
|
<div v-if="USE_SSO">
|
|
@@ -109,15 +97,12 @@
|
|
|
109
97
|
display: flex;
|
|
110
98
|
justify-content: space-between;
|
|
111
99
|
align-items: center;
|
|
112
|
-
"
|
|
113
|
-
>
|
|
100
|
+
">
|
|
114
101
|
<div
|
|
115
|
-
style="width: 35%; border: 1px solid #bcc3c7; height: 1px"
|
|
116
|
-
></div>
|
|
102
|
+
style="width: 35%; border: 1px solid #bcc3c7; height: 1px"></div>
|
|
117
103
|
<div class="text-weight-bold">{{ $t("common.or") }}</div>
|
|
118
104
|
<div
|
|
119
|
-
style="width: 35%; border: 1px solid #bcc3c7; height: 1px"
|
|
120
|
-
></div>
|
|
105
|
+
style="width: 35%; border: 1px solid #bcc3c7; height: 1px"></div>
|
|
121
106
|
</div>
|
|
122
107
|
<q-btn
|
|
123
108
|
data-cy="submit-sso-login"
|
|
@@ -131,8 +116,7 @@
|
|
|
131
116
|
:icon="`img:${MicrosoftLogo}`"
|
|
132
117
|
class="full-width q-mt-lg"
|
|
133
118
|
@click="msalAuth"
|
|
134
|
-
outline
|
|
135
|
-
/>
|
|
119
|
+
outline />
|
|
136
120
|
</div>
|
|
137
121
|
</q-form>
|
|
138
122
|
</div>
|
|
@@ -144,17 +128,16 @@
|
|
|
144
128
|
transition-show="fade"
|
|
145
129
|
transition-hide="fade"
|
|
146
130
|
persistent
|
|
147
|
-
data-testid="ask-password-change-modal"
|
|
148
|
-
|
|
149
|
-
<send-email @resetPassword="resetPassword" />
|
|
131
|
+
data-testid="ask-password-change-modal">
|
|
132
|
+
<send-email @resetPassword="resetPassword" @close="() => forgottenPassword = false" />
|
|
150
133
|
</q-dialog>
|
|
151
134
|
<q-dialog v-model="isReset" persistent>
|
|
152
135
|
<sowell-message
|
|
153
136
|
:emailResetPassword="emailResetPassword"
|
|
154
137
|
:sendEmailSuccess="sendEmailSuccess"
|
|
155
138
|
:loading="loading"
|
|
156
|
-
@retypeEmail="retypeEmail"
|
|
157
|
-
|
|
139
|
+
@retypeEmail="retypeEmail"
|
|
140
|
+
@close="() => isReset= false"/>
|
|
158
141
|
</q-dialog>
|
|
159
142
|
</div>
|
|
160
143
|
</div>
|
|
@@ -171,12 +154,20 @@
|
|
|
171
154
|
</template>
|
|
172
155
|
|
|
173
156
|
<script lang="ts">
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
import
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
import
|
|
157
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
158
|
+
//@ts-ignore
|
|
159
|
+
import { defineComponent, reactive, onMounted } from "vue"
|
|
160
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
161
|
+
//@ts-ignore
|
|
162
|
+
import * as packageInfo from "app/package.json"
|
|
163
|
+
|
|
164
|
+
import SendEmail from "../dialogs/SendEmail.vue"
|
|
165
|
+
import SowellMessage from "../dialogs/Message.vue"
|
|
166
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
167
|
+
//@ts-ignore
|
|
168
|
+
import MicrosoftLogo from "../../assets/logo-microsoft.svg"
|
|
169
|
+
|
|
170
|
+
import { useAuth } from "composables/auth"
|
|
180
171
|
|
|
181
172
|
export default defineComponent({
|
|
182
173
|
name: "Auth",
|
|
@@ -195,43 +186,43 @@ export default defineComponent({
|
|
|
195
186
|
sendEmailSuccess,
|
|
196
187
|
authState,
|
|
197
188
|
APP_SERVER_BASE_URL,
|
|
189
|
+
icons,
|
|
190
|
+
USE_SSO,
|
|
198
191
|
onSubmit,
|
|
199
192
|
retypeEmail,
|
|
200
193
|
isSubmitBtnDisabled,
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
msalAuth,
|
|
204
|
-
} = useAuth();
|
|
194
|
+
msalAuth
|
|
195
|
+
} = useAuth()
|
|
205
196
|
|
|
206
197
|
const appVersion = reactive({
|
|
207
|
-
versionNumber: ""
|
|
208
|
-
})
|
|
198
|
+
versionNumber: ""
|
|
199
|
+
})
|
|
209
200
|
const resetPassword = async (email: string) => {
|
|
210
201
|
const data = {
|
|
211
202
|
auth: {
|
|
212
203
|
email,
|
|
213
|
-
base: APP_SERVER_BASE_URL
|
|
214
|
-
}
|
|
215
|
-
}
|
|
204
|
+
base: APP_SERVER_BASE_URL
|
|
205
|
+
}
|
|
206
|
+
}
|
|
216
207
|
try {
|
|
217
|
-
forgottenPassword.value = false
|
|
208
|
+
forgottenPassword.value = false
|
|
218
209
|
await authState.resetPassword(data).then(() => {
|
|
219
|
-
sendEmailSuccess.value = true
|
|
220
|
-
isReset.value = true
|
|
221
|
-
})
|
|
210
|
+
sendEmailSuccess.value = true
|
|
211
|
+
isReset.value = true
|
|
212
|
+
})
|
|
222
213
|
} catch {
|
|
223
|
-
sendEmailSuccess.value = false
|
|
224
|
-
isReset.value = true
|
|
214
|
+
sendEmailSuccess.value = false
|
|
215
|
+
isReset.value = true
|
|
225
216
|
}
|
|
226
|
-
}
|
|
217
|
+
}
|
|
227
218
|
|
|
228
219
|
const handleSubmit = () => {
|
|
229
|
-
onSubmit("SoWell")
|
|
230
|
-
}
|
|
220
|
+
onSubmit("SoWell")
|
|
221
|
+
}
|
|
231
222
|
|
|
232
223
|
onMounted(() => {
|
|
233
|
-
appVersion.versionNumber = packageInfo.version
|
|
234
|
-
})
|
|
224
|
+
appVersion.versionNumber = packageInfo.version
|
|
225
|
+
})
|
|
235
226
|
|
|
236
227
|
return {
|
|
237
228
|
email,
|
|
@@ -244,19 +235,19 @@ export default defineComponent({
|
|
|
244
235
|
emailResetPassword,
|
|
245
236
|
isReset,
|
|
246
237
|
sendEmailSuccess,
|
|
247
|
-
onSubmit,
|
|
248
|
-
resetPassword,
|
|
249
|
-
isSubmitBtnDisabled,
|
|
250
|
-
retypeEmail,
|
|
251
238
|
icons,
|
|
252
239
|
appVersion,
|
|
253
240
|
USE_SSO,
|
|
241
|
+
MicrosoftLogo,
|
|
242
|
+
onSubmit,
|
|
243
|
+
isSubmitBtnDisabled,
|
|
244
|
+
retypeEmail,
|
|
254
245
|
msalAuth,
|
|
255
246
|
handleSubmit,
|
|
256
|
-
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
})
|
|
247
|
+
resetPassword
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
})
|
|
260
251
|
</script>
|
|
261
252
|
|
|
262
253
|
<style scoped>
|
|
@@ -264,4 +255,3 @@ export default defineComponent({
|
|
|
264
255
|
background: transparent;
|
|
265
256
|
}
|
|
266
257
|
</style>
|
|
267
|
-
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
/>
|
|
17
17
|
</div>
|
|
18
18
|
</div>
|
|
19
|
-
<div class="">
|
|
19
|
+
<div class="login-page">
|
|
20
20
|
<q-form @submit="handleSubmit">
|
|
21
21
|
<div>
|
|
22
22
|
<div
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
persistent
|
|
120
120
|
data-testid="ask-password-change-modal"
|
|
121
121
|
>
|
|
122
|
-
<send-email @resetPassword="resetPassword" />
|
|
122
|
+
<send-email @resetPassword="resetPassword" @close="() => forgottenPassword = false" />
|
|
123
123
|
</q-dialog>
|
|
124
124
|
<q-dialog v-model="isReset" persistent>
|
|
125
125
|
<sowell-message
|
|
@@ -127,9 +127,11 @@
|
|
|
127
127
|
:sendEmailSuccess="sendEmailSuccess"
|
|
128
128
|
:loading="loading"
|
|
129
129
|
@retypeEmail="retypeEmail"
|
|
130
|
+
@close="() => isReset = false"
|
|
130
131
|
>
|
|
131
132
|
<q-btn
|
|
132
133
|
v-if="sendEmailSuccess && isOtp"
|
|
134
|
+
data-testid="next-btn"
|
|
133
135
|
class="q-mt-md full-width"
|
|
134
136
|
unelevated
|
|
135
137
|
style="background: #fff"
|
|
@@ -157,11 +159,15 @@
|
|
|
157
159
|
</template>
|
|
158
160
|
|
|
159
161
|
<script lang="ts">
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
import
|
|
163
|
-
|
|
164
|
-
|
|
162
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
163
|
+
//@ts-ignore
|
|
164
|
+
import { defineComponent, reactive, onMounted, computed } from "vue"
|
|
165
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
166
|
+
//@ts-ignore
|
|
167
|
+
import * as packageInfo from "app/package.json"
|
|
168
|
+
import SendEmail from "../dialogs/SendEmail.vue"
|
|
169
|
+
import SowellMessage from "../dialogs/Message.vue"
|
|
170
|
+
import { useAuth } from "composables/auth"
|
|
165
171
|
|
|
166
172
|
export default defineComponent({
|
|
167
173
|
name: "Auth",
|
|
@@ -182,46 +188,46 @@ export default defineComponent({
|
|
|
182
188
|
authState,
|
|
183
189
|
APP_SERVER_BASE_URL,
|
|
184
190
|
IS_OTP,
|
|
191
|
+
icons,
|
|
185
192
|
onSubmit,
|
|
186
193
|
retypeEmail,
|
|
187
194
|
isSubmitBtnDisabled,
|
|
188
|
-
goToOtpValidation
|
|
189
|
-
|
|
190
|
-
} = useAuth();
|
|
195
|
+
goToOtpValidation
|
|
196
|
+
} = useAuth()
|
|
191
197
|
|
|
192
198
|
const handleSubmit = () => {
|
|
193
|
-
onSubmit()
|
|
194
|
-
}
|
|
199
|
+
onSubmit()
|
|
200
|
+
}
|
|
195
201
|
|
|
196
202
|
const appVersion = reactive({
|
|
197
|
-
versionNumber: ""
|
|
198
|
-
})
|
|
203
|
+
versionNumber: ""
|
|
204
|
+
})
|
|
199
205
|
|
|
200
|
-
const isOtp = computed(() => IS_OTP.toLowerCase() === "y")
|
|
206
|
+
const isOtp = computed(() => IS_OTP.toLowerCase() === "y")
|
|
201
207
|
|
|
202
208
|
const resetPassword = async (email: string) => {
|
|
203
209
|
const data = {
|
|
204
210
|
auth: {
|
|
205
211
|
email,
|
|
206
|
-
base: APP_SERVER_BASE_URL
|
|
212
|
+
base: APP_SERVER_BASE_URL
|
|
207
213
|
},
|
|
208
|
-
}
|
|
214
|
+
}
|
|
209
215
|
try {
|
|
210
|
-
forgottenPassword.value = false
|
|
216
|
+
forgottenPassword.value = false
|
|
211
217
|
await authState.resetPassword(data).then(() => {
|
|
212
|
-
localStorage.setItem("emailResetPassword", email)
|
|
213
|
-
sendEmailSuccess.value = true
|
|
214
|
-
isReset.value = true
|
|
215
|
-
})
|
|
218
|
+
localStorage.setItem("emailResetPassword", email)
|
|
219
|
+
sendEmailSuccess.value = true
|
|
220
|
+
isReset.value = true
|
|
221
|
+
})
|
|
216
222
|
} catch {
|
|
217
|
-
sendEmailSuccess.value = false
|
|
218
|
-
isReset.value = true
|
|
223
|
+
sendEmailSuccess.value = false
|
|
224
|
+
isReset.value = true
|
|
219
225
|
}
|
|
220
226
|
};
|
|
221
227
|
|
|
222
228
|
onMounted(() => {
|
|
223
|
-
appVersion.versionNumber = packageInfo.version
|
|
224
|
-
})
|
|
229
|
+
appVersion.versionNumber = packageInfo.version
|
|
230
|
+
})
|
|
225
231
|
|
|
226
232
|
return {
|
|
227
233
|
email,
|
|
@@ -235,17 +241,17 @@ export default defineComponent({
|
|
|
235
241
|
emailResetPassword,
|
|
236
242
|
isReset,
|
|
237
243
|
sendEmailSuccess,
|
|
238
|
-
handleSubmit,
|
|
239
|
-
resetPassword,
|
|
240
|
-
goToOtpValidation,
|
|
241
|
-
isSubmitBtnDisabled,
|
|
242
|
-
retypeEmail,
|
|
243
244
|
icons,
|
|
244
245
|
appVersion,
|
|
245
246
|
isOtp,
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
247
|
+
goToOtpValidation,
|
|
248
|
+
isSubmitBtnDisabled,
|
|
249
|
+
retypeEmail,
|
|
250
|
+
handleSubmit,
|
|
251
|
+
resetPassword
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
})
|
|
249
255
|
</script>
|
|
250
256
|
|
|
251
257
|
<style>
|
|
@@ -258,7 +264,7 @@ export default defineComponent({
|
|
|
258
264
|
background: #fce4e3;
|
|
259
265
|
}
|
|
260
266
|
|
|
261
|
-
|
|
267
|
+
.login-page .q-field__messages {
|
|
262
268
|
display: none;
|
|
263
269
|
}
|
|
264
270
|
</style>
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
no-caps
|
|
57
57
|
class="submitBtn"
|
|
58
58
|
data-cy="send-new-otp"
|
|
59
|
-
:disable="canSubmit"
|
|
59
|
+
:disable="!canSubmit"
|
|
60
60
|
/>
|
|
61
61
|
<q-btn
|
|
62
62
|
data-testid="back-btn"
|
|
@@ -75,70 +75,73 @@
|
|
|
75
75
|
</template>
|
|
76
76
|
|
|
77
77
|
<script lang="ts">
|
|
78
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
78
79
|
//@ts-ignore
|
|
79
|
-
import { defineComponent, ref, computed } from "vue"
|
|
80
|
-
import {
|
|
81
|
-
import {
|
|
82
|
-
import
|
|
83
|
-
import jwt from "jwt-decode";
|
|
84
|
-
|
|
80
|
+
import { defineComponent, ref, computed } from "vue"
|
|
81
|
+
import { useQuasar } from "quasar"
|
|
82
|
+
import { useI18n } from "vue-i18n"
|
|
83
|
+
import jwt from "jwt-decode"
|
|
85
84
|
import {
|
|
86
85
|
ionCloseOutline,
|
|
87
86
|
ionAlertCircleOutline,
|
|
88
|
-
} from "@quasar/extras/ionicons-v5"
|
|
87
|
+
} from "@quasar/extras/ionicons-v5"
|
|
88
|
+
|
|
89
|
+
import { $router, $prompts, $api } from "../../injects"
|
|
90
|
+
|
|
89
91
|
|
|
90
92
|
interface DecodedToken {
|
|
91
|
-
uid: string
|
|
92
|
-
cid: string
|
|
93
|
-
exp: number
|
|
93
|
+
uid: string
|
|
94
|
+
cid: string
|
|
95
|
+
exp: number
|
|
94
96
|
}
|
|
95
97
|
|
|
96
98
|
export default defineComponent({
|
|
97
99
|
name: "ResetPassword",
|
|
98
100
|
components: {},
|
|
99
101
|
setup() {
|
|
100
|
-
const { t } = useI18n()
|
|
101
|
-
const router = $router()
|
|
102
|
-
const $q = useQuasar()
|
|
103
|
-
const { post } = $api()
|
|
102
|
+
const { t } = useI18n()
|
|
103
|
+
const router = $router()
|
|
104
|
+
const $q = useQuasar()
|
|
105
|
+
const { post } = $api()
|
|
104
106
|
const {
|
|
105
107
|
LOCAL_LOGIN_ROUTE,
|
|
106
108
|
AUTH_SERVER_VERIFY_OTP,
|
|
107
109
|
LOCAL_UPDATE_PASSWORD_ROUTE,
|
|
108
110
|
UI_PAGE,
|
|
109
|
-
} = $prompts()
|
|
111
|
+
} = $prompts()
|
|
110
112
|
|
|
111
|
-
const otp = ref("")
|
|
112
|
-
const loading = ref(false)
|
|
113
|
+
const otp = ref("")
|
|
114
|
+
const loading = ref(false)
|
|
113
115
|
|
|
114
|
-
const isReporterUi = computed(() => UI_PAGE === "reporter")
|
|
116
|
+
const isReporterUi = computed(() => UI_PAGE === "reporter")
|
|
115
117
|
|
|
116
118
|
const onSubmit = () => {
|
|
117
|
-
if (canSubmit && localStorage.getItem("emailResetPassword")) {
|
|
119
|
+
if (canSubmit.value && localStorage.getItem("emailResetPassword")) {
|
|
120
|
+
loading.value = true
|
|
118
121
|
const data = {
|
|
119
122
|
auth: {
|
|
120
123
|
email: localStorage.getItem("emailResetPassword"),
|
|
121
|
-
password: otp.value
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
+
password: otp.value.trim()
|
|
125
|
+
}
|
|
126
|
+
}
|
|
124
127
|
post(AUTH_SERVER_VERIFY_OTP, data)
|
|
125
128
|
.then((response) => {
|
|
126
129
|
if (response.data.auth) {
|
|
127
|
-
let decoded = jwt(response.data.auth) as DecodedToken
|
|
130
|
+
let decoded = jwt(response.data.auth) as DecodedToken
|
|
128
131
|
if (decoded) {
|
|
129
132
|
localStorage.setItem(
|
|
130
133
|
"userInfos",
|
|
131
134
|
JSON.stringify({
|
|
132
135
|
uid: decoded.uid,
|
|
133
|
-
token: response.data.auth
|
|
136
|
+
token: response.data.auth
|
|
134
137
|
})
|
|
135
|
-
)
|
|
136
|
-
router.push(LOCAL_UPDATE_PASSWORD_ROUTE)
|
|
138
|
+
)
|
|
139
|
+
router.push(LOCAL_UPDATE_PASSWORD_ROUTE)
|
|
137
140
|
}
|
|
138
141
|
}
|
|
139
142
|
})
|
|
140
143
|
.catch((error) => {
|
|
141
|
-
console.log("error", error)
|
|
144
|
+
console.log("error", error)
|
|
142
145
|
$q.notify({
|
|
143
146
|
message: t("auth.passwordRecoveryFailed"),
|
|
144
147
|
color: "negative",
|
|
@@ -147,17 +150,19 @@ export default defineComponent({
|
|
|
147
150
|
actions: [
|
|
148
151
|
{
|
|
149
152
|
color: "white",
|
|
150
|
-
icon: ionCloseOutline
|
|
151
|
-
}
|
|
152
|
-
]
|
|
153
|
-
})
|
|
154
|
-
})
|
|
153
|
+
icon: ionCloseOutline
|
|
154
|
+
}
|
|
155
|
+
]
|
|
156
|
+
})
|
|
157
|
+
}).finaly(() => {
|
|
158
|
+
loading.value = false
|
|
159
|
+
})
|
|
155
160
|
}
|
|
156
|
-
}
|
|
161
|
+
}
|
|
157
162
|
|
|
158
163
|
const canSubmit = computed(() => {
|
|
159
|
-
return
|
|
160
|
-
})
|
|
164
|
+
return otp.value.length > 0
|
|
165
|
+
})
|
|
161
166
|
|
|
162
167
|
return {
|
|
163
168
|
otp,
|
|
@@ -165,11 +170,11 @@ export default defineComponent({
|
|
|
165
170
|
router,
|
|
166
171
|
LOCAL_LOGIN_ROUTE,
|
|
167
172
|
isReporterUi,
|
|
168
|
-
onSubmit,
|
|
169
173
|
canSubmit,
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
}
|
|
174
|
+
onSubmit
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
})
|
|
173
178
|
</script>
|
|
174
179
|
|
|
175
180
|
<style scoped>
|
|
@@ -69,6 +69,7 @@
|
|
|
69
69
|
<sowell-message
|
|
70
70
|
:passwordUpdated="passwordUpdated"
|
|
71
71
|
@goToLoginPage="goToLoginPage"
|
|
72
|
+
@close="() => passwordUpdated = false"
|
|
72
73
|
/>
|
|
73
74
|
</q-dialog>
|
|
74
75
|
</div>
|
|
@@ -76,10 +77,11 @@
|
|
|
76
77
|
</template>
|
|
77
78
|
|
|
78
79
|
<script lang="ts">
|
|
80
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
79
81
|
//@ts-ignore
|
|
80
|
-
import { defineComponent } from "vue"
|
|
81
|
-
import SowellMessage from "../dialogs/Message.vue"
|
|
82
|
-
import { useResetPassword } from "composables/resetPassword"
|
|
82
|
+
import { defineComponent } from "vue"
|
|
83
|
+
import SowellMessage from "../dialogs/Message.vue"
|
|
84
|
+
import { useResetPassword } from "composables/resetPassword"
|
|
83
85
|
|
|
84
86
|
export default defineComponent({
|
|
85
87
|
name: "ResetPassword",
|
|
@@ -94,8 +96,8 @@ export default defineComponent({
|
|
|
94
96
|
canSubmit,
|
|
95
97
|
onSubmit,
|
|
96
98
|
goToLoginPage,
|
|
97
|
-
icons
|
|
98
|
-
} = useResetPassword()
|
|
99
|
+
icons
|
|
100
|
+
} = useResetPassword()
|
|
99
101
|
|
|
100
102
|
return {
|
|
101
103
|
password,
|
|
@@ -104,12 +106,12 @@ export default defineComponent({
|
|
|
104
106
|
passwordUpdated,
|
|
105
107
|
LOCAL_LOGIN_ROUTE,
|
|
106
108
|
validations,
|
|
107
|
-
onSubmit,
|
|
108
|
-
goToLoginPage,
|
|
109
109
|
icons,
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
110
|
+
onSubmit,
|
|
111
|
+
goToLoginPage
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
})
|
|
113
115
|
</script>
|
|
114
116
|
|
|
115
117
|
<style scoped>
|