From 861464598ac3ea9bce5d4b1768e134caed989a9e Mon Sep 17 00:00:00 2001 From: Max Peintner Date: Thu, 1 Sep 2022 09:44:39 +0200 Subject: [PATCH] chore(console): resolve warnings due to dependency update (#4270) * cli, core * material cdk * schematics * chore(deps): bump ngx-color from 7.3.3 to 8.0.2 in /console (#4228) Bumps [ngx-color](https://github.com/scttcper/ngx-color) from 7.3.3 to 8.0.2. - [Release notes](https://github.com/scttcper/ngx-color/releases) - [Commits](https://github.com/scttcper/ngx-color/compare/v7.3.3...v8.0.2) --- updated-dependencies: - dependency-name: ngx-color dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * eslint-plugin * chore(deps): bump moment from 2.29.3 to 2.29.4 in /console (#3926) Bumps [moment](https://github.com/moment/moment) from 2.29.3 to 2.29.4. - [Release notes](https://github.com/moment/moment/releases) - [Changelog](https://github.com/moment/moment/blob/develop/CHANGELOG.md) - [Commits](https://github.com/moment/moment/compare/2.29.3...2.29.4) --- updated-dependencies: - dependency-name: moment dependency-type: direct:production ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps): bump codemirror from 5.65.6 to 6.0.1 in /console (#3928) Bumps [codemirror](https://github.com/codemirror/basic-setup) from 5.65.6 to 6.0.1. - [Release notes](https://github.com/codemirror/basic-setup/releases) - [Changelog](https://github.com/codemirror/basic-setup/blob/main/CHANGELOG.md) - [Commits](https://github.com/codemirror/basic-setup/commits/6.0.1) --- updated-dependencies: - dependency-name: codemirror dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * lock * use codemirror 5 * remove redundant null undefined checks * i18n, undefined checks * remove redundant null and undefined checks * checks * fix: resolve null check warnings * commonjs deps Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Livio Spring --- console/angular.json | 42 ++--- .../accounts-card.component.html | 8 +- .../accounts-card/accounts-card.component.ts | 9 +- .../add-key-dialog.component.html | 2 +- .../add-token-dialog.component.html | 2 +- .../client-keys/client-keys.component.ts | 92 +++++----- .../app/modules/header/header.component.html | 8 +- .../app/modules/header/header.component.ts | 4 +- .../modules/idp-table/idp-table.component.ts | 8 +- .../src/app/modules/idp/idp.component.html | 2 +- console/src/app/modules/idp/idp.component.ts | 44 ++--- .../modules/info-row/info-row.component.html | 18 +- .../machine-keys/machine-keys.component.ts | 55 +++--- .../memberships-table.component.html | 84 ++++++--- .../memberships-table.component.ts | 6 +- .../password-complexity-view.component.html | 27 ++- .../login-policy/login-policy.component.html | 2 +- .../login-policy/login-policy.component.ts | 132 +++++++------- .../notification-settings.component.html | 6 +- .../password-complexity-policy.component.html | 2 +- .../password-complexity-policy.component.ts | 88 +++++----- .../password-lockout-policy.component.html | 4 +- .../password-lockout-policy.component.ts | 52 +++--- .../project-roles-table.component.html | 8 +- .../refresh-table.component.html | 29 +-- .../search-user-autocomplete.component.html | 6 +- .../user-grants/user-grants.component.html | 17 +- .../user-grants/user-grants.component.ts | 14 +- .../action-table/action-table.component.html | 2 +- .../action-table/action-table.component.ts | 12 +- .../domain-verification.component.html | 16 +- .../domain-verification.component.ts | 63 ++++--- .../app/pages/instance/instance.component.ts | 2 +- .../org-create/org-create.component.html | 11 +- .../pages/org-create/org-create.component.ts | 55 +++--- .../orgs/org-detail/org-detail.component.ts | 6 +- .../orgs/org-members/org-members.component.ts | 2 +- .../apps/app-create/app-create.component.html | 4 +- .../apps/app-create/app-create.component.ts | 34 ++-- .../apps/app-detail/app-detail.component.html | 7 +- .../apps/app-detail/app-detail.component.ts | 159 +++++++++-------- .../granted-project-detail.component.html | 7 +- .../granted-project-detail.component.ts | 16 +- .../applications/applications.component.html | 87 +++++---- .../applications/applications.component.ts | 3 +- .../owned-project-detail.component.html | 4 +- .../owned-project-detail.component.ts | 60 ++++--- .../project-grant-create.component.html | 2 +- .../project-grant-create.component.ts | 20 ++- .../project-grants.component.html | 6 +- .../project-grants.component.ts | 5 +- .../user-grant-create.component.html | 4 +- .../user-grant-create.component.ts | 12 +- .../auth-passwordless.component.html | 71 +++++--- .../auth-passwordless.component.ts | 2 +- .../auth-user-detail.component.html | 6 +- .../auth-user-detail.component.ts | 20 +-- .../auth-user-mfa.component.html | 66 ++++--- .../auth-user-mfa/auth-user-mfa.component.ts | 2 +- .../contact/contact.component.html | 166 ++++++++++-------- .../user-detail/contact/contact.component.ts | 2 +- .../detail-form/detail-form.component.html | 2 +- 62 files changed, 927 insertions(+), 780 deletions(-) diff --git a/console/angular.json b/console/angular.json index aae5fe23cb..776703f84e 100644 --- a/console/angular.json +++ b/console/angular.json @@ -22,18 +22,14 @@ "main": "src/main.ts", "polyfills": "src/polyfills.ts", "tsConfig": "tsconfig.app.json", - "assets": [ - "src/favicon.ico", - "src/assets", - "src/manifest.webmanifest" - ], - "styles": [ - "src/styles.scss" - ], - "scripts": [ - "./node_modules/tinycolor2/dist/tinycolor-min.js" - ], + "assets": ["src/favicon.ico", "src/assets", "src/manifest.webmanifest"], + "styles": ["src/styles.scss"], + "scripts": ["./node_modules/tinycolor2/dist/tinycolor-min.js"], "allowedCommonJsDependencies": [ + "fast-sha256", + "buffer", + "moment", + "grpc-web", "@angular/common/locales/de", "codemirror/mode/javascript/javascript", "src/app/proto/generated/zitadel/admin_pb", @@ -130,27 +126,15 @@ "polyfills": "src/polyfills.ts", "tsConfig": "tsconfig.spec.json", "karmaConfig": "karma.conf.js", - "assets": [ - "src/favicon.ico", - "src/assets", - "src/manifest.webmanifest" - ], - "styles": [ - "./node_modules/@angular/material/prebuilt-themes/pink-bluegrey.css", - "src/styles.scss" - ], - "scripts": [ - "./node_modules/tinycolor2/dist/tinycolor-min.js" - ] + "assets": ["src/favicon.ico", "src/assets", "src/manifest.webmanifest"], + "styles": ["./node_modules/@angular/material/prebuilt-themes/pink-bluegrey.css", "src/styles.scss"], + "scripts": ["./node_modules/tinycolor2/dist/tinycolor-min.js"] } }, "lint": { "builder": "@angular-eslint/builder:lint", "options": { - "lintFilePatterns": [ - "src/**/*.ts", - "src/**/*.html" - ] + "lintFilePatterns": ["src/**/*.ts", "src/**/*.html"] } }, "e2e": { @@ -173,8 +157,6 @@ }, "cli": { "analytics": "2b4e8e6c-f053-4562-b7a6-00c6c06a6791", - "schematicCollections": [ - "@angular-eslint/schematics" - ] + "schematicCollections": ["@angular-eslint/schematics"] } } diff --git a/console/src/app/modules/accounts-card/accounts-card.component.html b/console/src/app/modules/accounts-card/accounts-card.component.html index 74db5d2994..7780fd323f 100644 --- a/console/src/app/modules/accounts-card/accounts-card.component.html +++ b/console/src/app/modules/accounts-card/accounts-card.component.html @@ -1,13 +1,13 @@
- {{ user.human?.profile?.displayName ? user.human?.profile?.displayName : 'A' }} - {{ user.preferredLoginName }} + {{ user?.human?.profile?.displayName ? user?.human?.profile?.displayName : 'A' }} + {{ user?.preferredLoginName }}
diff --git a/console/src/app/modules/accounts-card/accounts-card.component.ts b/console/src/app/modules/accounts-card/accounts-card.component.ts index e8d5ee3b50..fc13a2c704 100644 --- a/console/src/app/modules/accounts-card/accounts-card.component.ts +++ b/console/src/app/modules/accounts-card/accounts-card.component.ts @@ -11,7 +11,7 @@ import { GrpcAuthService } from 'src/app/services/grpc-auth.service'; styleUrls: ['./accounts-card.component.scss'], }) export class AccountsCardComponent implements OnInit { - @Input() public user!: User.AsObject; + @Input() public user?: User.AsObject; @Input() public iamuser: boolean | null = false; @Output() public closedCard: EventEmitter = new EventEmitter(); @@ -22,12 +22,7 @@ export class AccountsCardComponent implements OnInit { this.userService .listMyUserSessions() .then((sessions) => { - this.sessions = sessions.resultList; - const index = this.sessions.findIndex((user) => user.loginName === this.user.preferredLoginName); - if (index > -1) { - this.sessions.splice(index, 1); - } - + this.sessions = sessions.resultList.filter((user) => user.loginName !== this.user?.preferredLoginName); this.loadingUsers = false; }) .catch(() => { diff --git a/console/src/app/modules/add-key-dialog/add-key-dialog.component.html b/console/src/app/modules/add-key-dialog/add-key-dialog.component.html index 389428dabb..6c8cd3b565 100644 --- a/console/src/app/modules/add-key-dialog/add-key-dialog.component.html +++ b/console/src/app/modules/add-key-dialog/add-key-dialog.component.html @@ -18,7 +18,7 @@ {{ 'USER.MACHINE.CHOOSEDATEAFTER' | translate }}: - {{ dateControl?.errors?.matDatepickerMin.min.toDate() | localizedDate: 'EEE dd. MMM' }} + {{ dateControl.errors?.matDatepickerMin.min.toDate() | localizedDate: 'EEE dd. MMM' }}
diff --git a/console/src/app/modules/add-token-dialog/add-token-dialog.component.html b/console/src/app/modules/add-token-dialog/add-token-dialog.component.html index f34d4f2fcc..7d59dffee4 100644 --- a/console/src/app/modules/add-token-dialog/add-token-dialog.component.html +++ b/console/src/app/modules/add-token-dialog/add-token-dialog.component.html @@ -9,7 +9,7 @@ {{ 'USER.PERSONALACCESSTOKEN.ADD.CHOOSEDATEAFTER' | translate }}: - {{ dateControl?.errors?.matDatepickerMin.min.toDate() | localizedDate: 'EEE dd. MMM' }} + {{ dateControl.errors?.matDatepickerMin.min.toDate() | localizedDate: 'EEE dd. MMM' }}
diff --git a/console/src/app/modules/client-keys/client-keys.component.ts b/console/src/app/modules/client-keys/client-keys.component.ts index cd2a70fe30..bfa32b0b54 100644 --- a/console/src/app/modules/client-keys/client-keys.component.ts +++ b/console/src/app/modules/client-keys/client-keys.component.ts @@ -27,15 +27,19 @@ export class ClientKeysComponent implements OnInit { @ViewChild(PaginatorComponent) public paginator!: PaginatorComponent; public dataSource: MatTableDataSource = new MatTableDataSource(); public selection: SelectionModel = new SelectionModel(true, []); - public keyResult!: ListAppKeysResponse.AsObject; + public keyResult?: ListAppKeysResponse.AsObject; private loadingSubject: BehaviorSubject = new BehaviorSubject(false); public loading$: Observable = this.loadingSubject.asObservable(); @Input() public displayedColumns: string[] = ['select', 'id', 'type', 'creationDate', 'expirationDate', 'actions']; @Output() public changedSelection: EventEmitter> = new EventEmitter(); - constructor(public translate: TranslateService, private mgmtService: ManagementService, private dialog: MatDialog, - private toast: ToastService) { + constructor( + public translate: TranslateService, + private mgmtService: ManagementService, + private dialog: MatDialog, + private toast: ToastService, + ) { this.selection.changed.subscribe(() => { this.changedSelection.emit(this.selection.selected); }); @@ -45,7 +49,6 @@ export class ClientKeysComponent implements OnInit { this.getData(10, 0); } - public isAllSelected(): boolean { const numSelected = this.selection.selected.length; const numRows = this.dataSource.data.length; @@ -53,24 +56,24 @@ export class ClientKeysComponent implements OnInit { } public masterToggle(): void { - this.isAllSelected() ? - this.selection.clear() : - this.dataSource.data.forEach(row => this.selection.select(row)); + this.isAllSelected() ? this.selection.clear() : this.dataSource.data.forEach((row) => this.selection.select(row)); } - public changePage(event: PageEvent): void { this.getData(event.pageSize, event.pageIndex * event.pageSize); } public deleteKey(key: Key.AsObject): void { - this.mgmtService.removeAppKey(this.projectId, this.appId, key.id).then(() => { - this.selection.clear(); - this.toast.showInfo('USER.TOAST.SELECTEDKEYSDELETED', true); - this.getData(10, 0); - }).catch(error => { - this.toast.showError(error); - }); + this.mgmtService + .removeAppKey(this.projectId, this.appId, key.id) + .then(() => { + this.selection.clear(); + this.toast.showInfo('USER.TOAST.SELECTEDKEYSDELETED', true); + this.getData(10, 0); + }) + .catch((error) => { + this.toast.showError(error); + }); } public openAddKey(): void { @@ -96,28 +99,26 @@ export class ClientKeysComponent implements OnInit { } if (type) { - this.mgmtService.addAppKey( - this.projectId, - this.appId, - type, - date ? date : undefined, - ).then((response) => { - if (response) { - setTimeout(() => { - this.refreshPage(); - }, 1000); + this.mgmtService + .addAppKey(this.projectId, this.appId, type, date ? date : undefined) + .then((response) => { + if (response) { + setTimeout(() => { + this.refreshPage(); + }, 1000); - this.dialog.open(ShowKeyDialogComponent, { - data: { - key: response, - type: AddKeyDialogType.AUTHNKEY, - }, - width: '400px', - }); - } - }).catch((error: any) => { - this.toast.showError(error); - }); + this.dialog.open(ShowKeyDialogComponent, { + data: { + key: response, + type: AddKeyDialogType.AUTHNKEY, + }, + width: '400px', + }); + } + }) + .catch((error: any) => { + this.toast.showError(error); + }); } } }); @@ -126,14 +127,17 @@ export class ClientKeysComponent implements OnInit { private async getData(limit: number, offset: number): Promise { this.loadingSubject.next(true); if (this.projectId && this.appId) { - this.mgmtService.listAppKeys(this.projectId, this.appId, limit, offset).then(resp => { - this.keyResult = resp; - this.dataSource.data = this.keyResult.resultList; - this.loadingSubject.next(false); - }).catch((error: any) => { - this.toast.showError(error); - this.loadingSubject.next(false); - }); + this.mgmtService + .listAppKeys(this.projectId, this.appId, limit, offset) + .then((resp) => { + this.keyResult = resp; + this.dataSource.data = this.keyResult.resultList; + this.loadingSubject.next(false); + }) + .catch((error: any) => { + this.toast.showError(error); + this.loadingSubject.next(false); + }); } } diff --git a/console/src/app/modules/header/header.component.html b/console/src/app/modules/header/header.component.html index 5d3a9f47d7..4514d24673 100644 --- a/console/src/app/modules/header/header.component.html +++ b/console/src/app/modules/header/header.component.html @@ -9,14 +9,14 @@ class="logo" alt="home logo" *ngIf="isDarkTheme; else customlighttheme" - [src]="labelpolicy?.iconUrlDark ? labelpolicy.iconUrlDark : './assets/images/zitadel-logo-solo-light.svg'" + [src]="labelpolicy.iconUrlDark ? labelpolicy.iconUrlDark : './assets/images/zitadel-logo-solo-light.svg'" (error)="errorHandler($event, './assets/images/zitadel-logo-solo-light.svg')" /> @@ -78,7 +78,7 @@
- {{ org?.name ? org.name : 'NO NAME' }}
@@ -212,7 +212,7 @@ class="avatar-toggle dontcloseonclick" [active]="showAccount" [avatarUrl]="user.human?.profile?.avatarUrl || ''" - [forColor]="user?.preferredLoginName || ''" + [forColor]="user.preferredLoginName || ''" [name]=" user.human?.profile?.displayName ? user.human?.profile?.displayName ?? '' diff --git a/console/src/app/modules/header/header.component.ts b/console/src/app/modules/header/header.component.ts index 8264d9a495..0e270a9c5e 100644 --- a/console/src/app/modules/header/header.component.ts +++ b/console/src/app/modules/header/header.component.ts @@ -21,8 +21,8 @@ export class HeaderComponent implements OnDestroy { @ViewChild('input', { static: false }) input!: ElementRef; @Input() public isDarkTheme: boolean = true; - @Input() public user!: User.AsObject; - @Input() public labelpolicy!: LabelPolicy.AsObject; + @Input() public user?: User.AsObject; + @Input() public labelpolicy?: LabelPolicy.AsObject; public showOrgContext: boolean = false; public orgs$: Observable = of([]); diff --git a/console/src/app/modules/idp-table/idp-table.component.ts b/console/src/app/modules/idp-table/idp-table.component.ts index 1f035ae383..7dbef285f9 100644 --- a/console/src/app/modules/idp-table/idp-table.component.ts +++ b/console/src/app/modules/idp-table/idp-table.component.ts @@ -9,9 +9,9 @@ import { BehaviorSubject, Observable } from 'rxjs'; import { ListIDPsResponse } from 'src/app/proto/generated/zitadel/admin_pb'; import { IDP, IDPLoginPolicyLink, IDPOwnerType, IDPState, IDPStylingType } from 'src/app/proto/generated/zitadel/idp_pb'; import { - AddCustomLoginPolicyRequest, - AddCustomLoginPolicyResponse, - ListOrgIDPsResponse, + AddCustomLoginPolicyRequest, + AddCustomLoginPolicyResponse, + ListOrgIDPsResponse, } from 'src/app/proto/generated/zitadel/management_pb'; import { LoginPolicy } from 'src/app/proto/generated/zitadel/policy_pb'; import { AdminService } from 'src/app/services/admin.service'; @@ -33,7 +33,7 @@ export class IdpTableComponent implements OnInit { @ViewChild(PaginatorComponent) public paginator!: PaginatorComponent; public dataSource: MatTableDataSource = new MatTableDataSource(); public selection: SelectionModel = new SelectionModel(true, []); - public idpResult!: ListIDPsResponse.AsObject | ListOrgIDPsResponse.AsObject; + public idpResult?: ListIDPsResponse.AsObject | ListOrgIDPsResponse.AsObject; private loadingSubject: BehaviorSubject = new BehaviorSubject(false); public loading$: Observable = this.loadingSubject.asObservable(); public PolicyComponentServiceType: any = PolicyComponentServiceType; diff --git a/console/src/app/modules/idp/idp.component.html b/console/src/app/modules/idp/idp.component.html index 9c7d7d2284..aa3b93ed4a 100644 --- a/console/src/app/modules/idp/idp.component.html +++ b/console/src/app/modules/idp/idp.component.html @@ -1,5 +1,5 @@ = new Subject(); public projectId: string = ''; @@ -189,7 +189,7 @@ export class IdpComponent implements OnDestroy { }); dialogRef.afterClosed().subscribe((resp) => { - if (resp) { + if (this.idp && resp) { if (this.serviceType === PolicyComponentServiceType.MGMT) { (this.service as ManagementService) .removeOrgIDP(this.idp.id) @@ -217,21 +217,21 @@ export class IdpComponent implements OnDestroy { public changeState(state: IDPState): void { if (this.serviceType === PolicyComponentServiceType.MGMT) { - if (state === IDPState.IDP_STATE_ACTIVE) { + if (state === IDPState.IDP_STATE_ACTIVE && this.idp) { (this.service as ManagementService) .reactivateOrgIDP(this.idp.id) .then(() => { - this.idp.state = state; + this.idp!.state = state; this.toast.showInfo('IDP.TOAST.REACTIVATED', true); }) .catch((error: any) => { this.toast.showError(error); }); - } else if (state === IDPState.IDP_STATE_INACTIVE) { + } else if (state === IDPState.IDP_STATE_INACTIVE && this.idp) { (this.service as ManagementService) .deactivateOrgIDP(this.idp.id) .then(() => { - this.idp.state = state; + this.idp!.state = state; this.toast.showInfo('IDP.TOAST.DEACTIVATED', true); }) .catch((error: any) => { @@ -239,21 +239,21 @@ export class IdpComponent implements OnDestroy { }); } } else if (this.serviceType === PolicyComponentServiceType.ADMIN) { - if (state === IDPState.IDP_STATE_ACTIVE) { + if (state === IDPState.IDP_STATE_ACTIVE && this.idp) { (this.service as AdminService) .reactivateIDP(this.idp.id) .then(() => { - this.idp.state = state; + this.idp!.state = state; this.toast.showInfo('IDP.TOAST.REACTIVATED', true); }) .catch((error: any) => { this.toast.showError(error); }); - } else if (state === IDPState.IDP_STATE_INACTIVE) { + } else if (state === IDPState.IDP_STATE_INACTIVE && this.idp) { (this.service as AdminService) .deactivateIDP(this.idp.id) .then(() => { - this.idp.state = state; + this.idp!.state = state; this.toast.showInfo('IDP.TOAST.DEACTIVATED', true); }) .catch((error: any) => { @@ -264,7 +264,7 @@ export class IdpComponent implements OnDestroy { } public updateIdp(): void { - if (this.serviceType === PolicyComponentServiceType.MGMT) { + if (this.serviceType === PolicyComponentServiceType.MGMT && this.idp) { const req = new UpdateOrgIDPRequest(); req.setIdpId(this.idp.id); @@ -280,7 +280,7 @@ export class IdpComponent implements OnDestroy { .catch((error) => { this.toast.showError(error); }); - } else if (this.serviceType === PolicyComponentServiceType.ADMIN) { + } else if (this.serviceType === PolicyComponentServiceType.ADMIN && this.idp) { const req = new UpdateIDPRequest(); req.setIdpId(this.idp.id); @@ -300,7 +300,7 @@ export class IdpComponent implements OnDestroy { } public updateOidcConfig(): void { - if (this.serviceType === PolicyComponentServiceType.MGMT) { + if (this.serviceType === PolicyComponentServiceType.MGMT && this.idp) { const req = new UpdateOrgIDPOIDCConfigRequest(); req.setIdpId(this.idp.id); @@ -319,7 +319,7 @@ export class IdpComponent implements OnDestroy { .catch((error) => { this.toast.showError(error); }); - } else if (this.serviceType === PolicyComponentServiceType.ADMIN) { + } else if (this.serviceType === PolicyComponentServiceType.ADMIN && this.idp) { const req = new UpdateIDPOIDCConfigRequest(); req.setIdpId(this.idp.id); @@ -342,7 +342,7 @@ export class IdpComponent implements OnDestroy { } public updateJwtConfig(): void { - if (this.serviceType === PolicyComponentServiceType.MGMT) { + if (this.serviceType === PolicyComponentServiceType.MGMT && this.idp) { const req = new UpdateOrgIDPJWTConfigRequest(); req.setIdpId(this.idp.id); @@ -360,7 +360,7 @@ export class IdpComponent implements OnDestroy { .catch((error) => { this.toast.showError(error); }); - } else if (this.serviceType === PolicyComponentServiceType.ADMIN) { + } else if (this.serviceType === PolicyComponentServiceType.ADMIN && this.idp) { const req = new UpdateIDPJWTConfigRequest(); req.setIdpId(this.idp.id); diff --git a/console/src/app/modules/info-row/info-row.component.html b/console/src/app/modules/info-row/info-row.component.html index 7ebc4c4c85..c0ee415bd7 100644 --- a/console/src/app/modules/info-row/info-row.component.html +++ b/console/src/app/modules/info-row/info-row.component.html @@ -257,31 +257,31 @@

-
+

{{ 'APP.OIDC.INFO.CLIENTID' | translate }}

-
+
-
+
diff --git a/console/src/app/modules/machine-keys/machine-keys.component.ts b/console/src/app/modules/machine-keys/machine-keys.component.ts index 329672b00f..06a945062d 100644 --- a/console/src/app/modules/machine-keys/machine-keys.component.ts +++ b/console/src/app/modules/machine-keys/machine-keys.component.ts @@ -22,12 +22,12 @@ import { WarnDialogComponent } from '../warn-dialog/warn-dialog.component'; styleUrls: ['./machine-keys.component.scss'], }) export class MachineKeysComponent implements OnInit { - @Input() userId!: string; + @Input() userId?: string; @ViewChild(PaginatorComponent) public paginator!: PaginatorComponent; public dataSource: MatTableDataSource = new MatTableDataSource(); public selection: SelectionModel = new SelectionModel(true, []); - public keyResult!: ListMachineKeysResponse.AsObject; + public keyResult?: ListMachineKeysResponse.AsObject; private loadingSubject: BehaviorSubject = new BehaviorSubject(false); public loading$: Observable = this.loadingSubject.asObservable(); @Input() public displayedColumns: string[] = ['id', 'type', 'creationDate', 'expirationDate', 'actions']; @@ -64,29 +64,32 @@ export class MachineKeysComponent implements OnInit { } public deleteKey(key: Key.AsObject): void { - const dialogRef = this.dialog.open(WarnDialogComponent, { - data: { - confirmKey: 'ACTIONS.DELETE', - cancelKey: 'ACTIONS.CANCEL', - titleKey: 'USER.MACHINE.DIALOG.DELETE_KEY.TITLE', - descriptionKey: 'USER.MACHINE.DIALOG.DELETE_KEY.DESCRIPTION', - }, - width: '400px', - }); - dialogRef.afterClosed().subscribe((resp) => { - if (resp) { - this.mgmtService - .removeMachineKey(key.id, this.userId) - .then(() => { - this.selection.clear(); - this.toast.showInfo('USER.TOAST.SELECTEDKEYSDELETED', true); - this.changePage(); - }) - .catch((error) => { - this.toast.showError(error); - }); - } - }); + if (this.userId) { + const dialogRef = this.dialog.open(WarnDialogComponent, { + data: { + confirmKey: 'ACTIONS.DELETE', + cancelKey: 'ACTIONS.CANCEL', + titleKey: 'USER.MACHINE.DIALOG.DELETE_KEY.TITLE', + descriptionKey: 'USER.MACHINE.DIALOG.DELETE_KEY.DESCRIPTION', + }, + width: '400px', + }); + + dialogRef.afterClosed().subscribe((resp) => { + if (resp && this.userId) { + this.mgmtService + .removeMachineKey(key.id, this.userId) + .then(() => { + this.selection.clear(); + this.toast.showInfo('USER.TOAST.SELECTEDKEYSDELETED', true); + this.changePage(); + }) + .catch((error) => { + this.toast.showError(error); + }); + } + }); + } } public openAddKey(): void { @@ -111,7 +114,7 @@ export class MachineKeysComponent implements OnInit { date = ts; } - if (type) { + if (type && this.userId) { this.mgmtService .addMachineKey(this.userId, type, date) .then((response) => { diff --git a/console/src/app/modules/memberships-table/memberships-table.component.html b/console/src/app/modules/memberships-table/memberships-table.component.html index 0e94f39a55..94a24003aa 100644 --- a/console/src/app/modules/memberships-table/memberships-table.component.html +++ b/console/src/app/modules/memberships-table/memberships-table.component.html @@ -1,7 +1,12 @@ - - + @@ -14,54 +19,73 @@ - + + {{ membership.displayName }} + - + - + + {{ membership.orgId }} + - + - - +
- + [indeterminate]="selection.hasValue() && !isAllSelected()" + > - - + {{ 'USER.MEMBERSHIPS.DISPLAYNAME' | translate }} {{ 'USER.MEMBERSHIPS.DISPLAYNAME' | translate }} - {{membership.displayName}} {{ 'USER.MEMBERSHIPS.TYPE' | translate }} {{ 'USER.MEMBERSHIPS.TYPE' | translate }} - {{getType(membership)}} + {{ getType(membership) }} {{ 'USER.MEMBERSHIPS.ORGID' | translate }} {{ 'USER.MEMBERSHIPS.ORGID' | translate }} - {{membership.orgId}} {{ 'ROLESLABEL' | translate }} {{ 'ROLESLABEL' | translate }}
- +
- {{role | roletransform}} + {{ role | roletransform }}
-
@@ -69,12 +93,18 @@
- + - \ No newline at end of file + diff --git a/console/src/app/modules/memberships-table/memberships-table.component.ts b/console/src/app/modules/memberships-table/memberships-table.component.ts index 0428134ac8..9d516a4e96 100644 --- a/console/src/app/modules/memberships-table/memberships-table.component.ts +++ b/console/src/app/modules/memberships-table/memberships-table.component.ts @@ -28,8 +28,8 @@ export class MembershipsTableComponent implements OnInit, OnDestroy { @ViewChild(PaginatorComponent) public paginator!: PaginatorComponent; @ViewChild(MatTable) public table!: MatTable; @Input() public userId: string = ''; - public dataSource!: MembershipsDataSource; - public selection: SelectionModel = new SelectionModel(true, []); + public dataSource: MembershipsDataSource = new MembershipsDataSource(this.authService, this.mgmtService); + public selection: SelectionModel = new SelectionModel(true, []); @Output() public changedSelection: EventEmitter = new EventEmitter(); @Output() public deleteMembership: EventEmitter = new EventEmitter(); @@ -51,8 +51,6 @@ export class MembershipsTableComponent implements OnInit, OnDestroy { private workflowService: OverlayWorkflowService, private storageService: StorageService, ) { - this.dataSource = new MembershipsDataSource(this.authService, this.mgmtService); - this.selection.changed.pipe(takeUntil(this.destroyed)).subscribe((_) => { this.changedSelection.emit(this.selection.selected); }); diff --git a/console/src/app/modules/password-complexity-view/password-complexity-view.component.html b/console/src/app/modules/password-complexity-view/password-complexity-view.component.html index e9af4476a5..3992172930 100644 --- a/console/src/app/modules/password-complexity-view/password-complexity-view.component.html +++ b/console/src/app/modules/password-complexity-view/password-complexity-view.component.html @@ -1,12 +1,19 @@ -
-
+
+
-
- +
+
@@ -14,8 +21,10 @@ - {{ 'USER.PASSWORD.MINLENGTHERROR' | translate: {value: policy?.minLength} }} - ({{password?.value?.length}}/{{ policy.minLength}}) + {{ 'USER.PASSWORD.MINLENGTHERROR' | translate: { value: policy.minLength } }} ({{ password?.value?.length }}/{{ + policy.minLength + }})
@@ -38,4 +47,4 @@ {{ 'USER.VALIDATION.LOWERCASEMISSING' | translate }}
-
\ No newline at end of file +
diff --git a/console/src/app/modules/policies/login-policy/login-policy.component.html b/console/src/app/modules/policies/login-policy/login-policy.component.html index 7aae637b28..ea45c36197 100644 --- a/console/src/app/modules/policies/login-policy/login-policy.component.html +++ b/console/src/app/modules/policies/login-policy/login-policy.component.html @@ -57,7 +57,7 @@ (typeRemoved)="removeFactor($event)" (typeAdded)="addFactor($event)" [disabled]=" - loginData?.passwordlessType === PasswordlessType.PASSWORDLESS_TYPE_NOT_ALLOWED || + loginData.passwordlessType === PasswordlessType.PASSWORDLESS_TYPE_NOT_ALLOWED || ([ serviceType === PolicyComponentServiceType.ADMIN ? 'iam.policy.write' diff --git a/console/src/app/modules/policies/login-policy/login-policy.component.ts b/console/src/app/modules/policies/login-policy/login-policy.component.ts index a96b0c523a..2cfb92ecc3 100644 --- a/console/src/app/modules/policies/login-policy/login-policy.component.ts +++ b/console/src/app/modules/policies/login-policy/login-policy.component.ts @@ -4,13 +4,13 @@ import { MatDialog } from '@angular/material/dialog'; import { Duration } from 'google-protobuf/google/protobuf/duration_pb'; import { take } from 'rxjs'; import { - GetLoginPolicyResponse as AdminGetLoginPolicyResponse, - UpdateLoginPolicyRequest, - UpdateLoginPolicyResponse, + GetLoginPolicyResponse as AdminGetLoginPolicyResponse, + UpdateLoginPolicyRequest, + UpdateLoginPolicyResponse, } from 'src/app/proto/generated/zitadel/admin_pb'; import { - AddCustomLoginPolicyRequest, - GetLoginPolicyResponse as MgmtGetLoginPolicyResponse, + AddCustomLoginPolicyRequest, + GetLoginPolicyResponse as MgmtGetLoginPolicyResponse, } from 'src/app/proto/generated/zitadel/management_pb'; import { LoginPolicy, PasswordlessType } from 'src/app/proto/generated/zitadel/policy_pb'; import { AdminService } from 'src/app/services/admin.service'; @@ -34,7 +34,7 @@ export class LoginPolicyComponent implements OnInit { PasswordlessType.PASSWORDLESS_TYPE_NOT_ALLOWED, PasswordlessType.PASSWORDLESS_TYPE_ALLOWED, ]; - public loginData!: LoginPolicy.AsObject; + public loginData?: LoginPolicy.AsObject; public service!: ManagementService | AdminService; public PolicyComponentServiceType: any = PolicyComponentServiceType; @@ -43,22 +43,20 @@ export class LoginPolicyComponent implements OnInit { public loading: boolean = false; public InfoSectionType: any = InfoSectionType; public PasswordlessType: any = PasswordlessType; - public lifetimeForm!: UntypedFormGroup; + public lifetimeForm: UntypedFormGroup = this.fb.group({ + passwordCheckLifetime: [{ disabled: true, value: 240 }, [Validators.required]], + externalLoginCheckLifetime: [{ disabled: true, value: 12 }, [Validators.required]], + mfaInitSkipLifetime: [{ disabled: true, value: 720 }, [Validators.required]], + secondFactorCheckLifetime: [{ disabled: true, value: 12 }, [Validators.required]], + multiFactorCheckLifetime: [{ disabled: true, value: 12 }, [Validators.required]], + }); constructor( private toast: ToastService, private injector: Injector, private fb: UntypedFormBuilder, private authService: GrpcAuthService, private dialog: MatDialog, - ) { - this.lifetimeForm = this.fb.group({ - passwordCheckLifetime: [{ disabled: true, value: 240 }, [Validators.required]], - externalLoginCheckLifetime: [{ disabled: true, value: 12 }, [Validators.required]], - mfaInitSkipLifetime: [{ disabled: true, value: 720 }, [Validators.required]], - secondFactorCheckLifetime: [{ disabled: true, value: 12 }, [Validators.required]], - multiFactorCheckLifetime: [{ disabled: true, value: 12 }, [Validators.required]], - }); - } + ) {} public fetchData(): void { this.getData() @@ -143,68 +141,72 @@ export class LoginPolicyComponent implements OnInit { } private async updateData(): Promise { - switch (this.serviceType) { - case PolicyComponentServiceType.MGMT: - const mgmtreq = new AddCustomLoginPolicyRequest(); - mgmtreq.setAllowExternalIdp(this.loginData.allowExternalIdp); - mgmtreq.setAllowRegister(this.loginData.allowRegister); - mgmtreq.setAllowUsernamePassword(this.loginData.allowUsernamePassword); - mgmtreq.setForceMfa(this.loginData.forceMfa); - mgmtreq.setPasswordlessType(this.loginData.passwordlessType); - mgmtreq.setHidePasswordReset(this.loginData.hidePasswordReset); - mgmtreq.setMultiFactorsList(this.loginData.multiFactorsList); - mgmtreq.setSecondFactorsList(this.loginData.secondFactorsList); + if (this.loginData) { + switch (this.serviceType) { + case PolicyComponentServiceType.MGMT: + const mgmtreq = new AddCustomLoginPolicyRequest(); + mgmtreq.setAllowExternalIdp(this.loginData.allowExternalIdp); + mgmtreq.setAllowRegister(this.loginData.allowRegister); + mgmtreq.setAllowUsernamePassword(this.loginData.allowUsernamePassword); + mgmtreq.setForceMfa(this.loginData.forceMfa); + mgmtreq.setPasswordlessType(this.loginData.passwordlessType); + mgmtreq.setHidePasswordReset(this.loginData.hidePasswordReset); + mgmtreq.setMultiFactorsList(this.loginData.multiFactorsList); + mgmtreq.setSecondFactorsList(this.loginData.secondFactorsList); - const pcl = new Duration().setSeconds((this.passwordCheckLifetime?.value ?? 240) * 60 * 60); - mgmtreq.setPasswordCheckLifetime(pcl); + const pcl = new Duration().setSeconds((this.passwordCheckLifetime?.value ?? 240) * 60 * 60); + mgmtreq.setPasswordCheckLifetime(pcl); - const elcl = new Duration().setSeconds((this.externalLoginCheckLifetime?.value ?? 12) * 60 * 60); - mgmtreq.setExternalLoginCheckLifetime(elcl); + const elcl = new Duration().setSeconds((this.externalLoginCheckLifetime?.value ?? 12) * 60 * 60); + mgmtreq.setExternalLoginCheckLifetime(elcl); - const misl = new Duration().setSeconds((this.mfaInitSkipLifetime?.value ?? 720) * 60 * 60); - mgmtreq.setMfaInitSkipLifetime(misl); + const misl = new Duration().setSeconds((this.mfaInitSkipLifetime?.value ?? 720) * 60 * 60); + mgmtreq.setMfaInitSkipLifetime(misl); - const sfcl = new Duration().setSeconds((this.secondFactorCheckLifetime?.value ?? 12) * 60 * 60); - mgmtreq.setSecondFactorCheckLifetime(sfcl); + const sfcl = new Duration().setSeconds((this.secondFactorCheckLifetime?.value ?? 12) * 60 * 60); + mgmtreq.setSecondFactorCheckLifetime(sfcl); - const mficl = new Duration().setSeconds((this.multiFactorCheckLifetime?.value ?? 12) * 60 * 60); - mgmtreq.setMultiFactorCheckLifetime(mficl); + const mficl = new Duration().setSeconds((this.multiFactorCheckLifetime?.value ?? 12) * 60 * 60); + mgmtreq.setMultiFactorCheckLifetime(mficl); - mgmtreq.setIgnoreUnknownUsernames(this.loginData.ignoreUnknownUsernames); - mgmtreq.setDefaultRedirectUri(this.loginData.defaultRedirectUri); + mgmtreq.setIgnoreUnknownUsernames(this.loginData.ignoreUnknownUsernames); + mgmtreq.setDefaultRedirectUri(this.loginData.defaultRedirectUri); - if (this.isDefault) { - return (this.service as ManagementService).addCustomLoginPolicy(mgmtreq); - } else { - return (this.service as ManagementService).updateCustomLoginPolicy(mgmtreq); - } - case PolicyComponentServiceType.ADMIN: - const adminreq = new UpdateLoginPolicyRequest(); - adminreq.setAllowExternalIdp(this.loginData.allowExternalIdp); - adminreq.setAllowRegister(this.loginData.allowRegister); - adminreq.setAllowUsernamePassword(this.loginData.allowUsernamePassword); - adminreq.setForceMfa(this.loginData.forceMfa); - adminreq.setPasswordlessType(this.loginData.passwordlessType); - adminreq.setHidePasswordReset(this.loginData.hidePasswordReset); + if (this.isDefault) { + return (this.service as ManagementService).addCustomLoginPolicy(mgmtreq); + } else { + return (this.service as ManagementService).updateCustomLoginPolicy(mgmtreq); + } + case PolicyComponentServiceType.ADMIN: + const adminreq = new UpdateLoginPolicyRequest(); + adminreq.setAllowExternalIdp(this.loginData.allowExternalIdp); + adminreq.setAllowRegister(this.loginData.allowRegister); + adminreq.setAllowUsernamePassword(this.loginData.allowUsernamePassword); + adminreq.setForceMfa(this.loginData.forceMfa); + adminreq.setPasswordlessType(this.loginData.passwordlessType); + adminreq.setHidePasswordReset(this.loginData.hidePasswordReset); - const admin_pcl = new Duration().setSeconds((this.passwordCheckLifetime?.value ?? 240) * 60 * 60); - adminreq.setPasswordCheckLifetime(admin_pcl); + const admin_pcl = new Duration().setSeconds((this.passwordCheckLifetime?.value ?? 240) * 60 * 60); + adminreq.setPasswordCheckLifetime(admin_pcl); - const admin_elcl = new Duration().setSeconds((this.externalLoginCheckLifetime?.value ?? 12) * 60 * 60); - adminreq.setExternalLoginCheckLifetime(admin_elcl); + const admin_elcl = new Duration().setSeconds((this.externalLoginCheckLifetime?.value ?? 12) * 60 * 60); + adminreq.setExternalLoginCheckLifetime(admin_elcl); - const admin_misl = new Duration().setSeconds((this.mfaInitSkipLifetime?.value ?? 720) * 60 * 60); - adminreq.setMfaInitSkipLifetime(admin_misl); + const admin_misl = new Duration().setSeconds((this.mfaInitSkipLifetime?.value ?? 720) * 60 * 60); + adminreq.setMfaInitSkipLifetime(admin_misl); - const admin_sfcl = new Duration().setSeconds((this.secondFactorCheckLifetime?.value ?? 12) * 60 * 60); - adminreq.setSecondFactorCheckLifetime(admin_sfcl); + const admin_sfcl = new Duration().setSeconds((this.secondFactorCheckLifetime?.value ?? 12) * 60 * 60); + adminreq.setSecondFactorCheckLifetime(admin_sfcl); - const admin_mficl = new Duration().setSeconds((this.multiFactorCheckLifetime?.value ?? 12) * 60 * 60); - adminreq.setMultiFactorCheckLifetime(admin_mficl); - adminreq.setIgnoreUnknownUsernames(this.loginData.ignoreUnknownUsernames); - adminreq.setDefaultRedirectUri(this.loginData.defaultRedirectUri); + const admin_mficl = new Duration().setSeconds((this.multiFactorCheckLifetime?.value ?? 12) * 60 * 60); + adminreq.setMultiFactorCheckLifetime(admin_mficl); + adminreq.setIgnoreUnknownUsernames(this.loginData.ignoreUnknownUsernames); + adminreq.setDefaultRedirectUri(this.loginData.defaultRedirectUri); - return (this.service as AdminService).updateLoginPolicy(adminreq); + return (this.service as AdminService).updateLoginPolicy(adminreq); + } + } else { + return Promise.reject(); } } diff --git a/console/src/app/modules/policies/notification-settings/notification-settings.component.html b/console/src/app/modules/policies/notification-settings/notification-settings.component.html index d815871431..b88eef9a18 100644 --- a/console/src/app/modules/policies/notification-settings/notification-settings.component.html +++ b/console/src/app/modules/policies/notification-settings/notification-settings.component.html @@ -72,10 +72,10 @@ *ngIf="twilio" class="state" [ngClass]="{ - active: twilio?.state === SMSProviderConfigState.SMS_PROVIDER_CONFIG_ACTIVE, - inactive: twilio?.state === SMSProviderConfigState.SMS_PROVIDER_CONFIG_INACTIVE + active: twilio.state === SMSProviderConfigState.SMS_PROVIDER_CONFIG_ACTIVE, + inactive: twilio.state === SMSProviderConfigState.SMS_PROVIDER_CONFIG_INACTIVE }" - >{{ 'SETTING.SMS.SMSPROVIDERSTATE.' + twilio?.state | translate }}{{ 'SETTING.SMS.SMSPROVIDERSTATE.' + twilio.state | translate }} diff --git a/console/src/app/modules/policies/password-complexity-policy/password-complexity-policy.component.html b/console/src/app/modules/policies/password-complexity-policy/password-complexity-policy.component.html index 14735d2fa1..d679cf98d3 100644 --- a/console/src/app/modules/policies/password-complexity-policy/password-complexity-policy.component.html +++ b/console/src/app/modules/policies/password-complexity-policy/password-complexity-policy.component.html @@ -28,7 +28,7 @@ - {{ complexityData?.minLength }} + {{ complexityData.minLength }} diff --git a/console/src/app/modules/policies/password-complexity-policy/password-complexity-policy.component.ts b/console/src/app/modules/policies/password-complexity-policy/password-complexity-policy.component.ts index a09691631f..c588361470 100644 --- a/console/src/app/modules/policies/password-complexity-policy/password-complexity-policy.component.ts +++ b/console/src/app/modules/policies/password-complexity-policy/password-complexity-policy.component.ts @@ -1,11 +1,7 @@ import { Component, Injector, Input, OnInit, Type } from '@angular/core'; import { MatDialog } from '@angular/material/dialog'; -import { - GetPasswordComplexityPolicyResponse as AdminGetPasswordComplexityPolicyResponse, -} from 'src/app/proto/generated/zitadel/admin_pb'; -import { - GetPasswordComplexityPolicyResponse as MgmtGetPasswordComplexityPolicyResponse, -} from 'src/app/proto/generated/zitadel/management_pb'; +import { GetPasswordComplexityPolicyResponse as AdminGetPasswordComplexityPolicyResponse } from 'src/app/proto/generated/zitadel/admin_pb'; +import { GetPasswordComplexityPolicyResponse as MgmtGetPasswordComplexityPolicyResponse } from 'src/app/proto/generated/zitadel/management_pb'; import { PasswordComplexityPolicy } from 'src/app/proto/generated/zitadel/policy_pb'; import { AdminService } from 'src/app/services/admin.service'; import { ManagementService } from 'src/app/services/mgmt.service'; @@ -24,7 +20,7 @@ export class PasswordComplexityPolicyComponent implements OnInit { @Input() public serviceType: PolicyComponentServiceType = PolicyComponentServiceType.MGMT; public service!: ManagementService | AdminService; - public complexityData!: PasswordComplexityPolicy.AsObject; + public complexityData?: PasswordComplexityPolicy.AsObject; public PolicyComponentServiceType: any = PolicyComponentServiceType; @@ -110,11 +106,44 @@ export class PasswordComplexityPolicyComponent implements OnInit { } public savePolicy(): void { - switch (this.serviceType) { - case PolicyComponentServiceType.MGMT: - if ((this.complexityData as PasswordComplexityPolicy.AsObject).isDefault) { - (this.service as ManagementService) - .addCustomPasswordComplexityPolicy( + if (this.complexityData) { + switch (this.serviceType) { + case PolicyComponentServiceType.MGMT: + if ((this.complexityData as PasswordComplexityPolicy.AsObject).isDefault) { + (this.service as ManagementService) + .addCustomPasswordComplexityPolicy( + this.complexityData.hasLowercase, + this.complexityData.hasUppercase, + this.complexityData.hasNumber, + this.complexityData.hasSymbol, + this.complexityData.minLength, + ) + .then(() => { + this.toast.showInfo('POLICY.TOAST.SET', true); + }) + .catch((error) => { + this.toast.showError(error); + }); + } else { + (this.service as ManagementService) + .updateCustomPasswordComplexityPolicy( + this.complexityData.hasLowercase, + this.complexityData.hasUppercase, + this.complexityData.hasNumber, + this.complexityData.hasSymbol, + this.complexityData.minLength, + ) + .then(() => { + this.toast.showInfo('POLICY.TOAST.SET', true); + }) + .catch((error) => { + this.toast.showError(error); + }); + } + break; + case PolicyComponentServiceType.ADMIN: + (this.service as AdminService) + .updatePasswordComplexityPolicy( this.complexityData.hasLowercase, this.complexityData.hasUppercase, this.complexityData.hasNumber, @@ -127,39 +156,8 @@ export class PasswordComplexityPolicyComponent implements OnInit { .catch((error) => { this.toast.showError(error); }); - } else { - (this.service as ManagementService) - .updateCustomPasswordComplexityPolicy( - this.complexityData.hasLowercase, - this.complexityData.hasUppercase, - this.complexityData.hasNumber, - this.complexityData.hasSymbol, - this.complexityData.minLength, - ) - .then(() => { - this.toast.showInfo('POLICY.TOAST.SET', true); - }) - .catch((error) => { - this.toast.showError(error); - }); - } - break; - case PolicyComponentServiceType.ADMIN: - (this.service as AdminService) - .updatePasswordComplexityPolicy( - this.complexityData.hasLowercase, - this.complexityData.hasUppercase, - this.complexityData.hasNumber, - this.complexityData.hasSymbol, - this.complexityData.minLength, - ) - .then(() => { - this.toast.showInfo('POLICY.TOAST.SET', true); - }) - .catch((error) => { - this.toast.showError(error); - }); - break; + break; + } } } diff --git a/console/src/app/modules/policies/password-lockout-policy/password-lockout-policy.component.html b/console/src/app/modules/policies/password-lockout-policy/password-lockout-policy.component.html index 2d89d4c437..9a515d1890 100644 --- a/console/src/app/modules/policies/password-lockout-policy/password-lockout-policy.component.html +++ b/console/src/app/modules/policies/password-lockout-policy/password-lockout-policy.component.html @@ -13,8 +13,6 @@ - -
@@ -22,7 +20,7 @@ - {{ lockoutData?.maxPasswordAttempts }} + {{ lockoutData.maxPasswordAttempts }} diff --git a/console/src/app/modules/policies/password-lockout-policy/password-lockout-policy.component.ts b/console/src/app/modules/policies/password-lockout-policy/password-lockout-policy.component.ts index 085a707b74..f7f56342ff 100644 --- a/console/src/app/modules/policies/password-lockout-policy/password-lockout-policy.component.ts +++ b/console/src/app/modules/policies/password-lockout-policy/password-lockout-policy.component.ts @@ -2,9 +2,7 @@ import { Component, Injector, Input, OnInit, Type } from '@angular/core'; import { UntypedFormGroup } from '@angular/forms'; import { MatDialog } from '@angular/material/dialog'; import { GetLockoutPolicyResponse as AdminGetPasswordLockoutPolicyResponse } from 'src/app/proto/generated/zitadel/admin_pb'; -import { - GetLockoutPolicyResponse as MgmtGetPasswordLockoutPolicyResponse, -} from 'src/app/proto/generated/zitadel/management_pb'; +import { GetLockoutPolicyResponse as MgmtGetPasswordLockoutPolicyResponse } from 'src/app/proto/generated/zitadel/management_pb'; import { LockoutPolicy } from 'src/app/proto/generated/zitadel/policy_pb'; import { AdminService } from 'src/app/services/admin.service'; import { ManagementService } from 'src/app/services/mgmt.service'; @@ -24,7 +22,7 @@ export class PasswordLockoutPolicyComponent implements OnInit { @Input() public serviceType: PolicyComponentServiceType = PolicyComponentServiceType.MGMT; public lockoutForm!: UntypedFormGroup; - public lockoutData!: LockoutPolicy.AsObject; + public lockoutData?: LockoutPolicy.AsObject; public PolicyComponentServiceType: any = PolicyComponentServiceType; public InfoSectionType: any = InfoSectionType; @@ -103,20 +101,10 @@ export class PasswordLockoutPolicyComponent implements OnInit { public savePolicy(): void { let promise: Promise; - if (this.service instanceof AdminService) { - promise = this.service - .updateLockoutPolicy(this.lockoutData.maxPasswordAttempts) - .then(() => { - this.toast.showInfo('POLICY.TOAST.SET', true); - this.fetchData(); - }) - .catch((error) => { - this.toast.showError(error); - }); - } else { - if ((this.lockoutData as LockoutPolicy.AsObject).isDefault) { + if (this.lockoutData) { + if (this.service instanceof AdminService) { promise = this.service - .addCustomLockoutPolicy(this.lockoutData.maxPasswordAttempts) + .updateLockoutPolicy(this.lockoutData.maxPasswordAttempts) .then(() => { this.toast.showInfo('POLICY.TOAST.SET', true); this.fetchData(); @@ -125,15 +113,27 @@ export class PasswordLockoutPolicyComponent implements OnInit { this.toast.showError(error); }); } else { - promise = this.service - .updateCustomLockoutPolicy(this.lockoutData.maxPasswordAttempts) - .then(() => { - this.toast.showInfo('POLICY.TOAST.SET', true); - this.fetchData(); - }) - .catch((error) => { - this.toast.showError(error); - }); + if ((this.lockoutData as LockoutPolicy.AsObject).isDefault) { + promise = (this.service as ManagementService) + .addCustomLockoutPolicy(this.lockoutData.maxPasswordAttempts) + .then(() => { + this.toast.showInfo('POLICY.TOAST.SET', true); + this.fetchData(); + }) + .catch((error) => { + this.toast.showError(error); + }); + } else { + promise = (this.service as ManagementService) + .updateCustomLockoutPolicy(this.lockoutData.maxPasswordAttempts) + .then(() => { + this.toast.showInfo('POLICY.TOAST.SET', true); + this.fetchData(); + }) + .catch((error) => { + this.toast.showError(error); + }); + } } } } diff --git a/console/src/app/modules/project-roles-table/project-roles-table.component.html b/console/src/app/modules/project-roles-table/project-roles-table.component.html index 9f51d79f40..ed5c512362 100644 --- a/console/src/app/modules/project-roles-table/project-roles-table.component.html +++ b/console/src/app/modules/project-roles-table/project-roles-table.component.html @@ -2,11 +2,11 @@ [showSelectionActionButton]="showSelectionActionButton" *ngIf="projectId" (refreshed)="refreshPage()" - [dataSize]="dataSource?.totalResult ?? 0" + [dataSize]="dataSource.totalResult" [emitRefreshOnPreviousRoutes]="['/projects/' + projectId + '/roles/create']" [selection]="selection" - [loading]="dataSource?.loading$ | async" - [timestamp]="dataSource?.viewTimestamp" + [loading]="dataSource.loading$ | async" + [timestamp]="dataSource.viewTimestamp" > +
-
\ No newline at end of file +
diff --git a/console/src/app/modules/search-user-autocomplete/search-user-autocomplete.component.html b/console/src/app/modules/search-user-autocomplete/search-user-autocomplete.component.html index b518c437f5..7f3b9d3e41 100644 --- a/console/src/app/modules/search-user-autocomplete/search-user-autocomplete.component.html +++ b/console/src/app/modules/search-user-autocomplete/search-user-autocomplete.component.html @@ -12,7 +12,7 @@ " class="avatar" [name]="user.human.profile.displayName" - [avatarUrl]="user.human.profile?.avatarUrl || ''" + [avatarUrl]="user.human.profile.avatarUrl || ''" [forColor]="user.preferredLoginName" [size]="32" > @@ -23,7 +23,7 @@
- {{ user.human?.profile?.displayName }} + {{ user.human.profile?.displayName }} {{ user.preferredLoginName }}
@@ -85,7 +85,7 @@ " class="avatar" [name]="user.human.profile.displayName" - [avatarUrl]="user.human.profile?.avatarUrl || ''" + [avatarUrl]="user.human.profile.avatarUrl || ''" [forColor]="user.preferredLoginName" [size]="32" > diff --git a/console/src/app/modules/user-grants/user-grants.component.html b/console/src/app/modules/user-grants/user-grants.component.html index b4cb055510..b99b0761f8 100644 --- a/console/src/app/modules/user-grants/user-grants.component.html +++ b/console/src/app/modules/user-grants/user-grants.component.html @@ -1,21 +1,12 @@ - - @@ -57,8 +57,8 @@

DNS TOKEN

-
-

{{ dns?.token }}

+
+

{{ dns.token }}

-

{{ dns?.url }}

+

{{ dns.url }}

diff --git a/console/src/app/pages/domains/domain-verification/domain-verification.component.ts b/console/src/app/pages/domains/domain-verification/domain-verification.component.ts index 379f108841..18ea314880 100644 --- a/console/src/app/pages/domains/domain-verification/domain-verification.component.ts +++ b/console/src/app/pages/domains/domain-verification/domain-verification.component.ts @@ -13,12 +13,12 @@ import { ToastService } from 'src/app/services/toast.service'; styleUrls: ['./domain-verification.component.scss'], }) export class DomainVerificationComponent { - public domain!: Domain.AsObject; + public domain?: Domain.AsObject; public DomainValidationType: any = DomainValidationType; - public http!: GenerateOrgDomainValidationResponse.AsObject; - public dns!: GenerateOrgDomainValidationResponse.AsObject; + public http?: GenerateOrgDomainValidationResponse.AsObject; + public dns?: GenerateOrgDomainValidationResponse.AsObject; public copied: string = ''; @@ -34,25 +34,30 @@ export class DomainVerificationComponent { private mgmtService: ManagementService, ) { this.domain = data.domain; - if (this.domain.validationType === DomainValidationType.DOMAIN_VALIDATION_TYPE_UNSPECIFIED) { + + if (this.domain?.validationType === DomainValidationType.DOMAIN_VALIDATION_TYPE_UNSPECIFIED) { this.showNew = true; } } async loadHttpToken(): Promise { - this.mgmtService - .generateOrgDomainValidation(this.domain.domainName, DomainValidationType.DOMAIN_VALIDATION_TYPE_HTTP) - .then((http) => { - this.http = http; - }); + if (this.domain) { + this.mgmtService + .generateOrgDomainValidation(this.domain.domainName, DomainValidationType.DOMAIN_VALIDATION_TYPE_HTTP) + .then((http) => { + this.http = http; + }); + } } async loadDnsToken(): Promise { - this.mgmtService - .generateOrgDomainValidation(this.domain.domainName, DomainValidationType.DOMAIN_VALIDATION_TYPE_DNS) - .then((dns) => { - this.dns = dns; - }); + if (this.domain) { + this.mgmtService + .generateOrgDomainValidation(this.domain.domainName, DomainValidationType.DOMAIN_VALIDATION_TYPE_DNS) + .then((dns) => { + this.dns = dns; + }); + } } public closeDialog(): void { @@ -61,21 +66,25 @@ export class DomainVerificationComponent { public validate(): void { this.validating = true; - this.mgmtService - .validateOrgDomain(this.domain.domainName) - .then(() => { - this.dialogRef.close(true); - this.toast.showInfo('ORG.PAGES.ORGDOMAIN.VERIFICATION_SUCCESSFUL', true); - this.validating = false; - }) - .catch((error) => { - this.toast.showError(error); - this.validating = false; - }); + if (this.domain) { + this.mgmtService + .validateOrgDomain(this.domain.domainName) + .then(() => { + this.dialogRef.close(true); + this.toast.showInfo('ORG.PAGES.ORGDOMAIN.VERIFICATION_SUCCESSFUL', true); + this.validating = false; + }) + .catch((error) => { + this.toast.showError(error); + this.validating = false; + }); + } } public saveFile(): void { - const blob = new Blob([this.http.token], { type: 'text/plain;charset=utf-8' }); - saveAs(blob, this.http.token + '.txt'); + if (this.http) { + const blob = new Blob([this.http.token], { type: 'text/plain;charset=utf-8' }); + saveAs(blob, this.http.token + '.txt'); + } } } diff --git a/console/src/app/pages/instance/instance.component.ts b/console/src/app/pages/instance/instance.component.ts index 539826407b..a0f7cc1a8d 100644 --- a/console/src/app/pages/instance/instance.component.ts +++ b/console/src/app/pages/instance/instance.component.ts @@ -18,7 +18,7 @@ import { ToastService } from 'src/app/services/toast.service'; styleUrls: ['./instance.component.scss'], }) export class InstanceComponent { - public instance!: InstanceDetail.AsObject; + public instance?: InstanceDetail.AsObject; public PolicyComponentServiceType: any = PolicyComponentServiceType; private loadingSubject: BehaviorSubject = new BehaviorSubject(false); public loading$: Observable = this.loadingSubject.asObservable(); diff --git a/console/src/app/pages/org-create/org-create.component.html b/console/src/app/pages/org-create/org-create.component.html index 4c7e270b9f..c51220946b 100644 --- a/console/src/app/pages/org-create/org-create.component.html +++ b/console/src/app/pages/org-create/org-create.component.html @@ -51,7 +51,7 @@

{{ 'ORG.PAGES.ORGDETAILUSER_TITLE' | translate }}

-
+

{{ 'USER.CREATE.NAMEANDEMAILSECTION' | translate }}

@@ -136,7 +136,12 @@

{{ 'USER.CREATE.PASSWORDSECTION' | translate }}

- + @@ -177,7 +182,7 @@ color="primary" class="big-button" (click)="finish()" - [disabled]="orgForm.invalid || userForm.invalid || (usePassword && pwdForm ? pwdForm?.invalid : false)" + [disabled]="orgForm.invalid || userForm.invalid || (usePassword && pwdForm ? pwdForm.invalid : false)" mat-raised-button > {{ 'ACTIONS.FINISH' | translate }} diff --git a/console/src/app/pages/org-create/org-create.component.ts b/console/src/app/pages/org-create/org-create.component.ts index 3d50066eca..65269b5470 100644 --- a/console/src/app/pages/org-create/org-create.component.ts +++ b/console/src/app/pages/org-create/org-create.component.ts @@ -50,14 +50,18 @@ function passwordConfirmValidator(c: AbstractControl): any { ], }) export class OrgCreateComponent { - public orgForm!: UntypedFormGroup; - public userForm!: UntypedFormGroup; - public pwdForm!: UntypedFormGroup; + public orgForm: UntypedFormGroup = this.fb.group({ + name: ['', [Validators.required]], + domain: [''], + }); + + public userForm?: UntypedFormGroup; + public pwdForm?: UntypedFormGroup; public genders: Gender[] = [Gender.GENDER_FEMALE, Gender.GENDER_MALE, Gender.GENDER_UNSPECIFIED]; - public languages: string[] = ['de', 'en']; + public languages: string[] = ['de', 'en', 'it', 'fr']; - public policy!: PasswordComplexityPolicy.AsObject; + public policy?: PasswordComplexityPolicy.AsObject; public usePassword: boolean = false; public forSelf: boolean = true; @@ -70,7 +74,7 @@ export class OrgCreateComponent { private fb: UntypedFormBuilder, private mgmtService: ManagementService, private authService: GrpcAuthService, - private breadcrumbService: BreadcrumbService, + breadcrumbService: BreadcrumbService, ) { const instanceBread = new Breadcrumb({ type: BreadcrumbType.INSTANCE, @@ -89,12 +93,11 @@ export class OrgCreateComponent { } }); - this.orgForm = this.fb.group({ - name: ['', [Validators.required]], - domain: [''], - }); - this.initForm(); + + this.adminService.getSupportedLanguages().then((supportedResp) => { + this.languages = supportedResp.languagesList; + }); } public createSteps: number = 2; @@ -125,16 +128,8 @@ export class OrgCreateComponent { this.adminService .SetUpOrg(createOrgRequest, humanRequest) - .then((resp) => { + .then(() => { this.router.navigate(['/orgs']); - - // const orgResp = org.getOrg(); - // if (orgResp) { - // this.authService.setActiveOrg(orgResp.toObject()); - // this.router.navigate(['/org']); - // } else { - // this.router.navigate(['/org', 'overview']); - // } }) .catch((error) => { this.toast.showError(error); @@ -241,43 +236,43 @@ export class OrgCreateComponent { } public get userName(): AbstractControl | null { - return this.userForm.get('userName'); + return this.userForm?.get('userName') ?? null; } public get firstName(): AbstractControl | null { - return this.userForm.get('firstName'); + return this.userForm?.get('firstName') ?? null; } public get lastName(): AbstractControl | null { - return this.userForm.get('lastName'); + return this.userForm?.get('lastName') ?? null; } public get email(): AbstractControl | null { - return this.userForm.get('email'); + return this.userForm?.get('email') ?? null; } public get isVerified(): AbstractControl | null { - return this.userForm.get('isVerified'); + return this.userForm?.get('isVerified') ?? null; } public get nickName(): AbstractControl | null { - return this.userForm.get('nickName'); + return this.userForm?.get('nickName') ?? null; } public get preferredLanguage(): AbstractControl | null { - return this.userForm.get('preferredLanguage'); + return this.userForm?.get('preferredLanguage') ?? null; } public get gender(): AbstractControl | null { - return this.userForm.get('gender'); + return this.userForm?.get('gender') ?? null; } public get password(): AbstractControl | null { - return this.pwdForm.get('password'); + return this.pwdForm?.get('password') ?? null; } public get confirmPassword(): AbstractControl | null { - return this.pwdForm.get('confirmPassword'); + return this.pwdForm?.get('confirmPassword') ?? null; } public close(): void { diff --git a/console/src/app/pages/orgs/org-detail/org-detail.component.ts b/console/src/app/pages/orgs/org-detail/org-detail.component.ts index 94ec446968..3ef1f32486 100644 --- a/console/src/app/pages/orgs/org-detail/org-detail.component.ts +++ b/console/src/app/pages/orgs/org-detail/org-detail.component.ts @@ -21,7 +21,7 @@ import { ToastService } from 'src/app/services/toast.service'; styleUrls: ['./org-detail.component.scss'], }) export class OrgDetailComponent implements OnInit, OnDestroy { - public org!: Org.AsObject; + public org?: Org.AsObject; public PolicyComponentServiceType: any = PolicyComponentServiceType; public OrgState: any = OrgState; @@ -80,7 +80,7 @@ export class OrgDetailComponent implements OnInit, OnDestroy { .reactivateOrg() .then(() => { this.toast.showInfo('ORG.TOAST.REACTIVATED', true); - this.org.state = OrgState.ORG_STATE_ACTIVE; + this.org!.state = OrgState.ORG_STATE_ACTIVE; }) .catch((error) => { this.toast.showError(error); @@ -103,7 +103,7 @@ export class OrgDetailComponent implements OnInit, OnDestroy { .deactivateOrg() .then(() => { this.toast.showInfo('ORG.TOAST.DEACTIVATED', true); - this.org.state = OrgState.ORG_STATE_INACTIVE; + this.org!.state = OrgState.ORG_STATE_INACTIVE; }) .catch((error) => { this.toast.showError(error); diff --git a/console/src/app/pages/orgs/org-members/org-members.component.ts b/console/src/app/pages/orgs/org-members/org-members.component.ts index eabeba6e60..fd618e0e5f 100644 --- a/console/src/app/pages/orgs/org-members/org-members.component.ts +++ b/console/src/app/pages/orgs/org-members/org-members.component.ts @@ -19,7 +19,7 @@ import { OrgMembersDataSource } from './org-members-datasource'; }) export class OrgMembersComponent { public INITIALPAGESIZE: number = 25; - public org!: Org.AsObject; + public org?: Org.AsObject; public disableWrite: boolean = false; public dataSource!: OrgMembersDataSource; diff --git a/console/src/app/pages/projects/apps/app-create/app-create.component.html b/console/src/app/pages/projects/apps/app-create/app-create.component.html index 82bd772227..c2baf20b9e 100644 --- a/console/src/app/pages/projects/apps/app-create/app-create.component.html +++ b/console/src/app/pages/projects/apps/app-create/app-create.component.html @@ -186,7 +186,7 @@ - {{ 'APP.OIDC.AUTHMETHOD.' + oidcAppRequest?.authMethodType | translate }} + {{ 'APP.OIDC.AUTHMETHOD.' + oidcAppRequest.authMethodType | translate }}
@@ -226,7 +226,7 @@ - {{ 'APP.API.AUTHMETHOD.' + apiAppRequest?.authMethodType | translate }} + {{ 'APP.API.AUTHMETHOD.' + apiAppRequest.authMethodType | translate }}
diff --git a/console/src/app/pages/projects/apps/app-create/app-create.component.ts b/console/src/app/pages/projects/apps/app-create/app-create.component.ts index a7c97ea550..0d9d12cc18 100644 --- a/console/src/app/pages/projects/apps/app-create/app-create.component.ts +++ b/console/src/app/pages/projects/apps/app-create/app-create.component.ts @@ -9,17 +9,17 @@ import { Subject, Subscription } from 'rxjs'; import { debounceTime, takeUntil } from 'rxjs/operators'; import { RadioItemAuthType } from 'src/app/modules/app-radio/app-auth-method-radio/app-auth-method-radio.component'; import { - APIAuthMethodType, - OIDCAppType, - OIDCAuthMethodType, - OIDCGrantType, - OIDCResponseType, + APIAuthMethodType, + OIDCAppType, + OIDCAuthMethodType, + OIDCGrantType, + OIDCResponseType, } from 'src/app/proto/generated/zitadel/app_pb'; import { - AddAPIAppRequest, - AddAPIAppResponse, - AddOIDCAppRequest, - AddOIDCAppResponse, + AddAPIAppRequest, + AddAPIAppResponse, + AddOIDCAppRequest, + AddOIDCAppResponse, } from 'src/app/proto/generated/zitadel/management_pb'; import { Breadcrumb, BreadcrumbService, BreadcrumbType } from 'src/app/services/breadcrumb.service'; import { ManagementService } from 'src/app/services/mgmt.service'; @@ -27,13 +27,13 @@ import { ToastService } from 'src/app/services/toast.service'; import { AppSecretDialogComponent } from '../app-secret-dialog/app-secret-dialog.component'; import { - BASIC_AUTH_METHOD, - CODE_METHOD, - getPartialConfigFromAuthMethod, - IMPLICIT_METHOD, - PK_JWT_METHOD, - PKCE_METHOD, - POST_METHOD, + BASIC_AUTH_METHOD, + CODE_METHOD, + getPartialConfigFromAuthMethod, + IMPLICIT_METHOD, + PK_JWT_METHOD, + PKCE_METHOD, + POST_METHOD, } from '../authmethods'; import { API_TYPE, AppCreateType, NATIVE_TYPE, RadioItemAppType, USER_AGENT_TYPE, WEB_TYPE } from '../authtypes'; @@ -43,7 +43,7 @@ import { API_TYPE, AppCreateType, NATIVE_TYPE, RadioItemAppType, USER_AGENT_TYPE styleUrls: ['./app-create.component.scss'], }) export class AppCreateComponent implements OnInit, OnDestroy { - private subscription?: Subscription; + private subscription: Subscription = new Subscription(); private destroyed$: Subject = new Subject(); public devmode: boolean = false; public projectId: string = ''; diff --git a/console/src/app/pages/projects/apps/app-detail/app-detail.component.html b/console/src/app/pages/projects/apps/app-detail/app-detail.component.html index dfdd13fcc9..78688eed71 100644 --- a/console/src/app/pages/projects/apps/app-detail/app-detail.component.html +++ b/console/src/app/pages/projects/apps/app-detail/app-detail.component.html @@ -57,7 +57,10 @@
-
+

{{ 'APP.COMPLIANCE' | translate }}

    @@ -355,7 +358,7 @@ diff --git a/console/src/app/pages/projects/apps/app-detail/app-detail.component.ts b/console/src/app/pages/projects/apps/app-detail/app-detail.component.ts index ee069eaa08..367cc55c4f 100644 --- a/console/src/app/pages/projects/apps/app-detail/app-detail.component.ts +++ b/console/src/app/pages/projects/apps/app-detail/app-detail.component.ts @@ -17,21 +17,21 @@ import { NameDialogComponent } from 'src/app/modules/name-dialog/name-dialog.com import { SidenavSetting } from 'src/app/modules/sidenav/sidenav.component'; import { WarnDialogComponent } from 'src/app/modules/warn-dialog/warn-dialog.component'; import { - APIAuthMethodType, - APIConfig, - App, - AppState, - OIDCAppType, - OIDCAuthMethodType, - OIDCConfig, - OIDCGrantType, - OIDCResponseType, - OIDCTokenType, + APIAuthMethodType, + APIConfig, + App, + AppState, + OIDCAppType, + OIDCAuthMethodType, + OIDCConfig, + OIDCGrantType, + OIDCResponseType, + OIDCTokenType, } from 'src/app/proto/generated/zitadel/app_pb'; import { - GetOIDCInformationResponse, - UpdateAPIAppConfigRequest, - UpdateOIDCAppConfigRequest, + GetOIDCInformationResponse, + UpdateAPIAppConfigRequest, + UpdateOIDCAppConfigRequest, } from 'src/app/proto/generated/zitadel/management_pb'; import { Breadcrumb, BreadcrumbService, BreadcrumbType } from 'src/app/services/breadcrumb.service'; import { GrpcAuthService } from 'src/app/services/grpc-auth.service'; @@ -40,15 +40,15 @@ import { ToastService } from 'src/app/services/toast.service'; import { AppSecretDialogComponent } from '../app-secret-dialog/app-secret-dialog.component'; import { - BASIC_AUTH_METHOD, - CODE_METHOD, - CUSTOM_METHOD, - getAuthMethodFromPartialConfig, - getPartialConfigFromAuthMethod, - IMPLICIT_METHOD, - PK_JWT_METHOD, - PKCE_METHOD, - POST_METHOD, + BASIC_AUTH_METHOD, + CODE_METHOD, + CUSTOM_METHOD, + getAuthMethodFromPartialConfig, + getPartialConfigFromAuthMethod, + IMPLICIT_METHOD, + PK_JWT_METHOD, + PKCE_METHOD, + POST_METHOD, } from '../authmethods'; import { AuthMethodDialogComponent } from './auth-method-dialog/auth-method-dialog.component'; @@ -71,7 +71,7 @@ export class AppDetailComponent implements OnInit, OnDestroy { public authMethods: RadioItemAuthType[] = []; private subscription?: Subscription; public projectId: string = ''; - public app!: App.AsObject; + public app?: App.AsObject; public environmentMap: { [key: string]: string } = {}; @@ -183,7 +183,7 @@ export class AppDetailComponent implements OnInit, OnDestroy { public openNameDialog(): void { const dialogRef = this.dialog.open(NameDialogComponent, { data: { - name: this.app.name, + name: this.app?.name, titleKey: 'APP.NAMEDIALOG.TITLE', descKey: 'APP.NAMEDIALOG.DESCRIPTION', labelKey: 'APP.NAMEDIALOG.NAME', @@ -193,7 +193,7 @@ export class AppDetailComponent implements OnInit, OnDestroy { dialogRef.afterClosed().subscribe((name) => { if (name) { - this.app.name = name; + this.app!.name = name; this.saveApp(); } }); @@ -344,7 +344,6 @@ export class AppDetailComponent implements OnInit, OnDestroy { } }) .catch((error) => { - console.error(error); this.toast.showError(error); this.errorMessage = error.message; }); @@ -354,7 +353,7 @@ export class AppDetailComponent implements OnInit, OnDestroy { private getAuthMethodOptions(type: string): void { if (type === 'OIDC') { - switch (this.app.oidcConfig?.appType) { + switch (this.app?.oidcConfig?.appType) { case OIDCAppType.OIDC_APP_TYPE_NATIVE: this.authMethods = [PKCE_METHOD, CUSTOM_METHOD]; break; @@ -378,17 +377,17 @@ export class AppDetailComponent implements OnInit, OnDestroy { public setPartialConfigFromAuthMethod(authMethod: string): void { const partialConfig = getPartialConfigFromAuthMethod(authMethod); - if (partialConfig && partialConfig.oidc && this.app.oidcConfig) { - this.app.oidcConfig.responseTypesList = (partialConfig.oidc as Partial).responseTypesList ?? []; + if (partialConfig && partialConfig.oidc && this.app?.oidcConfig) { + this.app!.oidcConfig.responseTypesList = (partialConfig.oidc as Partial).responseTypesList ?? []; - this.app.oidcConfig.grantTypesList = (partialConfig.oidc as Partial).grantTypesList ?? []; + this.app!.oidcConfig.grantTypesList = (partialConfig.oidc as Partial).grantTypesList ?? []; - this.app.oidcConfig.authMethodType = + this.app!.oidcConfig.authMethodType = (partialConfig.oidc as Partial).authMethodType ?? OIDCAuthMethodType.OIDC_AUTH_METHOD_TYPE_NONE; this.oidcForm.patchValue(this.app.oidcConfig); this.oidcTokenForm.patchValue(this.app.oidcConfig); - } else if (partialConfig && partialConfig.api && this.app.apiConfig) { + } else if (partialConfig && partialConfig.api && this.app?.apiConfig) { this.app.apiConfig.authMethodType = (partialConfig.api as Partial).authMethodType ?? APIAuthMethodType.API_AUTH_METHOD_TYPE_BASIC; @@ -408,7 +407,7 @@ export class AppDetailComponent implements OnInit, OnDestroy { }); dialogRef.afterClosed().subscribe((resp) => { - if (resp && this.projectId && this.app.id) { + if (resp && this.projectId && this.app?.id) { this.mgmtService .removeApp(this.projectId, this.app.id) .then(() => { @@ -424,21 +423,21 @@ export class AppDetailComponent implements OnInit, OnDestroy { } public changeState(state: AppState): void { - if (state === AppState.APP_STATE_ACTIVE) { + if (state === AppState.APP_STATE_ACTIVE && this.app) { this.mgmtService .reactivateApp(this.projectId, this.app.id) .then(() => { - this.app.state = state; + this.app!.state = state; this.toast.showInfo('APP.TOAST.REACTIVATED', true); }) .catch((error: any) => { this.toast.showError(error); }); - } else if (state === AppState.APP_STATE_INACTIVE) { + } else if (state === AppState.APP_STATE_INACTIVE && this.app) { this.mgmtService .deactivateApp(this.projectId, this.app.id) .then(() => { - this.app.state = state; + this.app!.state = state; this.toast.showInfo('APP.TOAST.DEACTIVATED', true); }) .catch((error: any) => { @@ -448,15 +447,17 @@ export class AppDetailComponent implements OnInit, OnDestroy { } public saveApp(): void { - this.mgmtService - .updateApp(this.projectId, this.app.id, this.app.name) - .then(() => { - this.toast.showInfo('APP.TOAST.UPDATED', true); - this.editState = false; - }) - .catch((error) => { - this.toast.showError(error); - }); + if (this.app) { + this.mgmtService + .updateApp(this.projectId, this.app.id, this.app.name) + .then(() => { + this.toast.showInfo('APP.TOAST.UPDATED', true); + this.editState = false; + }) + .catch((error) => { + this.toast.showError(error); + }); + } } public toggleRefreshToken(event: MatCheckboxChange): void { @@ -481,7 +482,7 @@ export class AppDetailComponent implements OnInit, OnDestroy { public saveOIDCApp(): void { this.requestRedirectValuesSubject$.next(); if (this.oidcForm.valid) { - if (this.app.oidcConfig) { + if (this.app?.oidcConfig) { // configuration this.app.oidcConfig.responseTypesList = this.responseTypesList?.value; this.app.oidcConfig.grantTypesList = this.grantTypesList?.value; @@ -532,7 +533,7 @@ export class AppDetailComponent implements OnInit, OnDestroy { this.mgmtService .updateOIDCAppConfig(req) .then(() => { - if (this.app.oidcConfig) { + if (this.app?.oidcConfig) { const config = { oidc: this.app.oidcConfig }; this.currentAuthMethod = this.authMethodFromPartialConfig(config); } @@ -546,7 +547,7 @@ export class AppDetailComponent implements OnInit, OnDestroy { } public saveAPIApp(): void { - if (this.apiForm.valid && this.app.apiConfig) { + if (this.apiForm.valid && this.app?.apiConfig) { this.app.apiConfig.authMethodType = this.apiAuthMethodType?.value; const req = new UpdateAPIAppConfigRequest(); @@ -557,7 +558,7 @@ export class AppDetailComponent implements OnInit, OnDestroy { this.mgmtService .updateAPIAppConfig(req) .then(() => { - if (this.app.apiConfig) { + if (this.app?.apiConfig) { const config = { api: this.app.apiConfig }; this.currentAuthMethod = this.authMethodFromPartialConfig(config); @@ -581,21 +582,23 @@ export class AppDetailComponent implements OnInit, OnDestroy { } public regenerateOIDCClientSecret(): void { - this.mgmtService - .regenerateOIDCClientSecret(this.app.id, this.projectId) - .then((resp) => { - this.toast.showInfo('APP.TOAST.CLIENTSECRETREGENERATED', true); - this.dialog.open(AppSecretDialogComponent, { - data: { - // clientId: data.toObject() as ClientSecret.AsObject.clientId, - clientSecret: resp.clientSecret, - }, - width: '400px', + if (this.app) { + this.mgmtService + .regenerateOIDCClientSecret(this.app.id, this.projectId) + .then((resp) => { + this.toast.showInfo('APP.TOAST.CLIENTSECRETREGENERATED', true); + this.dialog.open(AppSecretDialogComponent, { + data: { + // clientId: data.toObject() as ClientSecret.AsObject.clientId, + clientSecret: resp.clientSecret, + }, + width: '400px', + }); + }) + .catch((error) => { + this.toast.showError(error); }); - }) - .catch((error) => { - this.toast.showError(error); - }); + } } public changeAuthMethod(): void { @@ -617,20 +620,22 @@ export class AppDetailComponent implements OnInit, OnDestroy { } public regenerateAPIClientSecret(): void { - this.mgmtService - .regenerateAPIClientSecret(this.app.id, this.projectId) - .then((resp) => { - this.toast.showInfo('APP.TOAST.CLIENTSECRETREGENERATED', true); - this.dialog.open(AppSecretDialogComponent, { - data: { - clientSecret: resp.clientSecret, - }, - width: '400px', + if (this.app) { + this.mgmtService + .regenerateAPIClientSecret(this.app.id, this.projectId) + .then((resp) => { + this.toast.showInfo('APP.TOAST.CLIENTSECRETREGENERATED', true); + this.dialog.open(AppSecretDialogComponent, { + data: { + clientSecret: resp.clientSecret, + }, + width: '400px', + }); + }) + .catch((error) => { + this.toast.showError(error); }); - }) - .catch((error) => { - this.toast.showError(error); - }); + } } public get currentRadioItemAuthType(): RadioItemAuthType | undefined { diff --git a/console/src/app/pages/projects/granted-projects/granted-project-detail/granted-project-detail.component.html b/console/src/app/pages/projects/granted-projects/granted-project-detail/granted-project-detail.component.html index eb1a3751fe..4736d6b3db 100644 --- a/console/src/app/pages/projects/granted-projects/granted-project-detail/granted-project-detail.component.html +++ b/console/src/app/pages/projects/granted-projects/granted-project-detail/granted-project-detail.component.html @@ -54,7 +54,12 @@
    - +
diff --git a/console/src/app/pages/projects/granted-projects/granted-project-detail/granted-project-detail.component.ts b/console/src/app/pages/projects/granted-projects/granted-project-detail/granted-project-detail.component.ts index 6bec120bbb..ba9e9883eb 100644 --- a/console/src/app/pages/projects/granted-projects/granted-project-detail/granted-project-detail.component.ts +++ b/console/src/app/pages/projects/granted-projects/granted-project-detail/granted-project-detail.component.ts @@ -23,16 +23,12 @@ import { ToastService } from 'src/app/services/toast.service'; export class GrantedProjectDetailComponent implements OnInit, OnDestroy { public projectId: string = ''; public grantId: string = ''; - public project!: GrantedProject.AsObject; - + public project?: GrantedProject.AsObject; public ProjectGrantState: any = ProjectGrantState; public ChangeType: any = ChangeType; - - private subscription?: Subscription; - public isZitadel: boolean = false; - - UserGrantContext: any = UserGrantContext; + public UserGrantContext: any = UserGrantContext; + private subscription: Subscription = new Subscription(); // members public totalMemberResult: number = 0; @@ -56,7 +52,7 @@ export class GrantedProjectDetailComponent implements OnInit, OnDestroy { } public ngOnDestroy(): void { - this.subscription?.unsubscribe(); + this.subscription.unsubscribe(); } private async getData({ id, grantId }: Params): Promise { @@ -155,6 +151,8 @@ export class GrantedProjectDetailComponent implements OnInit, OnDestroy { } public showDetail(): void { - this.router.navigate(['granted-projects', this.project.projectId, 'grant', this.grantId, 'members']); + if (this.project) { + this.router.navigate(['granted-projects', this.project.projectId, 'grant', this.grantId, 'members']); + } } } diff --git a/console/src/app/pages/projects/owned-projects/owned-project-detail/applications/applications.component.html b/console/src/app/pages/projects/owned-projects/owned-project-detail/applications/applications.component.html index 83f8ce484b..a45927c28f 100644 --- a/console/src/app/pages/projects/owned-projects/owned-project-detail/applications/applications.component.html +++ b/console/src/app/pages/projects/owned-projects/owned-project-detail/applications/applications.component.html @@ -1,8 +1,12 @@ - + - + add{{ 'ACTIONS.NEW' | translate }} @@ -11,66 +15,87 @@ - - + + - - + - - + - - + - - + - +
- + [indeterminate]="selection.hasValue() && !isAllSelected()" + > - + {{ 'APP.NAME' | translate }} - {{app.name}} {{ 'APP.NAME' | translate }} + {{ app.name }} + {{ 'APP.TYPE' | translate }} + {{ 'APP.TYPE' | translate }} - {{'APP.OIDC.APPTYPE.'+app?.oidcConfig?.appType | translate}} + {{ 'APP.OIDC.APPTYPE.' + app?.oidcConfig?.appType | translate }} API {{ 'USER.DATA.STATE' | translate }} - - {{('APP.PAGES.DETAIL.STATE.'+app?.state) | translate}} + {{ 'USER.DATA.STATE' | translate }} + + {{ 'APP.PAGES.DETAIL.STATE.' + app?.state | translate }} {{ 'PROJECT.ROLE.CREATIONDATE' | translate }} - {{app.details.creationDate | timestampToDate | - localizedDate: 'dd. MMM, HH:mm' }} + {{ 'PROJECT.ROLE.CREATIONDATE' | translate }} + {{ + app.details.creationDate | timestampToDate | localizedDate: 'dd. MMM, HH:mm' + }} {{ 'PROJECT.ROLE.CHANGEDATE' | translate }} - {{app.details.changeDate | timestampToDate | - localizedDate: 'dd. MMM, HH:mm' }} + {{ 'PROJECT.ROLE.CHANGEDATE' | translate }} + {{ + app.details.changeDate | timestampToDate | localizedDate: 'dd. MMM, HH:mm' + }}
- + - \ No newline at end of file + diff --git a/console/src/app/pages/projects/owned-projects/owned-project-detail/applications/applications.component.ts b/console/src/app/pages/projects/owned-projects/owned-project-detail/applications/applications.component.ts index ac82015965..86fdb49df2 100644 --- a/console/src/app/pages/projects/owned-projects/owned-project-detail/applications/applications.component.ts +++ b/console/src/app/pages/projects/owned-projects/owned-project-detail/applications/applications.component.ts @@ -19,7 +19,7 @@ export class ApplicationsComponent implements AfterViewInit, OnInit { @Input() public disabled: boolean = false; @ViewChild(PaginatorComponent) public paginator!: PaginatorComponent; @ViewChild(MatTable) public table!: MatTable; - public dataSource!: ProjectApplicationsDataSource; + public dataSource: ProjectApplicationsDataSource = new ProjectApplicationsDataSource(this.mgmtService); public selection: SelectionModel = new SelectionModel(true, []); public displayedColumns: string[] = ['name', 'type', 'state', 'creationDate', 'changeDate']; @@ -27,7 +27,6 @@ export class ApplicationsComponent implements AfterViewInit, OnInit { constructor(private mgmtService: ManagementService) {} ngOnInit(): void { - this.dataSource = new ProjectApplicationsDataSource(this.mgmtService); this.dataSource.loadApps(this.projectId, 0, 25); } diff --git a/console/src/app/pages/projects/owned-projects/owned-project-detail/owned-project-detail.component.html b/console/src/app/pages/projects/owned-projects/owned-project-detail/owned-project-detail.component.html index dad03837da..cc3633547d 100644 --- a/console/src/app/pages/projects/owned-projects/owned-project-detail/owned-project-detail.component.html +++ b/console/src/app/pages/projects/owned-projects/owned-project-detail/owned-project-detail.component.html @@ -15,7 +15,7 @@ - {{ 'PROJECT.GRANT.CREATE.FOR_ORG' | translate }} {{ org?.name }} + {{ 'PROJECT.GRANT.CREATE.FOR_ORG' | translate }} {{ org.name }} diff --git a/console/src/app/pages/projects/owned-projects/project-grant-create/project-grant-create.component.ts b/console/src/app/pages/projects/owned-projects/project-grant-create/project-grant-create.component.ts index 533cec389d..eaa7d7ad18 100644 --- a/console/src/app/pages/projects/owned-projects/project-grant-create/project-grant-create.component.ts +++ b/console/src/app/pages/projects/owned-projects/project-grant-create/project-grant-create.component.ts @@ -16,7 +16,7 @@ const ROUTEPARAM = 'projectid'; styleUrls: ['./project-grant-create.component.scss'], }) export class ProjectGrantCreateComponent implements OnInit, OnDestroy { - public org!: Org.AsObject; + public org?: Org.AsObject; public projectId: string = ''; public grantId: string = ''; public rolesKeyList: string[] = []; @@ -77,14 +77,16 @@ export class ProjectGrantCreateComponent implements OnInit, OnDestroy { } public addGrant(): void { - this.mgmtService - .addProjectGrant(this.org.id, this.projectId, this.rolesKeyList) - .then(() => { - this.close(); - }) - .catch((error) => { - this.toast.showError(error); - }); + if (this.org) { + this.mgmtService + .addProjectGrant(this.org.id, this.projectId, this.rolesKeyList) + .then(() => { + this.close(); + }) + .catch((error) => { + this.toast.showError(error); + }); + } } public selectRoles(roles: Role.AsObject[]): void { diff --git a/console/src/app/pages/projects/owned-projects/project-grants/project-grants.component.html b/console/src/app/pages/projects/owned-projects/project-grants/project-grants.component.html index b8bcb74e5c..ec57e132a4 100644 --- a/console/src/app/pages/projects/owned-projects/project-grants/project-grants.component.html +++ b/console/src/app/pages/projects/owned-projects/project-grants/project-grants.component.html @@ -2,12 +2,12 @@
@@ -149,7 +149,7 @@ class="paginator" #paginator [pageSize]="50" - [timestamp]="dataSource?.viewTimestamp" + [timestamp]="dataSource.viewTimestamp" [pageSizeOptions]="[25, 50, 100, 250]" [length]="dataSource.totalResult" (page)="loadGrantsPage($event.pageIndex, $event.pageSize)" diff --git a/console/src/app/pages/projects/owned-projects/project-grants/project-grants.component.ts b/console/src/app/pages/projects/owned-projects/project-grants/project-grants.component.ts index f044ffdb50..7030c8d25a 100644 --- a/console/src/app/pages/projects/owned-projects/project-grants/project-grants.component.ts +++ b/console/src/app/pages/projects/owned-projects/project-grants/project-grants.component.ts @@ -32,12 +32,12 @@ export class ProjectGrantsComponent implements OnInit, AfterViewInit { @Input() public projectId: string = ''; @ViewChild(PaginatorComponent) public paginator!: PaginatorComponent; @ViewChild(MatTable) public table!: MatTable; - public dataSource!: ProjectGrantsDataSource; + public dataSource: ProjectGrantsDataSource = new ProjectGrantsDataSource(this.mgmtService, this.toast); public selection: SelectionModel = new SelectionModel(true, []); public memberRoleOptions: Role.AsObject[] = []; public displayedColumns: string[] = ['grantedOrgName', 'state', 'creationDate', 'changeDate', 'roleNamesList', 'actions']; - ProjectGrantState: any = ProjectGrantState; + public ProjectGrantState: any = ProjectGrantState; constructor( private mgmtService: ManagementService, @@ -51,7 +51,6 @@ export class ProjectGrantsComponent implements OnInit, AfterViewInit { } public ngOnInit(): void { - this.dataSource = new ProjectGrantsDataSource(this.mgmtService, this.toast); this.dataSource.loadGrants(this.projectId, 0, 25, 'asc'); this.getRoleOptions(this.projectId); } diff --git a/console/src/app/pages/user-grant-create/user-grant-create.component.html b/console/src/app/pages/user-grant-create/user-grant-create.component.html index f7dfb67e73..e2ebbf9583 100644 --- a/console/src/app/pages/user-grant-create/user-grant-create.component.html +++ b/console/src/app/pages/user-grant-create/user-grant-create.component.html @@ -40,7 +40,9 @@ diff --git a/console/src/app/pages/user-grant-create/user-grant-create.component.ts b/console/src/app/pages/user-grant-create/user-grant-create.component.ts index 469b052d24..62d0398298 100644 --- a/console/src/app/pages/user-grant-create/user-grant-create.component.ts +++ b/console/src/app/pages/user-grant-create/user-grant-create.component.ts @@ -21,11 +21,11 @@ import { ToastService } from 'src/app/services/toast.service'; export class UserGrantCreateComponent implements OnDestroy { public context!: UserGrantContext; - public org!: Org.AsObject; + public org?: Org.AsObject; public userIds: string[] = []; - public project!: Project.AsObject; - public grantedProject!: GrantedProject.AsObject; + public project?: Project.AsObject; + public grantedProject?: GrantedProject.AsObject; public rolesList: string[] = []; @@ -34,7 +34,7 @@ export class UserGrantCreateComponent implements OnDestroy { public UserGrantContext: any = UserGrantContext; - public user!: User.AsObject; + public user?: User.AsObject; public UserTarget: any = UserTarget; public editState: boolean = false; @@ -114,7 +114,7 @@ export class UserGrantCreateComponent implements OnDestroy { public addGrant(): void { switch (this.context) { case UserGrantContext.OWNED_PROJECT: - const prom = this.userIds.map((id) => this.userService.addUserGrant(id, this.rolesList, this.project.id)); + const prom = this.userIds.map((id) => this.userService.addUserGrant(id, this.rolesList, this.project?.id)); Promise.all(prom) .then(() => { this.toast.showInfo('GRANTS.TOAST.UPDATED', true); @@ -127,7 +127,7 @@ export class UserGrantCreateComponent implements OnDestroy { break; case UserGrantContext.GRANTED_PROJECT: const promp = this.userIds.map((id) => - this.userService.addUserGrant(id, this.rolesList, this.grantedProject.projectId, this.grantedProject.grantId), + this.userService.addUserGrant(id, this.rolesList, this.grantedProject?.projectId, this.grantedProject?.grantId), ); Promise.all(promp) .then(() => { diff --git a/console/src/app/pages/users/user-detail/auth-user-detail/auth-passwordless/auth-passwordless.component.html b/console/src/app/pages/users/user-detail/auth-user-detail/auth-passwordless/auth-passwordless.component.html index fd210a0d5c..253707be1a 100644 --- a/console/src/app/pages/users/user-detail/auth-user-detail/auth-passwordless/auth-passwordless.component.html +++ b/console/src/app/pages/users/user-detail/auth-user-detail/auth-passwordless/auth-passwordless.component.html @@ -1,31 +1,55 @@ - - - - - - + - - + @@ -34,8 +58,13 @@ - +
{{ 'USER.PASSWORDLESS.NAME' | translate }} + {{ 'USER.PASSWORDLESS.NAME' | translate }} + {{ mfa?.name }} {{ 'USER.PASSWORDLESS.TABLESTATE' | translate }} - {{'USER.PASSWORDLESS.STATE.'+ - mfa.state | translate}} + {{ 'USER.PASSWORDLESS.TABLESTATE' | translate }} + + {{ 'USER.PASSWORDLESS.STATE.' + mfa.state | translate }} - @@ -43,11 +72,11 @@
- {{'USER.PASSWORDLESS.EMPTY' | translate}} + {{ 'USER.PASSWORDLESS.EMPTY' | translate }}
@@ -55,4 +84,4 @@
- \ No newline at end of file + diff --git a/console/src/app/pages/users/user-detail/auth-user-detail/auth-passwordless/auth-passwordless.component.ts b/console/src/app/pages/users/user-detail/auth-user-detail/auth-passwordless/auth-passwordless.component.ts index 560ab0e957..b59676e1a1 100644 --- a/console/src/app/pages/users/user-detail/auth-user-detail/auth-passwordless/auth-passwordless.component.ts +++ b/console/src/app/pages/users/user-detail/auth-user-detail/auth-passwordless/auth-passwordless.component.ts @@ -34,7 +34,7 @@ export class AuthPasswordlessComponent implements OnInit, OnDestroy { @ViewChild(MatTable) public table!: MatTable; @ViewChild(MatSort) public sort!: MatSort; - public dataSource!: MatTableDataSource; + public dataSource: MatTableDataSource = new MatTableDataSource([]); public AuthFactorState: any = AuthFactorState; public error: string = ''; diff --git a/console/src/app/pages/users/user-detail/auth-user-detail/auth-user-detail.component.html b/console/src/app/pages/users/user-detail/auth-user-detail/auth-user-detail.component.html index 0af8c82cc4..9d58f480f4 100644 --- a/console/src/app/pages/users/user-detail/auth-user-detail/auth-user-detail.component.html +++ b/console/src/app/pages/users/user-detail/auth-user-detail/auth-user-detail.component.html @@ -1,5 +1,5 @@ @@ -130,7 +130,7 @@ - + diff --git a/console/src/app/pages/users/user-detail/auth-user-detail/auth-user-detail.component.ts b/console/src/app/pages/users/user-detail/auth-user-detail/auth-user-detail.component.ts index 53c8605093..65ffe407f6 100644 --- a/console/src/app/pages/users/user-detail/auth-user-detail/auth-user-detail.component.ts +++ b/console/src/app/pages/users/user-detail/auth-user-detail/auth-user-detail.component.ts @@ -23,7 +23,7 @@ import { EditDialogComponent, EditDialogType } from './edit-dialog/edit-dialog.c styleUrls: ['./auth-user-detail.component.scss'], }) export class AuthUserDetailComponent implements OnDestroy { - public user!: User.AsObject; + public user?: User.AsObject; public genders: Gender[] = [Gender.GENDER_MALE, Gender.GENDER_FEMALE, Gender.GENDER_DIVERSE]; public languages: string[] = ['de', 'en', 'it']; @@ -132,13 +132,13 @@ export class AuthUserDetailComponent implements OnDestroy { labelKey: 'ACTIONS.NEWVALUE', titleKey: 'USER.PROFILE.CHANGEUSERNAME_TITLE', descriptionKey: 'USER.PROFILE.CHANGEUSERNAME_DESC', - value: this.user.userName, + value: this.user?.userName, }, width: '400px', }); dialogRef.afterClosed().subscribe((resp: { value: string }) => { - if (resp && resp.value && resp.value !== this.user.userName) { + if (resp && resp.value && resp.value !== this.user?.userName) { this.userService .updateMyUserName(resp.value) .then(() => { @@ -153,7 +153,7 @@ export class AuthUserDetailComponent implements OnDestroy { } public saveProfile(profileData: Profile.AsObject): void { - if (this.user.human) { + if (this.user?.human) { this.user.human.profile = profileData; this.userService @@ -180,7 +180,7 @@ export class AuthUserDetailComponent implements OnDestroy { .setMyEmail(email) .then(() => { this.toast.showInfo('USER.TOAST.EMAILSAVED', true); - if (this.user.human) { + if (this.user?.human) { const mailToSet = new Email(); mailToSet.setEmail(email); this.user.human.email = mailToSet.toObject(); @@ -237,7 +237,7 @@ export class AuthUserDetailComponent implements OnDestroy { .removeMyPhone() .then(() => { this.toast.showInfo('USER.TOAST.PHONEREMOVED', true); - if (this.user.human?.phone) { + if (this.user?.human?.phone) { const phone = new Phone(); this.user.human.phone = phone.toObject(); this.refreshUser(); @@ -249,12 +249,12 @@ export class AuthUserDetailComponent implements OnDestroy { } public savePhone(phone: string): void { - if (this.user.human) { + if (this.user?.human) { this.userService .setMyPhone(phone) .then(() => { this.toast.showInfo('USER.TOAST.PHONESAVED', true); - if (this.user.human) { + if (this.user?.human) { const phoneToSet = new Phone(); phoneToSet.setPhone(phone); this.user.human.phone = phoneToSet.toObject(); @@ -277,7 +277,7 @@ export class AuthUserDetailComponent implements OnDestroy { labelKey: 'USER.LOGINMETHODS.PHONE.EDITVALUE', titleKey: 'USER.LOGINMETHODS.PHONE.EDITTITLE', descriptionKey: 'USER.LOGINMETHODS.PHONE.EDITDESC', - value: this.user.human?.phone?.phone, + value: this.user?.human?.phone?.phone, type: type, }, width: '400px', @@ -297,7 +297,7 @@ export class AuthUserDetailComponent implements OnDestroy { labelKey: 'ACTIONS.NEWVALUE', titleKey: 'USER.LOGINMETHODS.EMAIL.EDITTITLE', descriptionKey: 'USER.LOGINMETHODS.EMAIL.EDITDESC', - value: this.user.human?.email?.email, + value: this.user?.human?.email?.email, type: type, }, width: '400px', diff --git a/console/src/app/pages/users/user-detail/auth-user-detail/auth-user-mfa/auth-user-mfa.component.html b/console/src/app/pages/users/user-detail/auth-user-detail/auth-user-mfa/auth-user-mfa.component.html index e0a442e651..66dc8b24ab 100644 --- a/console/src/app/pages/users/user-detail/auth-user-detail/auth-user-mfa/auth-user-mfa.component.html +++ b/console/src/app/pages/users/user-detail/auth-user-detail/auth-user-mfa/auth-user-mfa.component.html @@ -1,20 +1,35 @@ - - - - - + + - + @@ -44,8 +65,13 @@ - +
{{ 'USER.MFA.TABLETYPE' | translate }} {{ 'USER.MFA.TABLETYPE' | translate }} OTP (One-Time Password) U2F (Universal 2nd Factor) @@ -22,7 +37,7 @@ - {{ 'USER.MFA.NAME' | translate }} {{ 'USER.MFA.NAME' | translate }} {{ mfa.u2f.name }} @@ -31,11 +46,17 @@ - {{ 'USER.MFA.TABLESTATE' | translate }} - {{'USER.MFA.STATE.'+ - mfa.state | translate}} + {{ 'USER.MFA.TABLESTATE' | translate }} + + {{ 'USER.MFA.STATE.' + mfa.state | translate }} - @@ -53,12 +79,12 @@
- {{'USER.MFA.EMPTY' | translate}} + {{ 'USER.MFA.EMPTY' | translate }}
@@ -66,4 +92,4 @@
- \ No newline at end of file + diff --git a/console/src/app/pages/users/user-detail/auth-user-detail/auth-user-mfa/auth-user-mfa.component.ts b/console/src/app/pages/users/user-detail/auth-user-detail/auth-user-mfa/auth-user-mfa.component.ts index 601b06451e..f4d0f79f3d 100644 --- a/console/src/app/pages/users/user-detail/auth-user-detail/auth-user-mfa/auth-user-mfa.component.ts +++ b/console/src/app/pages/users/user-detail/auth-user-detail/auth-user-mfa/auth-user-mfa.component.ts @@ -32,7 +32,7 @@ export class AuthUserMfaComponent implements OnInit, OnDestroy { @ViewChild(MatTable) public table!: MatTable; @ViewChild(MatSort) public sort!: MatSort; - public dataSource!: MatTableDataSource; + public dataSource: MatTableDataSource = new MatTableDataSource([]); public AuthFactorState: any = AuthFactorState; diff --git a/console/src/app/pages/users/user-detail/contact/contact.component.html b/console/src/app/pages/users/user-detail/contact/contact.component.html index cf787d0880..36dba42f13 100644 --- a/console/src/app/pages/users/user-detail/contact/contact.component.html +++ b/console/src/app/pages/users/user-detail/contact/contact.component.html @@ -1,79 +1,105 @@ -
-
-
- {{ 'USER.PROFILE.PASSWORD' | translate }} - ********* +
+
+
+ {{ 'USER.PROFILE.PASSWORD' | translate }} + ********* - -
- -
- - - -
+
-
-
- {{ 'USER.EMAIL' | translate }} - {{human?.email?.email}} - {{'USER.EMAILVERIFIED' | - translate}} -
- {{'USER.NOTVERIFIED' | translate}} +
+ + + +
+
- - {{'USER.LOGINMETHODS.RESENDCODE' | translate}} - -
+
+
+ {{ 'USER.EMAIL' | translate }} + {{ human.email?.email }} + {{ 'USER.EMAILVERIFIED' | translate }} +
+ {{ 'USER.NOTVERIFIED' | translate }} - -
+ + {{ 'USER.LOGINMETHODS.RESENDCODE' | translate }} + +
-
- -
+
-
-
- {{ 'USER.PHONE' | translate }} - {{human?.phone?.phone ? human.phone?.phone : ('USER.PHONEEMPTY' | translate)}} - {{'USER.PHONEVERIFIED' | - translate}} - - - -
- -
- - -
+
+
-
\ No newline at end of file +
+ +
+
+ {{ 'USER.PHONE' | translate }} + {{ human.phone?.phone ? human.phone?.phone : ('USER.PHONEEMPTY' | translate) }} + {{ 'USER.PHONEVERIFIED' | translate }} + + + +
+ +
+ + +
+
+
diff --git a/console/src/app/pages/users/user-detail/contact/contact.component.ts b/console/src/app/pages/users/user-detail/contact/contact.component.ts index 4974119e6e..68e59f5221 100644 --- a/console/src/app/pages/users/user-detail/contact/contact.component.ts +++ b/console/src/app/pages/users/user-detail/contact/contact.component.ts @@ -14,7 +14,7 @@ import { EditDialogType } from '../auth-user-detail/edit-dialog/edit-dialog.comp export class ContactComponent { @Input() disablePhoneCode: boolean = false; @Input() canWrite: boolean | null = false; - @Input() human!: Human.AsObject; + @Input() human?: Human.AsObject; @Input() state!: UserState; @Output() editType: EventEmitter = new EventEmitter(); @Output() resendEmailVerification: EventEmitter = new EventEmitter(); diff --git a/console/src/app/pages/users/user-detail/detail-form/detail-form.component.html b/console/src/app/pages/users/user-detail/detail-form/detail-form.component.html index 1dd2d1def9..7a8705c8b1 100644 --- a/console/src/app/pages/users/user-detail/detail-form/detail-form.component.html +++ b/console/src/app/pages/users/user-detail/detail-form/detail-form.component.html @@ -14,7 +14,7 @@ *ngIf="user && user.profile?.displayName && user.profile?.firstName && user.profile?.lastName" class="avatar" [name]="user.profile?.displayName ?? ''" - [avatarUrl]="user?.profile?.avatarUrl || ''" + [avatarUrl]="user.profile?.avatarUrl || ''" [forColor]="preferredLoginName" [size]="80" >