@sowell/quasar-app-extension-auth 1.10.0 → 1.11.0

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,16 +1,16 @@
1
1
  {
2
2
  "name": "@sowell/quasar-app-extension-auth",
3
- "version": "1.10.0",
3
+ "version": "1.11.0",
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",
7
7
  "scripts": {
8
- "lint": "cd dev && eslint --ext .js,.ts,.vue ./",
8
+ "lint": "eslint --ext .js,.ts,.vue ./",
9
9
  "dev": "cd dev && quasar dev",
10
10
  "dep": "cd dev && yarn",
11
11
  "test:link": "cd dev && yarn test:link",
12
12
  "test:browser": "cd dev && yarn test:browser",
13
- "test": "cd dev && yarn test"
13
+ "test": "vitest run"
14
14
  },
15
15
  "keywords": [],
16
16
  "author": "SoWell SAS",
@@ -34,7 +34,10 @@
34
34
  "eslint-plugin-vue": "^7.0.0",
35
35
  "jwt-decode": "^3.1.2",
36
36
  "quasar": "^2.8.4",
37
- "typescript": "^4.4.2"
37
+ "typescript": "^4.4.2",
38
+ "vitest": "^4.1.11",
39
+ "vue": "^3.2.0",
40
+ "vue-i18n": "^9"
38
41
  },
39
42
  "directories": {
40
43
  "test": "test"
@@ -90,9 +90,7 @@
90
90
  type="submit"
91
91
  class="full-width q-mt-lg login-button"
92
92
  :disable="isSubmitBtnDisabled()">
93
- <div style="font-weight: 500; font-size: 18px">
94
- {{ $t("auth.login") }}
95
- </div>
93
+ {{ $t("auth.login") }}
96
94
  </q-btn>
97
95
  </div>
98
96
  <template v-if="USE_SSO">
@@ -415,9 +413,12 @@ export default defineComponent({
415
413
  padding-bottom: 0;
416
414
  }
417
415
 
418
- .login-button {
416
+ .login-button,
417
+ .sso-btn {
419
418
  border-radius: 15px;
420
- height: 50px;
419
+ height: 62px;
420
+ font-size: 17px;
421
+ font-weight: 600;
421
422
  }
422
423
 
423
424
  .forgot-password-link {
@@ -458,19 +459,15 @@ export default defineComponent({
458
459
  }
459
460
 
460
461
  .btn-icon {
461
- width: 16px;
462
- height: 16px;
462
+ width: 18px;
463
+ height: 18px;
463
464
  margin-right: 8px;
464
465
  }
465
466
 
466
467
  .sso-btn {
467
- font-size: 14px;
468
- border-radius: 8px;
469
- height: 50px;
470
- font-weight: 600;
471
468
  background: #ebeeef;
472
469
  color: #112240;
473
- }
470
+ }
474
471
 
475
472
  .error_input {
476
473
  min-height: 50px;
@@ -558,11 +555,8 @@ export default defineComponent({
558
555
  }
559
556
 
560
557
  .login-button, .sso-btn {
561
- height: 40px;
562
- }
563
-
564
- .login-button div {
565
- font-size: 14px !important;
558
+ height: 52px;
559
+ font-size: 15px;
566
560
  }
567
561
 
568
562
  .error_input {
@@ -124,6 +124,9 @@ export function useMagicLink() {
124
124
  }
125
125
 
126
126
  const requestChannels = async () => {
127
+ // Quasar's `loading` does not disable the button: Enter would resubmit and send
128
+ // a second e-mail, invalidating the first link (the API replaces the token).
129
+ if (isLoading.value) return
127
130
  apiErrorMessage.value = ""
128
131
  if (!validateEmail()) return
129
132
  isLoading.value = true
@@ -138,14 +141,21 @@ export function useMagicLink() {
138
141
  channels.value = offered.length ? offered : ["email"]
139
142
  channelTargets.value = targets
140
143
  selectedChannel.value = "email"
144
+ // Nothing to choose when only e-mail is offered (user without phone, or an
145
+ // app restricted to e-mail): send the link straight away.
146
+ if (channels.value.length === 1 && channels.value[0] === "email") {
147
+ await sendMagicLink("email")
148
+ return
149
+ }
141
150
  step.value = "channel"
142
151
  } catch (error) {
143
152
  const axiosError = error as AxiosError
144
153
  if (axiosError.response?.status === 403) {
145
- // Backend check: ENV["COMPANY_RESET_PASSWORD_FORBIDDEN"] vs user.company_id,
146
- // rescued as Rescueable::Forbidden with i18n key errors.magiclink.forbidden.
147
- // No pre-flight signal exists (no Company.config field, nothing on /me) - the
148
- // front can only ever find out by attempting the call, hence no button hiding.
154
+ // Backend check: the user's company (or its master/slaves) has
155
+ // `no_password_reset` set, rescued as Rescueable::Forbidden with i18n key
156
+ // errors.magiclink.forbidden. No pre-flight signal exists on the front, so
157
+ // it only finds out by attempting the call, hence no button hiding. The
158
+ // same 403 can come from the automatic send in requestChannels.
149
159
  restricted.value = true
150
160
  restrictedMessage.value = readApiError(error) || ""
151
161
  } else if (axiosError.response?.status === 404) {