Merge pull request #300 from hashicorp/fix-set-password
fix: 🐛 ensure password reset is always called
This commit is contained in:
4 files changed
+13
-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,13 @@ 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) {
|
||||
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));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user