[IMP] auth_password_policy: show the password meter only when needed

Bug
===
The password meter is not super pretty, so we display it only when
needed.

Task-2629544

Part-of: odoo/odoo#78298
This commit is contained in:
std-odoo
2022-06-30 12:10:56 +02:00
parent 0e6c698698
commit e46a04ce30
2 changed files with 6 additions and 0 deletions
@@ -14,3 +14,7 @@ meter.o_password_meter {
/* also input has a 5px bottom margin... */
bottom: calc(50% - 7px + 5px)
}
input + meter.o_password_meter[length="0"] {
display: none;
}
@@ -111,6 +111,7 @@ var PasswordPolicyMeter = Widget.extend({
low: 0.5,
high: 0.99,
max: 1,
length: 0,
value: 0,
optimum: 1,
},
@@ -133,6 +134,7 @@ var PasswordPolicyMeter = Widget.extend({
* @param {String} password
*/
update: function (password) {
this.el.setAttribute('length', password.length);
this.el.value = policy.computeScore(password, this._required, this._recommended);
}
});