@sowell/quasar-app-extension-auth 1.4.3 → 1.4.5

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sowell/quasar-app-extension-auth",
3
- "version": "1.4.3",
3
+ "version": "1.4.5",
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",
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <q-layout
3
- class="column justify-start items-center q-pb-lg bg-white"
4
- style="min-height: 90vh; max-width: 100vw; overflow-x: hidden">
3
+ class="column justify-start items-center q-pb-lg bg-white reporter-auth-page"
4
+ style="max-width: 100vw; overflow-x: hidden">
5
5
  <div class="background-logo-container">
6
6
  <img
7
7
  src="../../assets/Background-logo.svg"
@@ -260,7 +260,7 @@ export default defineComponent({
260
260
  try {
261
261
  forgottenPassword.value = false
262
262
  await authState.resetPassword(data).then(() => {
263
- localStorage.setItem("emailResetPassword", email)
263
+ localStorage.set("emailResetPassword", email)
264
264
  sendEmailCode.value = 200
265
265
  isReset.value = true
266
266
  })
@@ -276,10 +276,17 @@ export default defineComponent({
276
276
  }
277
277
 
278
278
  const goToPrivacyPolicy = async () => {
279
- await InAppBrowser.openInSystemBrowser({
280
- url: "https://sowell.app/privacy-policy-sowell/",
281
- options: DefaultSystemBrowserOptions
282
- })
279
+ const privacyPolicyUrl = "https://sowell.app/privacy-policy-sowell/"
280
+ try {
281
+ await InAppBrowser.openInSystemBrowser({
282
+ url: privacyPolicyUrl,
283
+ options: DefaultSystemBrowserOptions
284
+ })
285
+ } catch (error) {
286
+ if (typeof window !== "undefined") {
287
+ window.open(privacyPolicyUrl, "_blank")
288
+ }
289
+ }
283
290
  }
284
291
 
285
292
  onMounted(() => {
@@ -99,7 +99,7 @@ export default defineComponent({
99
99
  setup() {
100
100
  const { t } = useI18n()
101
101
  const router = $router()
102
- const $q = useQuasar()
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.setItem(
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
- $q.notify({
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
- }).finaly(() => {
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 $q = useQuasar()
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.removeItem("emailResetPassword")
132
- localStorage.removeItem("userInfos")
132
+ localStorage.remove("emailResetPassword")
133
+ localStorage.remove("userInfos")
133
134
  })
134
135
  .catch(() => {
135
136
  loading.value = false
136
- $q.notify({
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 $q.notify({
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 $q.notify({
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 $q.notify({
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
  }