mirror of
https://github.com/andwati/zitadel.git
synced 2026-10-31 03:22:15 +00:00
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:
co-authored by
Livio Spring
parent
0316c2c187
commit
650122070d
@@ -33,8 +33,8 @@
|
||||
</div>
|
||||
|
||||
<div class="info-wrapper width">
|
||||
<p class="info-row-title">{{ 'USER.PAGES.LOGINNAMES' | translate }}</p>
|
||||
<div class="copy-row" *ngFor="let login of user?.loginNamesList">
|
||||
<p class="info-row-title">{{ 'USER.PAGES.LOGINMETHODS' | translate }}</p>
|
||||
<div class="copy-row" *ngFor="let login of loginMethods">
|
||||
<button
|
||||
[disabled]="copied === login"
|
||||
[matTooltip]="(copied !== login ? 'ACTIONS.COPY' : 'ACTIONS.COPIED') | translate"
|
||||
|
||||
@@ -3,6 +3,7 @@ import { App, AppState } from 'src/app/proto/generated/zitadel/app_pb';
|
||||
import { IDP, IDPState } from 'src/app/proto/generated/zitadel/idp_pb';
|
||||
import { InstanceDetail, State } from 'src/app/proto/generated/zitadel/instance_pb';
|
||||
import { Org, OrgState } from 'src/app/proto/generated/zitadel/org_pb';
|
||||
import { LoginPolicy } from 'src/app/proto/generated/zitadel/policy_pb';
|
||||
import { GrantedProject, Project, ProjectGrantState, ProjectState } from 'src/app/proto/generated/zitadel/project_pb';
|
||||
import { User, UserState } from 'src/app/proto/generated/zitadel/user_pb';
|
||||
|
||||
@@ -19,6 +20,7 @@ export class InfoRowComponent {
|
||||
@Input() public idp!: IDP.AsObject;
|
||||
@Input() public project!: Project.AsObject;
|
||||
@Input() public grantedProject!: GrantedProject.AsObject;
|
||||
@Input() public loginPolicy?: LoginPolicy.AsObject;
|
||||
|
||||
public UserState: any = UserState;
|
||||
public State: any = State;
|
||||
@@ -31,4 +33,19 @@ export class InfoRowComponent {
|
||||
public copied: string = '';
|
||||
|
||||
constructor() {}
|
||||
|
||||
public get loginMethods(): Set<string> {
|
||||
const methods = this.user?.loginNamesList;
|
||||
let email: string = '';
|
||||
let phone: string = '';
|
||||
if (this.loginPolicy) {
|
||||
if (!this.loginPolicy?.disableLoginWithEmail && this.user.human?.email?.email) {
|
||||
email = this.user.human?.email?.email;
|
||||
}
|
||||
if (!this.loginPolicy?.disableLoginWithPhone && this.user.human?.phone?.phone) {
|
||||
phone = this.user.human?.phone?.phone;
|
||||
}
|
||||
}
|
||||
return new Set([email, phone, ...methods].filter((method) => !!method));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user