diff --git a/src/components/users/confirm-password/ko/runtime/confirm-password.html b/src/components/users/confirm-password/ko/runtime/confirm-password.html
index ecd95a41e..2d4228bec 100644
--- a/src/components/users/confirm-password/ko/runtime/confirm-password.html
+++ b/src/components/users/confirm-password/ko/runtime/confirm-password.html
@@ -20,7 +20,7 @@
-
diff --git a/src/components/users/confirm-password/ko/runtime/confirm-password.ts b/src/components/users/confirm-password/ko/runtime/confirm-password.ts
index 78fa1e5ee..fc833e729 100644
--- a/src/components/users/confirm-password/ko/runtime/confirm-password.ts
+++ b/src/components/users/confirm-password/ko/runtime/confirm-password.ts
@@ -21,7 +21,7 @@ export class ConfirmPassword {
public readonly password: ko.Observable;
public readonly passwordConfirmation: ko.Observable;
public readonly isResetConfirmed: ko.Observable;
- public readonly working: ko.Observable;
+ public readonly isResetPasswordDisabled: ko.Observable;
constructor(
private readonly usersService: UsersService,
@@ -29,7 +29,7 @@ export class ConfirmPassword {
this.password = ko.observable();
this.passwordConfirmation = ko.observable();
this.isResetConfirmed = ko.observable(false);
- this.working = ko.observable(false);
+ this.isResetPasswordDisabled = ko.observable(true);
validation.init({
insertMessages: false,
@@ -49,6 +49,7 @@ export class ConfirmPassword {
this.userId = await this.usersService.getCurrentUserId();
if (this.userId) {
+ dispatchErrors(this.eventManager, ErrorSources.confirmpassword, ["Cannot reset password for a signed in user."]);
return;
}
@@ -69,12 +70,19 @@ export class ConfirmPassword {
} catch (error) {
dispatchErrors(this.eventManager, ErrorSources.confirmpassword, ["Activate user error: " + error.message]);
}
+
+ this.isResetPasswordDisabled(false);
}
/**
* Sends user resetPswd request to Management API.
*/
public async resetPswd(): Promise {
+ if (this.token == undefined || this.userId == undefined) {
+ dispatchErrors(this.eventManager, ErrorSources.confirmpassword, ["Required params not found"]);
+ return;
+ }
+
const result = validation.group({
password: this.password,
passwordConfirmation: this.passwordConfirmation