Merge pull request #2933 from bahadirsofuoglu/Password-default-value-bug

Password component default value display issue fixed
pull/3732/head
Tuğçe Küçükoğlu 2022-11-18 10:56:32 +03:00 committed by GitHub
commit 313407d67f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 33 additions and 10 deletions

View File

@ -100,6 +100,9 @@ export default {
this.infoText = this.promptText;
this.mediumCheckRegExp = new RegExp(this.mediumRegex);
this.strongCheckRegExp = new RegExp(this.strongRegex);
if(this.value){
this.d_value = this.value;
}
},
beforeDestroy() {
this.restoreAppend();
@ -166,6 +169,7 @@ export default {
onFocus(event) {
this.focused = true;
if (this.feedback) {
this.setPasswordMeter()
this.overlayVisible = true;
}
this.$emit('focus', event);
@ -180,9 +184,34 @@ export default {
onKeyUp(event) {
if (this.feedback) {
let value = event.target.value;
let label = null;
let meter = null;
switch (this.testStrength(value)) {
const {meter,label} = this.checkPasswordStrength(value);
this.meter = meter;
this.infoText = label;
if (!this.overlayVisible) {
this.overlayVisible = true;
}
}
this.$emit('keyup', event);
},
setPasswordMeter() {
if(!this.feedback || !this.d_value) return;
const {meter,label} = this.checkPasswordStrength(this.d_value);
this.meter = meter;
this.infoText = label;
if (!this.overlayVisible) {
this.overlayVisible = true;
}
},
checkPasswordStrength(value) {
let label = null;
let meter = null;
switch (this.testStrength(value)) {
case 1:
label = this.weakText;
meter = {
@ -208,15 +237,9 @@ export default {
label = this.promptText;
meter = null;
break;
}
this.meter = meter;
this.infoText = label;
if (!this.overlayVisible) {
this.overlayVisible = true;
}
}
this.$emit('keyup', event);
return { label, meter };
},
bindScrollListener() {
if (!this.scrollHandler) {