From e7913bde590cf20f729e0a0bd22361d6d8b9f2ea Mon Sep 17 00:00:00 2001 From: Max Peintner Date: Thu, 8 Apr 2021 13:11:12 +0200 Subject: [PATCH] fix(console): bugs and some imperfections (#1557) * org refresh, mfa name attribute * fix org change --- console/src/app/app.module.ts | 2 ++ console/src/app/guards/auth.guard.ts | 1 - console/src/app/guards/role.guard.ts | 3 +-- .../modules/policy-grid/policy-grid.component.scss | 1 + console/src/app/pages/iam/iam.component.scss | 7 +++++++ .../pages/orgs/org-detail/org-detail.component.html | 2 ++ .../pages/orgs/org-detail/org-detail.component.scss | 1 + .../pages/orgs/org-detail/org-detail.component.ts | 12 +++++++----- .../user-grant-create/user-grant-create.component.ts | 9 ++++++--- .../auth-user-mfa/auth-user-mfa.component.html | 9 +++++---- .../auth-user-mfa/auth-user-mfa.component.ts | 2 +- .../user-detail/user-mfa/user-mfa.component.html | 9 +++++---- .../user-detail/user-mfa/user-mfa.component.ts | 2 +- console/src/assets/i18n/de.json | 2 +- console/src/assets/i18n/en.json | 2 +- 15 files changed, 41 insertions(+), 23 deletions(-) diff --git a/console/src/app/app.module.ts b/console/src/app/app.module.ts index 2c5d54f60d..e7649fd1e0 100644 --- a/console/src/app/app.module.ts +++ b/console/src/app/app.module.ts @@ -38,6 +38,7 @@ import { WarnDialogModule } from './modules/warn-dialog/warn-dialog.module'; import { SignedoutComponent } from './pages/signedout/signedout.component'; import { HasFeaturePipeModule } from './pipes/has-feature-pipe/has-feature-pipe.module'; import { HasRolePipeModule } from './pipes/has-role-pipe/has-role-pipe.module'; +import { AuthenticationService } from './services/authentication.service'; import { GrpcAuthService } from './services/grpc-auth.service'; import { GrpcService } from './services/grpc.service'; import { AuthInterceptor } from './services/interceptors/auth.interceptor'; @@ -175,6 +176,7 @@ const authConfig: AuthConfig = { SeoService, RefreshService, GrpcService, + AuthenticationService, GrpcAuthService, { provide: 'windowObject', useValue: window }, ], diff --git a/console/src/app/guards/auth.guard.ts b/console/src/app/guards/auth.guard.ts index 02d02ddf18..ed852307c6 100644 --- a/console/src/app/guards/auth.guard.ts +++ b/console/src/app/guards/auth.guard.ts @@ -21,5 +21,4 @@ export class AuthGuard implements CanActivate { } return this.auth.authenticated; } - } diff --git a/console/src/app/guards/role.guard.ts b/console/src/app/guards/role.guard.ts index bd2fdbe2ea..5b4bbc84e7 100644 --- a/console/src/app/guards/role.guard.ts +++ b/console/src/app/guards/role.guard.ts @@ -1,7 +1,7 @@ import { Injectable } from '@angular/core'; import { ActivatedRouteSnapshot, CanActivate, RouterStateSnapshot } from '@angular/router'; import { Observable } from 'rxjs'; -import { filter, first, switchMap } from 'rxjs/operators'; +import { filter, switchMap } from 'rxjs/operators'; import { GrpcAuthService } from '../services/grpc-auth.service'; @@ -18,7 +18,6 @@ export class RoleGuard implements CanActivate { ): Observable { return this.authService.fetchedZitadelPermissions.pipe( filter((permissionsFetched) => !!permissionsFetched), - first(), ).pipe( switchMap(_ => this.authService.isAllowed(route.data['roles'])), ); diff --git a/console/src/app/modules/policy-grid/policy-grid.component.scss b/console/src/app/modules/policy-grid/policy-grid.component.scss index 8f2383b0a6..028301e015 100644 --- a/console/src/app/modules/policy-grid/policy-grid.component.scss +++ b/console/src/app/modules/policy-grid/policy-grid.component.scss @@ -2,6 +2,7 @@ h2 { font-size: 1.2rem; letter-spacing: .05em; text-transform: uppercase; + margin-top: 2rem; } .top-desc { diff --git a/console/src/app/pages/iam/iam.component.scss b/console/src/app/pages/iam/iam.component.scss index 043cb9349b..db4e2934e1 100644 --- a/console/src/app/pages/iam/iam.component.scss +++ b/console/src/app/pages/iam/iam.component.scss @@ -11,6 +11,13 @@ color: var(--grey); font-size: 14px; } + +h2 { + font-size: 1.2rem; + letter-spacing: .05em; + text-transform: uppercase; + margin-top: 2rem; +} .tier { display: flex; diff --git a/console/src/app/pages/orgs/org-detail/org-detail.component.html b/console/src/app/pages/orgs/org-detail/org-detail.component.html index c394fb999f..a24f1b1768 100644 --- a/console/src/app/pages/orgs/org-detail/org-detail.component.html +++ b/console/src/app/pages/orgs/org-detail/org-detail.component.html @@ -6,6 +6,8 @@ + +
{{domain.domainName}} diff --git a/console/src/app/pages/orgs/org-detail/org-detail.component.scss b/console/src/app/pages/orgs/org-detail/org-detail.component.scss index cccb7800dd..41cc37da4c 100644 --- a/console/src/app/pages/orgs/org-detail/org-detail.component.scss +++ b/console/src/app/pages/orgs/org-detail/org-detail.component.scss @@ -6,6 +6,7 @@ h2 { font-size: 1.2rem; letter-spacing: .05em; text-transform: uppercase; + margin-top: 2rem; } .top-desc { 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 79fbf067bd..7e607a582f 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 @@ -113,12 +113,14 @@ export class OrgDetailComponent implements OnInit { dialogRef.afterClosed().subscribe(resp => { if (resp) { - this.mgmtService.addOrgDomain(resp).then(resp => { - const newDomain = resp; - - // TODO send domainname only - // this.verifyDomain(newDomainView.toObject()); + this.mgmtService.addOrgDomain(resp).then(() => { this.toast.showInfo('ORG.TOAST.DOMAINADDED', true); + + setTimeout(() => { + this.loadDomains(); + }, 1000); + }).catch(error => { + this.toast.showError(error); }); } }); 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 c90dde5b22..ee95bbb3cc 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 @@ -9,6 +9,7 @@ import { GrantedProject, Project, Role } from 'src/app/proto/generated/zitadel/p import { User } from 'src/app/proto/generated/zitadel/user_pb'; import { GrpcAuthService } from 'src/app/services/grpc-auth.service'; import { ManagementService } from 'src/app/services/mgmt.service'; +import { StorageKey, StorageService } from 'src/app/services/storage.service'; import { ToastService } from 'src/app/services/toast.service'; @Component({ @@ -51,6 +52,7 @@ export class UserGrantCreateComponent implements OnDestroy { private route: ActivatedRoute, private authService: GrpcAuthService, private mgmtService: ManagementService, + private storage: StorageService, ) { this.subscription = this.route.params.subscribe((params: Params) => { const { projectid, grantid, userid } = params; @@ -83,9 +85,10 @@ export class UserGrantCreateComponent implements OnDestroy { } }); - this.authService.getActiveOrg().then(org => { - this.org = org; - }); + const temporg = this.storage.getItem(StorageKey.organization); + if (temporg) { + this.org = temporg; + } } public close(): void { 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 a294163af7..6364168e4d 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 @@ -9,10 +9,11 @@ - - {{ 'USER.MFA.ATTRIBUTE' | translate }} - - {{ mfa?.attribute }} + + {{ 'USER.MFA.NAME' | translate }} + + + {{ mfa.u2f.name }} 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 55edf45904..e1be214254 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 @@ -26,7 +26,7 @@ export interface WebAuthNOptions { styleUrls: ['./auth-user-mfa.component.scss'], }) export class AuthUserMfaComponent implements OnInit, OnDestroy { - public displayedColumns: string[] = ['type', 'attr', 'state', 'actions']; + public displayedColumns: string[] = ['type', 'name', 'state', 'actions']; private loadingSubject: BehaviorSubject = new BehaviorSubject(false); public loading$: Observable = this.loadingSubject.asObservable(); diff --git a/console/src/app/pages/users/user-detail/user-detail/user-mfa/user-mfa.component.html b/console/src/app/pages/users/user-detail/user-detail/user-mfa/user-mfa.component.html index 262b2e8a06..c06b9553b9 100644 --- a/console/src/app/pages/users/user-detail/user-detail/user-mfa/user-mfa.component.html +++ b/console/src/app/pages/users/user-detail/user-detail/user-mfa/user-mfa.component.html @@ -9,10 +9,11 @@ - - {{ 'USER.MFA.ATTRIBUTE' | translate }} - - {{ mfa.attribute }} + + {{ 'USER.MFA.NAME' | translate }} + + + {{ mfa.u2f.name }} diff --git a/console/src/app/pages/users/user-detail/user-detail/user-mfa/user-mfa.component.ts b/console/src/app/pages/users/user-detail/user-detail/user-mfa/user-mfa.component.ts index 0d03bca91a..a168e03c55 100644 --- a/console/src/app/pages/users/user-detail/user-detail/user-mfa/user-mfa.component.ts +++ b/console/src/app/pages/users/user-detail/user-detail/user-mfa/user-mfa.component.ts @@ -20,7 +20,7 @@ export interface MFAItem { styleUrls: ['./user-mfa.component.scss'], }) export class UserMfaComponent implements OnInit, OnDestroy { - public displayedColumns: string[] = ['type', 'attr', 'state', 'actions']; + public displayedColumns: string[] = ['type', 'name', 'state', 'actions']; @Input() private user!: User.AsObject; public mfaSubject: BehaviorSubject = new BehaviorSubject([]); private loadingSubject: BehaviorSubject = new BehaviorSubject(false); diff --git a/console/src/assets/i18n/de.json b/console/src/assets/i18n/de.json index 6ae356a4b8..ce41daf32b 100644 --- a/console/src/assets/i18n/de.json +++ b/console/src/assets/i18n/de.json @@ -218,7 +218,7 @@ "MFA": { "TABLETYPE":"Typ", "TABLESTATE":"Status", - "ATTRIBUTE":"Attribut", + "NAME":"Name", "TABLEACTIONS":"Aktionen", "TITLE": "Multifaktor-Authentisierung", "DESCRIPTION": "Füge einen zusätzlichen Faktor hinzu, um Dein Konto optimal zu schützen.", diff --git a/console/src/assets/i18n/en.json b/console/src/assets/i18n/en.json index f94af4a17f..1a39ae9bdc 100644 --- a/console/src/assets/i18n/en.json +++ b/console/src/assets/i18n/en.json @@ -218,7 +218,7 @@ "MFA": { "TABLETYPE":"Type", "TABLESTATE":"Status", - "ATTRIBUTE":"Attribut", + "NAME":"Name", "TABLEACTIONS":"Actions", "TITLE": "Multifactor Authentication", "DESCRIPTION": "Add a second factor to ensure optimal security for your account.",