From a5b840f11bcc956f06d4a513ccc61846085d5632 Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Wed, 16 Sep 2020 12:20:35 -0400 Subject: [PATCH] =?UTF-8?q?chore:=20=F0=9F=A4=96=20reset=20password=20befo?= =?UTF-8?q?re=20executing=20function?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/form/account/password/index.js | 11 +++------- .../account/password/set-password/index.js | 21 +++++-------------- 2 files changed, 8 insertions(+), 24 deletions(-) diff --git a/ui/core/app/components/form/account/password/index.js b/ui/core/app/components/form/account/password/index.js index 02f208746..e80e48c95 100644 --- a/ui/core/app/components/form/account/password/index.js +++ b/ui/core/app/components/form/account/password/index.js @@ -30,13 +30,8 @@ export default class FormAccountPasswordIndexComponent extends Component { */ @action submit(fn) { - try { - this.args.model.isNew ? fn(this.password) : fn(); - } catch (e) { - // We want to guarantee password is unset - this.resetPassword(); - // But we don't want to silence the error - throw e; - } + const password = this.password; + this.resetPassword(); + this.args.model.isNew ? fn(password) : fn(); } } diff --git a/ui/core/app/components/form/account/password/set-password/index.js b/ui/core/app/components/form/account/password/set-password/index.js index 2449d4c6f..477c14cee 100644 --- a/ui/core/app/components/form/account/password/set-password/index.js +++ b/ui/core/app/components/form/account/password/set-password/index.js @@ -39,14 +39,9 @@ export default class FormAccountPasswordSetPasswordIndexComponent extends Compon */ @action submit(fn) { - try { - fn(this.password); - } catch (e) { - // We want to guarantee password is unset - this.resetPassword(); - // But we don't want to silence the error - throw e; - } + const password = this.password; + this.resetPassword(); + fn(password); } /** @@ -55,14 +50,8 @@ export default class FormAccountPasswordSetPasswordIndexComponent extends Compon */ @action cancel(fn) { - try { - fn(); - } catch (e) { - // We want to guarantee password is unset - this.resetPassword(); - // But we don't want to silence the error - throw e; - } + this.resetPassword(); + fn(); } }