fix: 🐛 ensure password reset is always called

on occassion it could break if axe is running, which is probably only an
issue when developing the UI, but to be safe...
This commit is contained in:
Randall Morey committed 2020-10-07 10:08:07 -04:00
1 parent 31459254f2
commit a5811f0ea7
4 files changed
+14 -13

No files matched your search

@@ -1,6 +1,6 @@
<Rose::Form
class="full-width"
@onSubmit={{fn this.submit @submit}}
@onSubmit={{fn this.submit @submit this.currentPassword this.newPassword}}
@cancel={{fn this.cancel @cancel}}
@disabled={{@model.isSaving}}
@error={{@model.errors.base}}
@@ -2,7 +2,7 @@ import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { computed } from '@ember/object';
import { action } from '@ember/object';
import { next } from '@ember/runloop';
import { run } from '@ember/runloop';
export default class FormAccountPasswordChangePasswordIndexComponent extends Component {
@@ -50,13 +50,14 @@ export default class FormAccountPasswordChangePasswordIndexComponent extends Com
* Call passed submit function with passwords.
* Unset passwords before callack.
* @param {function} fn
* @param {string} currentPassword
* @param {string} newPassword
*/
@action
submit(fn) {
const currentPassword = this.currentPassword;
const newPassword = this.newPassword;
next(() => this.resetPasswords());
fn(currentPassword, newPassword);
submit(fn, currentPassword, newPassword) {
console.log(currentPassword, newPassword);
run(() => this.resetPasswords());
run(() => fn(currentPassword, newPassword));
}
/**
@@ -1,5 +1,5 @@
<Rose::Form
@onSubmit={{fn this.submit @submit}}
@onSubmit={{fn this.submit @submit this.password}}
@disabled={{@model.isSaving}}
@error={{@model.errors.base}}
as |form|
@@ -2,7 +2,7 @@ import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { computed } from '@ember/object';
import { action } from '@ember/object';
import { next } from '@ember/runloop';
import { run } from '@ember/runloop';
export default class FormAccountPasswordSetPasswordIndexComponent extends Component {
// =properties
@@ -36,11 +36,11 @@ export default class FormAccountPasswordSetPasswordIndexComponent extends Compon
* Submit with password value when it is allowed.
* Callback with no arguments otherwise.
* @param {function} fn
* @param {string} password
*/
@action
submit(fn) {
const password = this.password;
next(() => this.resetPassword());
fn(password);
submit(fn, password) {
run(() => this.resetPassword());
run(() => fn(password));
}
}