@sowell/quasar-app-extension-auth 0.3.16 → 0.3.18
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,8 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<q-layout>
|
|
3
|
-
<q-page class="column items-center">
|
|
4
|
-
<div class="column
|
|
5
|
-
<div class="column
|
|
3
|
+
<q-page class="column justify-end items-center">
|
|
4
|
+
<div class="column">
|
|
5
|
+
<div class="column justify-center" style="height: 35vh">
|
|
6
6
|
<div class="row justify-center">
|
|
7
7
|
<img
|
|
8
8
|
src="../../assets/Logo.svg"
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
/>
|
|
17
17
|
</div>
|
|
18
18
|
</div>
|
|
19
|
-
<div class="
|
|
19
|
+
<div class="">
|
|
20
20
|
<q-form @submit="onSubmit">
|
|
21
21
|
<div>
|
|
22
22
|
<div
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
</q-btn>
|
|
98
98
|
</div>
|
|
99
99
|
<div
|
|
100
|
-
class="q-mb-
|
|
100
|
+
class="q-mb-xl q-mt-lg text-primary text-center"
|
|
101
101
|
@click="forgottenPassword = true"
|
|
102
102
|
data-cy="forgot-password"
|
|
103
103
|
style="font-size: 14px; cursor: pointer; width: 350px"
|
|
@@ -234,14 +234,4 @@ export default defineComponent({
|
|
|
234
234
|
div.q-field__messages {
|
|
235
235
|
display: none;
|
|
236
236
|
}
|
|
237
|
-
|
|
238
|
-
.short-screen {
|
|
239
|
-
height: 80vh;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
@media screen and (max-height: 680px) {
|
|
243
|
-
.short-screen {
|
|
244
|
-
height: 65vh;
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
237
|
</style>
|
package/src/composables/auth.ts
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
ionEyeSharp,
|
|
10
10
|
ionEyeOffSharp,
|
|
11
11
|
} from "@quasar/extras/ionicons-v5";
|
|
12
|
+
import { useQuasar, Platform } from "quasar";
|
|
12
13
|
|
|
13
14
|
import { $prompts, $router, useAuthState } from "../injects";
|
|
14
15
|
|
|
@@ -20,6 +21,8 @@ interface HeadersInterface {
|
|
|
20
21
|
|
|
21
22
|
export function useAuth() {
|
|
22
23
|
const authState = useAuthState();
|
|
24
|
+
const { localStorage } = useQuasar();
|
|
25
|
+
|
|
23
26
|
const { t } = useI18n();
|
|
24
27
|
const {
|
|
25
28
|
LOCAL_SUCCESS_REDIRECTION_ROUTE,
|
|
@@ -86,6 +89,17 @@ export function useAuth() {
|
|
|
86
89
|
|
|
87
90
|
try {
|
|
88
91
|
await authState.signin(data, options);
|
|
92
|
+
// @ts-ignore
|
|
93
|
+
if (!window.Cypress) {
|
|
94
|
+
const isDifferentUser =
|
|
95
|
+
!localStorage.has("credentials") ||
|
|
96
|
+
// @ts-ignore
|
|
97
|
+
localStorage.getItem("credentials").email !== data.auth.email;
|
|
98
|
+
|
|
99
|
+
if (isDifferentUser) {
|
|
100
|
+
localStorage.set("credentials", data.auth);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
89
103
|
push(LOCAL_SUCCESS_REDIRECTION_ROUTE);
|
|
90
104
|
loading.value = false;
|
|
91
105
|
} catch (err) {
|
|
@@ -102,10 +116,22 @@ export function useAuth() {
|
|
|
102
116
|
);
|
|
103
117
|
};
|
|
104
118
|
|
|
119
|
+
const deviceReady = () => {
|
|
120
|
+
if (localStorage.has("credentials")) {
|
|
121
|
+
// @ts-ignore
|
|
122
|
+
email.value = localStorage.getItem("credentials").email;
|
|
123
|
+
// @ts-ignore
|
|
124
|
+
password.value = localStorage.getItem("credentials").password;
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
|
|
105
128
|
onMounted(() => {
|
|
106
129
|
if (authState.raw) {
|
|
107
130
|
replace(LOCAL_SUCCESS_REDIRECTION_ROUTE);
|
|
108
131
|
}
|
|
132
|
+
if (Platform.is.capacitor) {
|
|
133
|
+
deviceReady();
|
|
134
|
+
}
|
|
109
135
|
});
|
|
110
136
|
|
|
111
137
|
return {
|