Skip to content

Commit a1c6361

Browse files
authored
GH#915: fix: emit wu_inline_login_error hook in pre-submit catch block
Resolves #915 When wu_before_inline_login_submitted rejects, fire wu_inline_login_error so addon captcha/widget resets run on this failure path, mirroring the AJAX error handler.
1 parent 0b4cdca commit a1c6361

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

assets/js/checkout.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1229,6 +1229,25 @@
12291229

12301230
this.logging_in = false;
12311231
this.login_error = (err && err.message) ? err.message : (wu_checkout.i18n.login_failed || 'Login failed. Please try again.');
1232+
1233+
/**
1234+
* Fires when an inline login attempt fails due to a rejected
1235+
* wu_before_inline_login_submitted promise.
1236+
*
1237+
* Mirrors the failure hook emitted by the AJAX error path so that
1238+
* addons (e.g. captcha widgets) can reset themselves regardless of
1239+
* which failure path was taken.
1240+
*
1241+
* @param {Object} error Object containing the error message and originalError.
1242+
* @param {string} field_type The field type ('email' or 'username').
1243+
*/
1244+
hooks.doAction('wu_inline_login_error', {
1245+
data: {
1246+
message: this.login_error,
1247+
},
1248+
originalError: err,
1249+
}, field_type);
1250+
12321251
return false;
12331252

12341253
}

0 commit comments

Comments
 (0)