Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions assets/js/checkout.js
Original file line number Diff line number Diff line change
Expand Up @@ -873,6 +873,13 @@

this.request('wu_validate_form', form_data, function (results) {

// Safari/iOS autofill does NOT fire keyup/input events, so
// valid_password may be stale at submit time. Force a
// synchronous re-check before deciding to show the error.
if (! that.valid_password && that.password_strength_checker) {
that.password_strength_checker.checkStrength();
}

if (! that.valid_password) {

that.errors.push({
Expand Down
27 changes: 24 additions & 3 deletions assets/js/wu-password-strength.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,38 @@
// Set initial message
this.options.result.html(this.getStrengthLabel('empty'));

// Bind events
this.options.pass1.on('keyup input', function() {
// Bind events.
// Include 'change' for Safari/iOS autofill which does NOT fire
// keyup/input when auto-generating or pasting passwords (WebKit bug).
this.options.pass1.on('keyup input change', function() {
self.checkStrength();
});

if (this.options.pass2 && this.options.pass2.length) {
this.options.pass2.on('keyup input', function() {
this.options.pass2.on('keyup input change', function() {
self.checkStrength();
});
}

// Safari autofill detection — poll for value changes that bypass all
// DOM events (known WebKit bug). Stops after 60 seconds to avoid
// unnecessary CPU usage once the user has had time to fill the form.
this._lastPass1Val = '';
this._autofillPoll = setInterval(function() {
var currentVal = self.options.pass1.val();
if (currentVal !== self._lastPass1Val) {
self._lastPass1Val = currentVal;
self.checkStrength();
}
}, 1000);

setTimeout(function() {
if (self._autofillPoll) {
clearInterval(self._autofillPoll);
self._autofillPoll = null;
}
}, 60000);

// Disable submit initially if provided
if (this.options.submit && this.options.submit.length) {
this.options.submit.prop('disabled', true);
Expand Down
2 changes: 1 addition & 1 deletion assets/js/wu-password-strength.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading