@sowell/quasar-app-extension-auth 0.3.18 → 0.3.20
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 +1 -1
- package/src/composables/auth.ts +11 -16
package/package.json
CHANGED
package/src/composables/auth.ts
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
ionEyeSharp,
|
|
10
10
|
ionEyeOffSharp,
|
|
11
11
|
} from "@quasar/extras/ionicons-v5";
|
|
12
|
-
import {
|
|
12
|
+
import { Platform } from "quasar";
|
|
13
13
|
|
|
14
14
|
import { $prompts, $router, useAuthState } from "../injects";
|
|
15
15
|
|
|
@@ -21,7 +21,6 @@ interface HeadersInterface {
|
|
|
21
21
|
|
|
22
22
|
export function useAuth() {
|
|
23
23
|
const authState = useAuthState();
|
|
24
|
-
const { localStorage } = useQuasar();
|
|
25
24
|
|
|
26
25
|
const { t } = useI18n();
|
|
27
26
|
const {
|
|
@@ -88,23 +87,19 @@ export function useAuth() {
|
|
|
88
87
|
if (requestedRoles) options.headers["x-requested-roles"] = requestedRoles;
|
|
89
88
|
|
|
90
89
|
try {
|
|
91
|
-
await authState.signin(data, options)
|
|
90
|
+
await authState.signin(data, options)
|
|
91
|
+
loading.value = false;
|
|
92
92
|
// @ts-ignore
|
|
93
93
|
if (!window.Cypress) {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
// @ts-ignore
|
|
97
|
-
localStorage.getItem("credentials").email !== data.auth.email;
|
|
98
|
-
|
|
99
|
-
if (isDifferentUser) {
|
|
100
|
-
localStorage.set("credentials", data.auth);
|
|
101
|
-
}
|
|
94
|
+
// FIXME: encrypt password
|
|
95
|
+
localStorage.setItem("credentials", JSON.stringify(data.auth))
|
|
102
96
|
}
|
|
103
97
|
push(LOCAL_SUCCESS_REDIRECTION_ROUTE);
|
|
104
|
-
|
|
105
|
-
|
|
98
|
+
}
|
|
99
|
+
catch(err) {
|
|
106
100
|
loading.value = false;
|
|
107
101
|
}
|
|
102
|
+
|
|
108
103
|
};
|
|
109
104
|
|
|
110
105
|
const isSubmitBtnDisabled = () => {
|
|
@@ -117,11 +112,11 @@ export function useAuth() {
|
|
|
117
112
|
};
|
|
118
113
|
|
|
119
114
|
const deviceReady = () => {
|
|
120
|
-
if (localStorage.
|
|
115
|
+
if (localStorage.getItem("credentials")) {
|
|
121
116
|
// @ts-ignore
|
|
122
|
-
email.value = localStorage.getItem("credentials").email;
|
|
117
|
+
email.value = JSON.parse(localStorage.getItem("credentials")).email;
|
|
123
118
|
// @ts-ignore
|
|
124
|
-
password.value = localStorage.getItem("credentials").password;
|
|
119
|
+
password.value = JSON.parse(localStorage.getItem("credentials")).password;
|
|
125
120
|
}
|
|
126
121
|
};
|
|
127
122
|
|