feat(console): show available login methods on user pages (#5055)

Shows all possible login methods on the user detail pages

Co-authored-by: Livio Spring <[email protected]>
This commit is contained in:
Max Peintner
2023-01-17 16:02:22 +00:00
committed by GitHub
co-authored by Livio Spring
parent 0316c2c187
commit 650122070d
12 changed files with 49 additions and 4 deletions
@@ -8,7 +8,7 @@
(backRouterLink)="(['/'])"
>
<span *ngIf="!loading && !user">{{ 'USER.PAGES.NOUSER' | translate }}</span>
<cnsl-info-row topContent *ngIf="user" [user]="user"></cnsl-info-row>
<cnsl-info-row topContent *ngIf="user" [user]="user" [loginPolicy]="loginPolicy"></cnsl-info-row>
</cnsl-top-view>
<div *ngIf="loading" class="max-width-container">
@@ -20,6 +20,7 @@ import { ToastService } from 'src/app/services/toast.service';
import { Buffer } from 'buffer';
import { EditDialogComponent, EditDialogType } from './edit-dialog/edit-dialog.component';
import { PolicyComponentServiceType } from 'src/app/modules/policies/policy-component-types.enum';
import { LoginPolicy } from 'src/app/proto/generated/zitadel/policy_pb';
@Component({
selector: 'cnsl-auth-user-detail',
@@ -58,6 +59,7 @@ export class AuthUserDetailComponent implements OnDestroy {
},
];
public currentSetting: string | undefined = this.settingsList[0].id;
public loginPolicy?: LoginPolicy.AsObject;
constructor(
public translate: TranslateService,
@@ -93,6 +95,12 @@ export class AuthUserDetailComponent implements OnDestroy {
this.userService.getSupportedLanguages().then((lang) => {
this.languages = lang.languagesList;
});
this.userService.getMyLoginPolicy().then((policy) => {
if (policy.policy) {
this.loginPolicy = policy.policy;
}
});
}
private changeSelection(small: boolean): void {
@@ -33,7 +33,7 @@
</button>
</ng-template>
</ng-template>
<cnsl-info-row topContent *ngIf="user" [user]="user"></cnsl-info-row>
<cnsl-info-row topContent *ngIf="user" [user]="user" [loginPolicy]="loginPolicy"></cnsl-info-row>
</cnsl-top-view>
<div *ngIf="loading" class="max-width-container">
@@ -20,6 +20,7 @@ import { ToastService } from 'src/app/services/toast.service';
import { Buffer } from 'buffer';
import { EditDialogComponent, EditDialogType } from '../auth-user-detail/edit-dialog/edit-dialog.component';
import { ResendEmailDialogComponent } from '../auth-user-detail/resend-email-dialog/resend-email-dialog.component';
import { LoginPolicy } from 'src/app/proto/generated/zitadel/policy_pb';
const GENERAL: SidenavSetting = { id: 'general', i18nKey: 'USER.SETTINGS.GENERAL' };
const GRANTS: SidenavSetting = { id: 'grants', i18nKey: 'USER.SETTINGS.USERGRANTS' };
@@ -58,6 +59,7 @@ export class UserDetailComponent implements OnInit {
public settingsList: SidenavSetting[] = [GENERAL, GRANTS, MEMBERSHIPS, METADATA];
public currentSetting: string | undefined = 'general';
public loginPolicy?: LoginPolicy.AsObject;
constructor(
public translate: TranslateService,
@@ -137,6 +139,12 @@ export class UserDetailComponent implements OnInit {
public ngOnInit(): void {
this.refreshUser();
this.mgmtUserService.getLoginPolicy().then((policy) => {
if (policy.policy) {
this.loginPolicy = policy.policy;
}
});
}
public changeUsername(): void {