@sowell/quasar-app-extension-auth 1.4.4 → 1.4.6
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
CHANGED
|
@@ -97,36 +97,40 @@
|
|
|
97
97
|
data-cy="forgot-password">
|
|
98
98
|
{{ $t("auth.forgottenPassword") }}
|
|
99
99
|
</div>
|
|
100
|
-
<
|
|
101
|
-
<
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
100
|
+
<template v-if="USE_SSO">
|
|
101
|
+
<div class="full-width">
|
|
102
|
+
<q-separator color="#727272" />
|
|
103
|
+
</div>
|
|
104
|
+
<div
|
|
105
|
+
class="q-mb-sm q-mt-md forgot-password-link self-start text-weight-medium">
|
|
106
|
+
{{ $t("auth.continueWith") }}
|
|
107
|
+
</div>
|
|
108
|
+
|
|
109
|
+
<div class="row justify-between full-width items-center">
|
|
110
|
+
<!-- <q-btn
|
|
111
|
+
data-testid="google-btn"
|
|
112
|
+
unelevated
|
|
113
|
+
no-caps
|
|
114
|
+
dense
|
|
115
|
+
class="col sso-btn btn-label"
|
|
116
|
+
style="margin-right: 4px !important;">
|
|
117
|
+
<img src="../../assets/google-logo.svg" class="btn-icon" />
|
|
118
|
+
Google
|
|
119
|
+
</q-btn> -->
|
|
120
|
+
<q-btn
|
|
121
|
+
data-testid="microsoft-button"
|
|
122
|
+
unelevated
|
|
123
|
+
no-caps
|
|
124
|
+
dense
|
|
125
|
+
class="col sso-btn btn-label"
|
|
126
|
+
@click="msalAuth">
|
|
127
|
+
<img
|
|
128
|
+
src="../../assets/logo-microsoft.svg"
|
|
129
|
+
class="btn-icon" />
|
|
130
|
+
Microsoft
|
|
131
|
+
</q-btn>
|
|
132
|
+
</div>
|
|
133
|
+
</template>
|
|
130
134
|
</div>
|
|
131
135
|
<div class="error-message-container">
|
|
132
136
|
<div
|
|
@@ -260,7 +264,7 @@ export default defineComponent({
|
|
|
260
264
|
try {
|
|
261
265
|
forgottenPassword.value = false
|
|
262
266
|
await authState.resetPassword(data).then(() => {
|
|
263
|
-
localStorage.
|
|
267
|
+
localStorage.set("emailResetPassword", email)
|
|
264
268
|
sendEmailCode.value = 200
|
|
265
269
|
isReset.value = true
|
|
266
270
|
})
|
|
@@ -276,10 +280,17 @@ export default defineComponent({
|
|
|
276
280
|
}
|
|
277
281
|
|
|
278
282
|
const goToPrivacyPolicy = async () => {
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
+
const privacyPolicyUrl = "https://sowell.app/privacy-policy-sowell/"
|
|
284
|
+
try {
|
|
285
|
+
await InAppBrowser.openInSystemBrowser({
|
|
286
|
+
url: privacyPolicyUrl,
|
|
287
|
+
options: DefaultSystemBrowserOptions
|
|
288
|
+
})
|
|
289
|
+
} catch (error) {
|
|
290
|
+
if (typeof window !== "undefined") {
|
|
291
|
+
window.open(privacyPolicyUrl, "_blank")
|
|
292
|
+
}
|
|
293
|
+
}
|
|
283
294
|
}
|
|
284
295
|
|
|
285
296
|
onMounted(() => {
|
|
@@ -99,7 +99,7 @@ export default defineComponent({
|
|
|
99
99
|
setup() {
|
|
100
100
|
const { t } = useI18n()
|
|
101
101
|
const router = $router()
|
|
102
|
-
const
|
|
102
|
+
const { localStorage, notify } = useQuasar()
|
|
103
103
|
const { post } = $api()
|
|
104
104
|
const {
|
|
105
105
|
LOCAL_LOGIN_ROUTE,
|
|
@@ -127,7 +127,7 @@ export default defineComponent({
|
|
|
127
127
|
if (response.data.auth) {
|
|
128
128
|
let decoded = jwt(response.data.auth) as DecodedToken
|
|
129
129
|
if (decoded) {
|
|
130
|
-
localStorage.
|
|
130
|
+
localStorage.set(
|
|
131
131
|
"userInfos",
|
|
132
132
|
JSON.stringify({
|
|
133
133
|
uid: decoded.uid,
|
|
@@ -140,7 +140,7 @@ export default defineComponent({
|
|
|
140
140
|
})
|
|
141
141
|
.catch((error) => {
|
|
142
142
|
console.log("error", error)
|
|
143
|
-
|
|
143
|
+
notify({
|
|
144
144
|
message: t("auth.passwordRecoveryFailed"),
|
|
145
145
|
color: "negative",
|
|
146
146
|
icon: ionAlertCircleOutline,
|
|
@@ -152,7 +152,7 @@ export default defineComponent({
|
|
|
152
152
|
}
|
|
153
153
|
]
|
|
154
154
|
})
|
|
155
|
-
}).
|
|
155
|
+
}).finally(() => {
|
|
156
156
|
loading.value = false
|
|
157
157
|
})
|
|
158
158
|
}
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
ionEyeOutline,
|
|
8
8
|
ionEyeOffOutline,
|
|
9
9
|
ionAlertCircleOutline,
|
|
10
|
-
ionLockClosedOutline
|
|
10
|
+
ionLockClosedOutline
|
|
11
11
|
} from "@quasar/extras/ionicons-v5"
|
|
12
12
|
|
|
13
13
|
import { $api, $prompts, $router } from "../injects"
|
|
@@ -19,7 +19,7 @@ interface DecodedToken {
|
|
|
19
19
|
token: string
|
|
20
20
|
}
|
|
21
21
|
export function useResetPassword() {
|
|
22
|
-
const
|
|
22
|
+
const { localStorage, notify } = useQuasar()
|
|
23
23
|
const { t } = useI18n()
|
|
24
24
|
|
|
25
25
|
const password = ref("")
|
|
@@ -27,7 +27,10 @@ export function useResetPassword() {
|
|
|
27
27
|
const passwordUpdated = ref(false)
|
|
28
28
|
const showPassword = ref(false)
|
|
29
29
|
const tempToken = ref("")
|
|
30
|
-
const userInfos = JSON.parse(localStorage.getItem("userInfos") || "{}")
|
|
30
|
+
const userInfos = JSON.parse(localStorage.getItem("userInfos") || "{}") as {
|
|
31
|
+
uid: string
|
|
32
|
+
token: string
|
|
33
|
+
}
|
|
31
34
|
|
|
32
35
|
const { patch, post } = $api()
|
|
33
36
|
const router = $router()
|
|
@@ -70,9 +73,7 @@ export function useResetPassword() {
|
|
|
70
73
|
try {
|
|
71
74
|
// remove backslash to avoid decoding error
|
|
72
75
|
key = key.replace(/\\n/g, "")
|
|
73
|
-
const decodedKey = Buffer.from(key, "base64")
|
|
74
|
-
.toString("utf-8")
|
|
75
|
-
.split(",")
|
|
76
|
+
const decodedKey = Buffer.from(key, "base64").toString("utf-8").split(",")
|
|
76
77
|
// split instead of JSON.parse as JSON.parse doesn't work
|
|
77
78
|
|
|
78
79
|
if (decodedKey.length !== 2) {
|
|
@@ -128,12 +129,12 @@ export function useResetPassword() {
|
|
|
128
129
|
.then(() => {
|
|
129
130
|
loading.value = false
|
|
130
131
|
passwordUpdated.value = true
|
|
131
|
-
localStorage.
|
|
132
|
-
localStorage.
|
|
132
|
+
localStorage.remove("emailResetPassword")
|
|
133
|
+
localStorage.remove("userInfos")
|
|
133
134
|
})
|
|
134
135
|
.catch(() => {
|
|
135
136
|
loading.value = false
|
|
136
|
-
|
|
137
|
+
notify({
|
|
137
138
|
message: t("auth.passwordRecoveryFailed"),
|
|
138
139
|
color: "negative",
|
|
139
140
|
icon: ionAlertCircleOutline,
|
|
@@ -158,7 +159,7 @@ export function useResetPassword() {
|
|
|
158
159
|
const { decoded, email, tmpToken } = decodeKey(key)
|
|
159
160
|
|
|
160
161
|
if (!decoded) {
|
|
161
|
-
return
|
|
162
|
+
return notify({
|
|
162
163
|
message: t("auth.passwordRecoveryInvalidLink"),
|
|
163
164
|
color: "negative",
|
|
164
165
|
position: "top",
|
|
@@ -188,7 +189,7 @@ export function useResetPassword() {
|
|
|
188
189
|
if (error.response) {
|
|
189
190
|
// Request made and server responded
|
|
190
191
|
if (error.response.status === 404) {
|
|
191
|
-
return
|
|
192
|
+
return notify({
|
|
192
193
|
message: t("auth.passwordRecoveryExpiredLink"),
|
|
193
194
|
color: "negative",
|
|
194
195
|
icon: ionAlertCircleOutline,
|
|
@@ -196,13 +197,13 @@ export function useResetPassword() {
|
|
|
196
197
|
actions: [
|
|
197
198
|
{
|
|
198
199
|
color: "white",
|
|
199
|
-
icon: ionCloseOutline
|
|
200
|
-
}
|
|
201
|
-
]
|
|
200
|
+
icon: ionCloseOutline
|
|
201
|
+
}
|
|
202
|
+
]
|
|
202
203
|
})
|
|
203
204
|
}
|
|
204
205
|
}
|
|
205
|
-
return
|
|
206
|
+
return notify({
|
|
206
207
|
message: t("auth.passwordRecoveryFailed"),
|
|
207
208
|
color: "negative",
|
|
208
209
|
position: "top",
|
|
@@ -231,7 +232,7 @@ export function useResetPassword() {
|
|
|
231
232
|
icons: {
|
|
232
233
|
ionEyeOutline,
|
|
233
234
|
ionEyeOffOutline,
|
|
234
|
-
ionLockClosedOutline
|
|
235
|
-
}
|
|
235
|
+
ionLockClosedOutline
|
|
236
|
+
}
|
|
236
237
|
}
|
|
237
238
|
}
|