@@ -21,15 +21,15 @@ export class ConfirmPassword {
2121 public readonly password : ko . Observable < string > ;
2222 public readonly passwordConfirmation : ko . Observable < string > ;
2323 public readonly isResetConfirmed : ko . Observable < boolean > ;
24- public readonly working : ko . Observable < boolean > ;
24+ public readonly isResetPasswordDisabled : ko . Observable < boolean > ;
2525
2626 constructor (
2727 private readonly usersService : UsersService ,
2828 private readonly eventManager : EventManager ) {
2929 this . password = ko . observable ( ) ;
3030 this . passwordConfirmation = ko . observable ( ) ;
3131 this . isResetConfirmed = ko . observable ( false ) ;
32- this . working = ko . observable ( false ) ;
32+ this . isResetPasswordDisabled = ko . observable ( true ) ;
3333
3434 validation . init ( {
3535 insertMessages : false ,
@@ -49,6 +49,7 @@ export class ConfirmPassword {
4949 this . userId = await this . usersService . getCurrentUserId ( ) ;
5050
5151 if ( this . userId ) {
52+ dispatchErrors ( this . eventManager , ErrorSources . confirmpassword , [ "Cannot reset password for a signed in user." ] ) ;
5253 return ;
5354 }
5455
@@ -69,12 +70,19 @@ export class ConfirmPassword {
6970 } catch ( error ) {
7071 dispatchErrors ( this . eventManager , ErrorSources . confirmpassword , [ "Activate user error: " + error . message ] ) ;
7172 }
73+
74+ this . isResetPasswordDisabled ( false ) ;
7275 }
7376
7477 /**
7578 * Sends user resetPswd request to Management API.
7679 */
7780 public async resetPswd ( ) : Promise < void > {
81+ if ( this . token == undefined || this . userId == undefined ) {
82+ dispatchErrors ( this . eventManager , ErrorSources . confirmpassword , [ "Required params not found" ] ) ;
83+ return ;
84+ }
85+
7886 const result = validation . group ( {
7987 password : this . password ,
8088 passwordConfirmation : this . passwordConfirmation
0 commit comments