@sowell/quasar-app-extension-auth 0.3.15 → 0.3.17

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.15",
3
+ "version": "0.3.17",
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,8 +1,8 @@
1
1
  <template>
2
2
  <q-layout>
3
- <q-page class="">
4
- <div class="column q-pa-lg" style="height: 80vh">
5
- <div class="column col-8 justify-center items-center">
3
+ <q-page class="column items-center">
4
+ <div class="column short-screen">
5
+ <div class="column col-7 justify-center">
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="col-4">
19
+ <div class="col-5">
20
20
  <q-form @submit="onSubmit">
21
21
  <div>
22
22
  <div
@@ -97,10 +97,10 @@
97
97
  </q-btn>
98
98
  </div>
99
99
  <div
100
- class="q-mb-lg q-mt-lg text-primary"
100
+ class="q-mb-lg q-mt-lg text-primary text-center"
101
101
  @click="forgottenPassword = true"
102
102
  data-cy="forgot-password"
103
- style="font-size: 14px; cursor: pointer"
103
+ style="font-size: 14px; cursor: pointer; width: 350px"
104
104
  >
105
105
  {{ $t("auth.forgottenPassword") }}
106
106
  </div>
@@ -234,4 +234,14 @@ 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
+ }
237
247
  </style>
@@ -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 {