@sowell/quasar-app-extension-auth 0.4.2 → 0.4.4

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.4.2",
3
+ "version": "0.4.4",
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 @@
9
9
  <div class="q-pl-md q-pr-md" style="max-width: 500px">
10
10
  <h4 class="title">{{ WELCOME_TITLE }}</h4>
11
11
  <div class="subtitle">{{ WELCOME_SUBTITLE }}</div>
12
- <q-form @submit="onSubmit">
12
+ <q-form @submit="handleSubmit">
13
13
  <div>
14
14
  <div class="q-ml-xs q-mb-xs text-subtitle2 text-weight-bold">
15
15
  {{ $t("auth.email") }}
@@ -160,6 +160,10 @@ export default defineComponent({
160
160
  icons,
161
161
  } = useAuth();
162
162
 
163
+ const handleSubmit = () => {
164
+ onSubmit()
165
+ }
166
+
163
167
  const IS_ADMIN = ["admin"].includes(X_REQUESTED_ROLES);
164
168
  const isNotification = ref(false);
165
169
  const requestedOtp = ref(false);
@@ -232,7 +236,7 @@ export default defineComponent({
232
236
  goToOtpValidation,
233
237
  resetPassword,
234
238
  retypeEmail,
235
- onSubmit,
239
+ handleSubmit,
236
240
  icons,
237
241
  };
238
242
  },
@@ -92,7 +92,7 @@
92
92
  :loading="loading"
93
93
  type="submit"
94
94
  class="full-width q-mt-lg"
95
- :disable="isSubmitBtnDisabled()"
95
+ :disable="isSubmitBtnDisabled() || loading || msalLoading"
96
96
  />
97
97
  <div
98
98
  class="q-mb-lg q-mt-xl text-primary"
@@ -125,7 +125,8 @@
125
125
  no-caps
126
126
  unelevated
127
127
  text-color="black"
128
- :loading="loading"
128
+ :loading="msalLoading"
129
+ :disable="msalLoading || loading"
129
130
  :icon="`img:${MicrosoftLogo}`"
130
131
  class="full-width q-mt-lg"
131
132
  @click="msalAuth"
@@ -183,6 +184,7 @@ export default defineComponent({
183
184
  email,
184
185
  password,
185
186
  loading,
187
+ msalLoading,
186
188
  showPassword,
187
189
  validations,
188
190
  forgottenPassword,
@@ -233,6 +235,7 @@ export default defineComponent({
233
235
  email,
234
236
  password,
235
237
  loading,
238
+ msalLoading,
236
239
  showPassword,
237
240
  validations,
238
241
  forgottenPassword,
@@ -17,7 +17,7 @@
17
17
  </div>
18
18
  </div>
19
19
  <div class="">
20
- <q-form @submit="onSubmit">
20
+ <q-form @submit="handleSubmit">
21
21
  <div>
22
22
  <div
23
23
  class="q-ml-xs q-mb-xs"
@@ -187,6 +187,10 @@ export default defineComponent({
187
187
  icons,
188
188
  } = useAuth();
189
189
 
190
+ const handleSubmit = () => {
191
+ onSubmit()
192
+ }
193
+
190
194
  const appVersion = reactive({
191
195
  versionNumber: "",
192
196
  });
@@ -229,7 +233,7 @@ export default defineComponent({
229
233
  emailResetPassword,
230
234
  isReset,
231
235
  sendEmailSuccess,
232
- onSubmit,
236
+ handleSubmit,
233
237
  resetPassword,
234
238
  goToOtpValidation,
235
239
  isSubmitBtnDisabled,
@@ -17,7 +17,8 @@
17
17
  no-caps
18
18
  unelevated
19
19
  text-color="black"
20
- :loading="loading"
20
+ :loading="msalLoading"
21
+ :disable="msalLoading || loading"
21
22
  :icon="`img:${MicrosoftLogo}`"
22
23
  class="full-width q-mt-lg"
23
24
  @click="msalAuth"
@@ -99,7 +100,7 @@
99
100
  text-color="white"
100
101
  :loading="loading"
101
102
  type="submit"
102
- :disable="isSubmitBtnDisabled()"
103
+ :disable="isSubmitBtnDisabled() || loading || msalLoading"
103
104
  class="submitBtn text-subtitle2 text-weight-bold"
104
105
  />
105
106
  <div
@@ -193,6 +194,7 @@ export default defineComponent({
193
194
  email,
194
195
  password,
195
196
  loading,
197
+ msalLoading,
196
198
  showPassword,
197
199
  validations,
198
200
  forgottenPassword,
@@ -275,6 +277,7 @@ export default defineComponent({
275
277
  infoDialog,
276
278
  password,
277
279
  loading,
280
+ msalLoading,
278
281
  showPassword,
279
282
  validations,
280
283
  submitBtnDisabled,
@@ -287,14 +290,14 @@ export default defineComponent({
287
290
  isSubmitBtnDisabled,
288
291
  requestedOtp,
289
292
  goToOtpValidation,
290
- resetPassword,
291
293
  retypeEmail,
292
294
  onSubmit,
293
295
  icons,
294
296
  USE_SSO,
295
297
  MicrosoftLogo,
296
- handleSubmit,
297
298
  msalAuth,
299
+ resetPassword,
300
+ handleSubmit,
298
301
  };
299
302
  },
300
303
  });
@@ -54,6 +54,7 @@ export function useAuth() {
54
54
  const password = ref("");
55
55
  const msalToken = ref("");
56
56
  const loading = ref(false);
57
+ const msalLoading = ref(false);
57
58
  const showPassword = ref(false);
58
59
  const forgottenPassword = ref(false);
59
60
  const isReset = ref(false);
@@ -101,7 +102,9 @@ export function useAuth() {
101
102
  };
102
103
 
103
104
  const onSubmit = async (provider = "SoWell") => {
104
- loading.value = true;
105
+ if (provider === "SoWell") {
106
+ loading.value = true;
107
+ }
105
108
  const data: SignInPayload = {
106
109
  auth: {
107
110
  email: email.value,
@@ -133,6 +136,7 @@ export function useAuth() {
133
136
  try {
134
137
  await authState.signin(data, options);
135
138
  loading.value = false;
139
+ msalLoading.value = false;
136
140
  // @ts-ignore
137
141
  if (!window.Cypress) {
138
142
  // FIXME: encrypt password
@@ -145,6 +149,7 @@ export function useAuth() {
145
149
  } catch (err) {
146
150
  console.error("onSubmit", err);
147
151
  loading.value = false;
152
+ msalLoading.value = false;
148
153
  }
149
154
  };
150
155
 
@@ -171,6 +176,7 @@ export function useAuth() {
171
176
  };
172
177
 
173
178
  const msalAuth = () => {
179
+ msalLoading.value = true;
174
180
  msalState.signIn().then(
175
181
  async (result) => {
176
182
  email.value = result.email;
@@ -195,6 +201,7 @@ export function useAuth() {
195
201
  email,
196
202
  password,
197
203
  loading,
204
+ msalLoading,
198
205
  showPassword,
199
206
  validations,
200
207
  errorEmailMessage,
@@ -211,6 +218,8 @@ export function useAuth() {
211
218
  IS_OTP,
212
219
  LOCAL_OTP_ROUTE,
213
220
  USE_SSO,
221
+ msalState,
222
+ msalAuth,
214
223
  goToOtpValidation,
215
224
  onSubmit,
216
225
  retypeEmail,
@@ -223,7 +232,5 @@ export function useAuth() {
223
232
  ionEyeSharp,
224
233
  ionEyeOffSharp,
225
234
  },
226
- msalState,
227
- msalAuth,
228
235
  };
229
236
  }