From 023ec9a976055da329c016caad1556f56c198a16 Mon Sep 17 00:00:00 2001 From: rr- Date: Sun, 14 Aug 2016 16:57:46 +0200 Subject: [PATCH] client/password-reset: fix event binding Every time the password reset form was loaded, the form submit event listener was attached to a non-disposable DOM node rather than the DOM node whose life scope was bound to the viewed page. As such, submitting the form, leaving the page, returning back to it and sending the request again caused the 'submit' event to fire twice - one time from the non-disposed event handler and one from the current handler. This resulted in the request being sent twice, and getting two confirmation messages on the screen. Fortunately, since the password reset requests are GET requests, they're intercepted by the internal cache of the client API facade, so the client just saw duplicate messages without the requests being actually sent to the backend - meaning no extra mails were sent. --- client/js/views/password_reset_view.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/js/views/password_reset_view.js b/client/js/views/password_reset_view.js index d817a04..38ac719 100644 --- a/client/js/views/password_reset_view.js +++ b/client/js/views/password_reset_view.js @@ -14,7 +14,7 @@ class PasswordResetView extends events.EventTarget { views.syncScrollPosition(); views.decorateValidator(this._formNode); - this._hostNode.addEventListener('submit', e => { + this._formNode.addEventListener('submit', e => { e.preventDefault(); this.dispatchEvent(new CustomEvent('submit', { detail: {