@sowell/quasar-app-extension-auth 1.6.0 → 1.6.1

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": "1.6.0",
3
+ "version": "1.6.1",
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",
@@ -70,6 +70,7 @@
70
70
  </div>
71
71
  <q-input
72
72
  id="confirmPassword"
73
+ ref="confirmPasswordInput"
73
74
  v-model="confirmPassword"
74
75
  data-testid="confirm-password-input"
75
76
  data-cy="reset-confirm-password"
@@ -175,6 +176,7 @@ export default defineComponent({
175
176
  passwordRequirements,
176
177
  LOCAL_LOGIN_ROUTE,
177
178
  canSubmit,
179
+ confirmPasswordInput,
178
180
  onSubmit,
179
181
  goToLoginPage,
180
182
  icons
@@ -201,6 +203,7 @@ export default defineComponent({
201
203
  LOCAL_LOGIN_ROUTE,
202
204
  validations,
203
205
  passwordRequirements,
206
+ confirmPasswordInput,
204
207
  icons,
205
208
  onSubmit,
206
209
  goToLoginPage
@@ -44,6 +44,7 @@
44
44
 
45
45
  <q-input
46
46
  id="confirmPassword"
47
+ ref="confirmPasswordInput"
47
48
  v-model="confirmPassword"
48
49
  data-testid="confirm-password-input"
49
50
  data-cy="reset-confirm-password"
@@ -164,6 +165,7 @@ export default defineComponent({
164
165
  passwordRequirements,
165
166
  LOCAL_LOGIN_ROUTE,
166
167
  canSubmit,
168
+ confirmPasswordInput,
167
169
  onSubmit,
168
170
  goToLoginPage,
169
171
  icons
@@ -190,6 +192,7 @@ export default defineComponent({
190
192
  showConfirmPassword,
191
193
  successTitleRef,
192
194
  LOCAL_LOGIN_ROUTE,
195
+ confirmPasswordInput,
193
196
  icons,
194
197
  goToLoginPage,
195
198
  onSubmit
@@ -1,7 +1,7 @@
1
1
  import { useQuasar, LocalStorage } from "quasar"
2
2
  import { useI18n } from "vue-i18n"
3
3
  import jwt from "jwt-decode"
4
- import { computed, ref, Ref, onMounted } from "vue"
4
+ import { computed, ref, Ref, onMounted, watch } from "vue"
5
5
  import {
6
6
  ionCloseOutline,
7
7
  ionEyeOutline,
@@ -32,6 +32,8 @@ export function useResetPassword() {
32
32
  uid: string
33
33
  token: string
34
34
  }
35
+ type ValidatableInput = { resetValidation: () => void }
36
+ const confirmPasswordInput = ref<ValidatableInput | null>(null)
35
37
 
36
38
  const { patch, post } = $api()
37
39
  const router = $router()
@@ -101,9 +103,17 @@ export function useResetPassword() {
101
103
  ]
102
104
  }
103
105
 
106
+ // Quasar's lazy-rules only re-validates the confirmation field on blur/submit,
107
+ // never while typing. Without this, correcting the field after an error was
108
+ // shown (e.g. clearing it, then retyping) leaves the previous, now-stale
109
+ // error message on screen until the field is blurred again.
110
+ watch([password, confirmPassword], () => {
111
+ confirmPasswordInput.value?.resetValidation()
112
+ })
113
+
104
114
  const KNOWN_API_PASSWORD_ERRORS: Array<{ pattern: RegExp; key: string }> = [
105
115
  {
106
- pattern: /simple sequence of \d+ characters/i,
116
+ pattern: /simple sequence of \d\+ characters/i,
107
117
  key: "auth.passwordSequenceError"
108
118
  },
109
119
  {
@@ -295,6 +305,7 @@ export function useResetPassword() {
295
305
  passwordRequirements,
296
306
  canSubmit,
297
307
  LOCAL_LOGIN_ROUTE,
308
+ confirmPasswordInput,
298
309
  onSubmit,
299
310
  goToLoginPage,
300
311
  icons: {