@@ -19,7 +19,9 @@ General purpose password field component.
1919 <NcPasswordField v-model="text2"
2020 id="textField"
2121 :label-outside="true"
22- placeholder="Min. 12 characters" />
22+ placeholder="Min. 12 characters"
23+ :success="true"
24+ helper-text="Password is secure" />
2325 </div>
2426 <div class="external-label">
2527 <label for="textField2">New password</label>
@@ -32,10 +34,9 @@ General purpose password field component.
3234 </div>
3335
3436 <NcPasswordField v-model="text4"
35- label="Good new password"
36- :success="true"
37- placeholder="Min. 12 characters"
38- helper-text="Password is secure">
37+ label="Validate new password"
38+ check-password-strength
39+ placeholder="Min. 12 characters">
3940 <template #icon>
4041 <IconLockOutline :size="20" />
4142 </template>
@@ -57,7 +58,7 @@ export default {
5758 data() {
5859 return {
5960 text1: '',
60- text2: '',
61+ text2: 'FWZxt29XEoTQfnBEa ',
6162 text3: 'hunter',
6263 text4: '',
6364 text5: '',
@@ -152,8 +153,6 @@ const emit = defineEmits<{
152153 invalid: []
153154}>()
154155
155- watch (modelValue , debounce (checkPassword , 500 ))
156-
157156// public API
158157defineExpose ({
159158 focus ,
@@ -232,12 +231,19 @@ const minLengthWithPolicy = computed(() => {
232231 ?? undefined
233232})
234233
234+ watch (modelValue , () => {
235+ // Reset internal validation state on value change, before debounced checkPassword() is called
236+ isValid .value = undefined
237+ internalHelpMessage .value = ' '
238+ })
239+ watch (modelValue , debounce (checkPassword , 500 ))
240+
235241/**
236242 * Validate the entered password.
237243 * If available this method will use the password-policy app API to validate the password.
238244 */
239245async function checkPassword() {
240- if (! props .checkPasswordStrength ) {
246+ if (! props .checkPasswordStrength || ! modelValue . value ) {
241247 return
242248 }
243249
0 commit comments