Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added logic to prevent DOM changes on request to prevent error #1160

Merged
merged 2 commits into from
Feb 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
<!-- /ko -->

<!-- ko if: !isChangeConfirmed() -->

<form data-bind="submit: changePassword">

<fieldset>
<fieldset data-bind="attr: { disabled: working}">
<div class="form-group">
<label for="password">Password</label>
<input aria-required="true" class="form-control" id="password" name="password"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ export class ChangePassword {
userId = `/users/${userId}`;

try {
this.working(true);

if (isCaptcha) {
const resetRequest: ChangePasswordRequest = {
solution: captchaSolution,
Expand Down Expand Up @@ -177,6 +179,8 @@ export class ChangePassword {
errors: errorMessages
};
this.eventManager.dispatchEvent("onValidationErrors", validationReport);
} finally {
this.working(false);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@
<!-- /ko -->

<!-- ko if: !isResetRequested() -->

<form data-bind="submit: resetSubmit">

<fieldset>
<fieldset data-bind="attr: { disabled: working}">
<div class="form-group">
<label for="email">Email</label>
<input aria-required="true" autofocus="autofocus" class="form-control" id="email" name="email"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ export class ResetPassword {
}

try {
this.working(true);

if (isCaptcha) {
const resetRequest: ResetRequest = {
solution: captchaSolution,
Expand All @@ -127,8 +129,7 @@ export class ResetPassword {
errors: []
};
this.eventManager.dispatchEvent("onValidationErrors", validationReport);
}
catch (error) {
} catch (error) {
if (isCaptcha) {
WLSPHIP0.reloadHIP();
}
Expand All @@ -151,7 +152,8 @@ export class ResetPassword {
errors: errorMessages
};
this.eventManager.dispatchEvent("onValidationErrors", validationReport);
} finally {
this.working(false);
}

}
}
5 changes: 1 addition & 4 deletions src/components/users/signup/ko/runtime/signup.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@
<p id="confirmationMessage">Follow the instructions from the email to verify your account.</p>
<!-- /ko -->


<!-- ko ifnot: working -->
<!-- ko ifnot: isUserRequested -->
<form data-bind="submit: signup">
<fieldset>
<fieldset data-bind="attr: { disabled: working}">
<div class="form-group">
<label for="email">Email</label>
<input aria-required="true" autofocus="autofocus" spellcheck="false" class="form-control" id="email" name="email"
Expand Down Expand Up @@ -72,5 +70,4 @@
</div>
</fieldset>
</form>
<!-- /ko -->
<!-- /ko -->
6 changes: 2 additions & 4 deletions src/components/users/signup/ko/runtime/signup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,7 @@ export class Signup {
errors: []
};
this.eventManager.dispatchEvent("onValidationErrors", validationReport);
}
catch (error) {
} catch (error) {
if (isCaptchaRequired) {
WLSPHIP0.reloadHIP();
}
Expand All @@ -247,8 +246,7 @@ export class Signup {
};

this.eventManager.dispatchEvent("onValidationErrors", validationReport);
}
finally {
} finally {
this.working(false);
}
}
Expand Down