chore: 🤖 reset password before executing function

This commit is contained in:
Randall Morey committed 2020-09-16 12:20:35 -04:00
1 parent b1230a4b3f
commit a5b840f11b
2 files changed
+8 -24

No files matched your search

@@ -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();
}
}
@@ -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();
}
}