|
45 | 45 | PasswordValidator.prototype.fetchDomNodes = function () { |
46 | 46 | this.form = this.passwordField.closest('form') |
47 | 47 |
|
| 48 | + this.disablePasswordChecks = this.passwordField.classList.contains('disable-password-checks') |
| 49 | + |
48 | 50 | this.passwordGroup = this.passwordField.closest('.form-group') |
49 | 51 | this.passwordFeedback = this.passwordGroup.querySelector('.form-control-feedback') |
50 | 52 | this.passwordStrengthMeter = this.passwordGroup.querySelector('.progress-bar') |
|
69 | 71 | this.errors = [] |
70 | 72 | this.resetValidation(this.passwordGroup) |
71 | 73 | this.resetFeedbackIcon(this.passwordFeedback) |
72 | | - this.displayPasswordErrors() |
73 | | - this.instantFeedbackForPassword() |
| 74 | + if (!this.disablePasswordChecks) { |
| 75 | + this.displayPasswordErrors() |
| 76 | + this.instantFeedbackForPassword() |
| 77 | + } |
74 | 78 | } |
75 | 79 |
|
76 | 80 | /** |
|
99 | 103 | PasswordValidator.prototype.validatePassword = function () { |
100 | 104 | this.errors = [] |
101 | 105 | const password = this.passwordField.value |
102 | | - const passwordStrength = this.getPasswordStrength(password) |
103 | | - this.currentStrengthLevel = this.getStrengthLevel(passwordStrength) |
104 | 106 |
|
105 | | - if (passwordStrength.errors) { |
106 | | - this.addPasswordError(passwordStrength.errors) |
107 | | - } |
| 107 | + if (!this.disablePasswordChecks) { |
| 108 | + const passwordStrength = this.getPasswordStrength(password) |
| 109 | + this.currentStrengthLevel = this.getStrengthLevel(passwordStrength) |
| 110 | + |
| 111 | + if (passwordStrength.errors) { |
| 112 | + this.addPasswordError(passwordStrength.errors) |
| 113 | + } |
108 | 114 |
|
109 | | - this.checkLeakedPassword(password).then(this.handleLeakedPasswordResponse.bind(this)) |
| 115 | + this.checkLeakedPassword(password).then(this.handleLeakedPasswordResponse.bind(this)) |
| 116 | + } |
110 | 117 |
|
111 | 118 | this.setPasswordFeedback() |
112 | 119 | } |
|
0 commit comments