signup, settings: Update password strength meter on input events.

Pasting a generated password into the password box triggers neither a
change event (until the password box is unfocused) nor a keyup event.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
Anders Kaseorg 2019-06-26 20:44:25 -07:00 committed by Tim Abbott
parent a264c84397
commit 12e6189970
2 changed files with 2 additions and 2 deletions

View File

@ -13,7 +13,7 @@ $(function () {
// was just reloaded due to a validation failure on the backend. // was just reloaded due to a validation failure on the backend.
common.password_quality(password_field.val(), $('#pw_strength .bar'), password_field); common.password_quality(password_field.val(), $('#pw_strength .bar'), password_field);
password_field.on('change keyup', function () { password_field.on('input', function () {
// Update the password strength bar even if we aren't validating // Update the password strength bar even if we aren't validating
// the field yet. // the field yet.
common.password_quality($(this).val(), $('#pw_strength .bar'), $(this)); common.password_quality($(this).val(), $('#pw_strength .bar'), $(this));

View File

@ -372,7 +372,7 @@ exports.set_up = function () {
}); });
}); });
$('#new_password').on('change keyup', function () { $('#new_password').on('input', function () {
var field = $('#new_password'); var field = $('#new_password');
common.password_quality(field.val(), $('#pw_strength .bar'), field); common.password_quality(field.val(), $('#pw_strength .bar'), field);
}); });