@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sowell/quasar-app-extension-auth",
3
- "version": "0.3.18",
3
+ "version": "0.3.20",
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",
@@ -9,7 +9,7 @@ import {
9
9
  ionEyeSharp,
10
10
  ionEyeOffSharp,
11
11
  } from "@quasar/extras/ionicons-v5";
12
- import { useQuasar, Platform } from "quasar";
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
- 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
- }
94
+ // FIXME: encrypt password
95
+ localStorage.setItem("credentials", JSON.stringify(data.auth))
102
96
  }
103
97
  push(LOCAL_SUCCESS_REDIRECTION_ROUTE);
104
- loading.value = false;
105
- } catch (err) {
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.has("credentials")) {
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