@trudb/tru-common-lib 0.0.724 → 0.0.726

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -594,11 +594,15 @@ class TruPasswordDialog {
594
594
  this.user = user;
595
595
  this.appEnvironment = appEnvironment;
596
596
  this.data = data;
597
+ this.currentPasswordControl = new FormControl('', []);
597
598
  this.newPasswordControl = new FormControl('', []);
598
- this.confirmPasswordControl = new FormControl('', []);
599
+ this.confirmNewPasswordControl = new FormControl('', []);
599
600
  this.message = null;
600
601
  this.canSubmit = () => {
601
- return this.newPasswordControl.value && this.confirmPasswordControl.value;
602
+ return this.currentPasswordControl.value &&
603
+ this.newPasswordControl.value &&
604
+ this.confirmNewPasswordControl.value &&
605
+ (this.newPasswordControl.value === this.confirmNewPasswordControl.value);
602
606
  };
603
607
  }
604
608
  ngOnInit() {
@@ -612,10 +616,10 @@ class TruPasswordDialog {
612
616
  }
613
617
  }
614
618
  TruPasswordDialog.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: TruPasswordDialog, deps: [{ token: i1.MatDialogRef }, { token: TruUser }, { token: TruAppEnvironment }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component });
615
- TruPasswordDialog.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.1", type: TruPasswordDialog, selector: "tru-password-dialog", ngImport: i0, template: "<div mat-dialog-title class=\"mat-dialog-title\">\r\n Change Password\r\n</div>\r\n\r\n<div mat-dialog-content class=\"mat-dialog-content tru-control-container\">\r\n <p>{{message}}</p>\r\n <mat-label>New Password</mat-label>\r\n <mat-form-field>\r\n <input #newInput\r\n matInput\r\n [formControl]=\"newPasswordControl\"\r\n type=\"password\" />\r\n </mat-form-field>\r\n <mat-label>Confirm Password</mat-label>\r\n <mat-form-field>\r\n <input #confirmInput\r\n matInput\r\n [formControl]=\"confirmPasswordControl\"\r\n type=\"password\" />\r\n </mat-form-field>\r\n</div>\r\n\r\n<div mat-dialog-actions class=\"mat-dialog-actions\">\r\n <button mat-raised-button (click)=\"onDismiss()\">Cancel</button>\r\n <button [disabled]=\"canSubmit()\" mat-raised-button color=\"primary\" (click)=\"onConfirm()\">Submit</button>\r\n</div>\r\n", styles: [".tru-control-container{margin-bottom:10px;margin-right:10px}::ng-deep .tru-control-container .mat-mdc-form-field{display:inline!important}::ng-deep .tru-control-container .mat-mdc-form-field-infix{padding:0!important;min-height:unset!important}::ng-deep .tru-control-container mat-label{font-size:14px;font-weight:700}::ng-deep .tru-control-container input{font-size:12px;padding-left:5px}::ng-deep .tru-control-container mat-select{font-size:12px;padding-left:5px}::ng-deep .tru-control-container .mat-mdc-form-field-flex.invalid .mdc-notched-outline__leading{border-color:#bd362f}::ng-deep .tru-control-container .mat-mdc-form-field-flex.invalid .mdc-notched-outline__notch{border-color:#bd362f}::ng-deep .tru-control-container .mat-mdc-form-field-flex.invalid .mdc-notched-outline__trailing{border-color:#bd362f}::ng-deep .tru-control-container .mat-mdc-form-field-bottom-align:before{content:unset!important}::ng-deep .tru-control-container path{color:#a9a9a9}::ng-deep .tru-control-container .mat-mdc-form-field-flex.invalid+div:before{border-color:red}\n", "::ng-deep .mat-mdc-dialog-surface{padding:20px}.mat-mdc-dialog-title:before{content:unset!important;height:unset!important;padding:0 0 10px!important}.mdc-dialog__title{padding:20px 0 10px!important}.mdc-dialog__content{padding:10px 0 15px!important}.mat-mdc-dialog-content p{margin-bottom:0;font-size:14px;color:#545454}.mat-mdc-dialog-actions{padding:0!important}.mat-mdc-dialog-actions button{margin-right:10px}\n"], dependencies: [{ kind: "directive", type: i7.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i7.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i7.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: i3.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "directive", type: i1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "directive", type: i1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i6.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i7$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i7$1.MatLabel, selector: "mat-label" }] });
619
+ TruPasswordDialog.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.1", type: TruPasswordDialog, selector: "tru-password-dialog", ngImport: i0, template: "<div mat-dialog-title class=\"mat-dialog-title\">\r\n Change Password\r\n</div>\r\n\r\n<div mat-dialog-content class=\"mat-dialog-content tru-control-container\">\r\n <p>{{message}}</p>\r\n <mat-label>Current Password</mat-label>\r\n <mat-form-field>\r\n <input #newInput\r\n matInput\r\n [formControl]=\"currentPasswordControl\"\r\n type=\"password\" />\r\n </mat-form-field>\r\n <mat-label>New Password</mat-label>\r\n <mat-form-field>\r\n <input #newInput\r\n matInput\r\n [formControl]=\"newPasswordControl\"\r\n type=\"password\" />\r\n </mat-form-field>\r\n <mat-label>Confirm New Password</mat-label>\r\n <mat-form-field>\r\n <input #confirmInput\r\n matInput\r\n [formControl]=\"confirmNewPasswordControl\"\r\n type=\"password\" />\r\n </mat-form-field>\r\n</div>\r\n\r\n<div mat-dialog-actions class=\"mat-dialog-actions\">\r\n <button mat-raised-button (click)=\"onDismiss()\">Cancel</button>\r\n <button [disabled]=\"canSubmit()\" mat-raised-button color=\"primary\" (click)=\"onConfirm()\">Submit</button>\r\n</div>\r\n", styles: [".tru-control-container{margin-bottom:10px;margin-right:10px}::ng-deep .tru-control-container .mat-mdc-form-field{display:inline!important}::ng-deep .tru-control-container .mat-mdc-form-field-infix{padding:0!important;min-height:unset!important}::ng-deep .tru-control-container mat-label{font-size:14px;font-weight:700}::ng-deep .tru-control-container input{font-size:12px;padding-left:5px}::ng-deep .tru-control-container mat-select{font-size:12px;padding-left:5px}::ng-deep .tru-control-container .mat-mdc-form-field-flex.invalid .mdc-notched-outline__leading{border-color:#bd362f}::ng-deep .tru-control-container .mat-mdc-form-field-flex.invalid .mdc-notched-outline__notch{border-color:#bd362f}::ng-deep .tru-control-container .mat-mdc-form-field-flex.invalid .mdc-notched-outline__trailing{border-color:#bd362f}::ng-deep .tru-control-container .mat-mdc-form-field-bottom-align:before{content:unset!important}::ng-deep .tru-control-container path{color:#a9a9a9}::ng-deep .tru-control-container .mat-mdc-form-field-flex.invalid+div:before{border-color:red}\n", "::ng-deep .mat-mdc-dialog-surface{padding:20px}.mat-mdc-dialog-title:before{content:unset!important;height:unset!important;padding:0 0 10px!important}.mdc-dialog__title{padding:20px 0 10px!important}.mdc-dialog__content{padding:10px 0 15px!important}.mat-mdc-dialog-content p{margin-bottom:0;font-size:14px;color:#545454}.mat-mdc-dialog-actions{padding:0!important}.mat-mdc-dialog-actions button{margin-right:10px}\n"], dependencies: [{ kind: "directive", type: i7.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i7.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i7.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: i3.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "directive", type: i1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "directive", type: i1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i6.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i7$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i7$1.MatLabel, selector: "mat-label" }] });
616
620
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: TruPasswordDialog, decorators: [{
617
621
  type: Component,
618
- args: [{ selector: 'tru-password-dialog', template: "<div mat-dialog-title class=\"mat-dialog-title\">\r\n Change Password\r\n</div>\r\n\r\n<div mat-dialog-content class=\"mat-dialog-content tru-control-container\">\r\n <p>{{message}}</p>\r\n <mat-label>New Password</mat-label>\r\n <mat-form-field>\r\n <input #newInput\r\n matInput\r\n [formControl]=\"newPasswordControl\"\r\n type=\"password\" />\r\n </mat-form-field>\r\n <mat-label>Confirm Password</mat-label>\r\n <mat-form-field>\r\n <input #confirmInput\r\n matInput\r\n [formControl]=\"confirmPasswordControl\"\r\n type=\"password\" />\r\n </mat-form-field>\r\n</div>\r\n\r\n<div mat-dialog-actions class=\"mat-dialog-actions\">\r\n <button mat-raised-button (click)=\"onDismiss()\">Cancel</button>\r\n <button [disabled]=\"canSubmit()\" mat-raised-button color=\"primary\" (click)=\"onConfirm()\">Submit</button>\r\n</div>\r\n", styles: [".tru-control-container{margin-bottom:10px;margin-right:10px}::ng-deep .tru-control-container .mat-mdc-form-field{display:inline!important}::ng-deep .tru-control-container .mat-mdc-form-field-infix{padding:0!important;min-height:unset!important}::ng-deep .tru-control-container mat-label{font-size:14px;font-weight:700}::ng-deep .tru-control-container input{font-size:12px;padding-left:5px}::ng-deep .tru-control-container mat-select{font-size:12px;padding-left:5px}::ng-deep .tru-control-container .mat-mdc-form-field-flex.invalid .mdc-notched-outline__leading{border-color:#bd362f}::ng-deep .tru-control-container .mat-mdc-form-field-flex.invalid .mdc-notched-outline__notch{border-color:#bd362f}::ng-deep .tru-control-container .mat-mdc-form-field-flex.invalid .mdc-notched-outline__trailing{border-color:#bd362f}::ng-deep .tru-control-container .mat-mdc-form-field-bottom-align:before{content:unset!important}::ng-deep .tru-control-container path{color:#a9a9a9}::ng-deep .tru-control-container .mat-mdc-form-field-flex.invalid+div:before{border-color:red}\n", "::ng-deep .mat-mdc-dialog-surface{padding:20px}.mat-mdc-dialog-title:before{content:unset!important;height:unset!important;padding:0 0 10px!important}.mdc-dialog__title{padding:20px 0 10px!important}.mdc-dialog__content{padding:10px 0 15px!important}.mat-mdc-dialog-content p{margin-bottom:0;font-size:14px;color:#545454}.mat-mdc-dialog-actions{padding:0!important}.mat-mdc-dialog-actions button{margin-right:10px}\n"] }]
622
+ args: [{ selector: 'tru-password-dialog', template: "<div mat-dialog-title class=\"mat-dialog-title\">\r\n Change Password\r\n</div>\r\n\r\n<div mat-dialog-content class=\"mat-dialog-content tru-control-container\">\r\n <p>{{message}}</p>\r\n <mat-label>Current Password</mat-label>\r\n <mat-form-field>\r\n <input #newInput\r\n matInput\r\n [formControl]=\"currentPasswordControl\"\r\n type=\"password\" />\r\n </mat-form-field>\r\n <mat-label>New Password</mat-label>\r\n <mat-form-field>\r\n <input #newInput\r\n matInput\r\n [formControl]=\"newPasswordControl\"\r\n type=\"password\" />\r\n </mat-form-field>\r\n <mat-label>Confirm New Password</mat-label>\r\n <mat-form-field>\r\n <input #confirmInput\r\n matInput\r\n [formControl]=\"confirmNewPasswordControl\"\r\n type=\"password\" />\r\n </mat-form-field>\r\n</div>\r\n\r\n<div mat-dialog-actions class=\"mat-dialog-actions\">\r\n <button mat-raised-button (click)=\"onDismiss()\">Cancel</button>\r\n <button [disabled]=\"canSubmit()\" mat-raised-button color=\"primary\" (click)=\"onConfirm()\">Submit</button>\r\n</div>\r\n", styles: [".tru-control-container{margin-bottom:10px;margin-right:10px}::ng-deep .tru-control-container .mat-mdc-form-field{display:inline!important}::ng-deep .tru-control-container .mat-mdc-form-field-infix{padding:0!important;min-height:unset!important}::ng-deep .tru-control-container mat-label{font-size:14px;font-weight:700}::ng-deep .tru-control-container input{font-size:12px;padding-left:5px}::ng-deep .tru-control-container mat-select{font-size:12px;padding-left:5px}::ng-deep .tru-control-container .mat-mdc-form-field-flex.invalid .mdc-notched-outline__leading{border-color:#bd362f}::ng-deep .tru-control-container .mat-mdc-form-field-flex.invalid .mdc-notched-outline__notch{border-color:#bd362f}::ng-deep .tru-control-container .mat-mdc-form-field-flex.invalid .mdc-notched-outline__trailing{border-color:#bd362f}::ng-deep .tru-control-container .mat-mdc-form-field-bottom-align:before{content:unset!important}::ng-deep .tru-control-container path{color:#a9a9a9}::ng-deep .tru-control-container .mat-mdc-form-field-flex.invalid+div:before{border-color:red}\n", "::ng-deep .mat-mdc-dialog-surface{padding:20px}.mat-mdc-dialog-title:before{content:unset!important;height:unset!important;padding:0 0 10px!important}.mdc-dialog__title{padding:20px 0 10px!important}.mdc-dialog__content{padding:10px 0 15px!important}.mat-mdc-dialog-content p{margin-bottom:0;font-size:14px;color:#545454}.mat-mdc-dialog-actions{padding:0!important}.mat-mdc-dialog-actions button{margin-right:10px}\n"] }]
619
623
  }], ctorParameters: function () { return [{ type: i1.MatDialogRef }, { type: TruUser }, { type: TruAppEnvironment }, { type: TruPasswordDialog, decorators: [{
620
624
  type: Inject,
621
625
  args: [MAT_DIALOG_DATA]
@@ -3726,7 +3730,7 @@ class TruAuth {
3726
3730
  }));
3727
3731
  }
3728
3732
  setUser() {
3729
- this.auth.setUser(this.user);
3733
+ this.auth.createUser(this.user);
3730
3734
  }
3731
3735
  logout() {
3732
3736
  this.http
@@ -3735,11 +3739,16 @@ class TruAuth {
3735
3739
  });
3736
3740
  }
3737
3741
  userClaims() {
3738
- return this.http
3739
- .get(`${this.baseUrl}${TRU_AUTH_CONFIG.authUrl}/userClaims`)
3740
- .pipe(tap((userClaims) => {
3741
- this.user.create(userClaims);
3742
- }));
3742
+ if (this.appEnvironment.authType === 'session') {
3743
+ return this.http
3744
+ .get(`${this.baseUrl}${TRU_AUTH_CONFIG.authUrl}/userClaims`)
3745
+ .pipe(tap((userClaims) => {
3746
+ this.user.create(userClaims);
3747
+ }));
3748
+ }
3749
+ else {
3750
+ return this.auth.createUser(this.user);
3751
+ }
3743
3752
  }
3744
3753
  get isLoggedIn() {
3745
3754
  if (!this.loggedIn.value) {
@@ -5996,7 +6005,7 @@ class TruAuthJwtStrategy {
5996
6005
  isLoggedIn() {
5997
6006
  return !!this.getJwtToken();
5998
6007
  }
5999
- setUser(user) {
6008
+ createUser(user) {
6000
6009
  let jwtData = this.getDecodedJwtJsonData();
6001
6010
  console.log(jwtData);
6002
6011
  let userData = {
@@ -6007,7 +6016,7 @@ class TruAuthJwtStrategy {
6007
6016
  username: jwtData['http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name'],
6008
6017
  roles: jwtData['http://schemas.microsoft.com/ws/2008/06/identity/claims/role']
6009
6018
  };
6010
- user.create(userData);
6019
+ return of(user.create(userData));
6011
6020
  }
6012
6021
  getJwtToken() {
6013
6022
  try {
@@ -6059,7 +6068,7 @@ class TruAuthInterceptor {
6059
6068
  withCredentials: true
6060
6069
  });
6061
6070
  return next.handle(request).pipe(catchError((error) => {
6062
- if (error.status === 401 || error.status === 404) {
6071
+ if (error.status === 401) {
6063
6072
  this.auth.doLogoutAndRedirectToLogin();
6064
6073
  }
6065
6074
  return throwError(error);
@@ -6090,7 +6099,8 @@ class TruAuthSessionStrategy {
6090
6099
  doLogoutUser() {
6091
6100
  this.loggedUser = undefined;
6092
6101
  }
6093
- setUser(user) {
6102
+ createUser(user) {
6103
+ return of({});
6094
6104
  }
6095
6105
  isLoggedIn() {
6096
6106
  return false; //todo, implement this