mirror of
https://github.com/zitadel/zitadel.git
synced 2025-04-23 05:11:31 +00:00
fix(console): if Validate Org domains is disabled don't show domain verification dialog (#6572)
* fix: don't show verify domain if policy disabled * fix: refactor code
This commit is contained in:
parent
12f53767d6
commit
57d8ff1ef6
@ -48,7 +48,7 @@
|
|||||||
<button
|
<button
|
||||||
mat-icon-button
|
mat-icon-button
|
||||||
[disabled]="(canwrite$ | async) === false || domain.isVerified"
|
[disabled]="(canwrite$ | async) === false || domain.isVerified"
|
||||||
*ngIf="canwrite$ | async"
|
*ngIf="(canwrite$ | async) && verifyOrgDomains"
|
||||||
(click)="verifyDomain(domain)"
|
(click)="verifyDomain(domain)"
|
||||||
>
|
>
|
||||||
<i class="las la-pen"></i>
|
<i class="las la-pen"></i>
|
||||||
|
@ -19,6 +19,7 @@ export class DomainsComponent implements OnInit {
|
|||||||
public domains: Domain.AsObject[] = [];
|
public domains: Domain.AsObject[] = [];
|
||||||
public primaryDomain: string = '';
|
public primaryDomain: string = '';
|
||||||
public InfoSectionType: any = InfoSectionType;
|
public InfoSectionType: any = InfoSectionType;
|
||||||
|
public verifyOrgDomains: boolean | undefined;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private mgmtService: ManagementService,
|
private mgmtService: ManagementService,
|
||||||
@ -38,6 +39,10 @@ export class DomainsComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public loadDomains(): void {
|
public loadDomains(): void {
|
||||||
|
this.mgmtService.getDomainPolicy().then((result) => {
|
||||||
|
this.verifyOrgDomains = result.policy?.validateOrgDomains;
|
||||||
|
});
|
||||||
|
|
||||||
this.mgmtService.listOrgDomains().then((result) => {
|
this.mgmtService.listOrgDomains().then((result) => {
|
||||||
this.domains = result.resultList;
|
this.domains = result.resultList;
|
||||||
this.primaryDomain = this.domains.find((domain) => domain.isPrimary)?.domainName ?? '';
|
this.primaryDomain = this.domains.find((domain) => domain.isPrimary)?.domainName ?? '';
|
||||||
@ -68,13 +73,14 @@ export class DomainsComponent implements OnInit {
|
|||||||
.addOrgDomain(domainName)
|
.addOrgDomain(domainName)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.toast.showInfo('ORG.TOAST.DOMAINADDED', true);
|
this.toast.showInfo('ORG.TOAST.DOMAINADDED', true);
|
||||||
this.verifyDomain({
|
if (this.verifyOrgDomains) {
|
||||||
domainName: domainName,
|
this.verifyDomain({
|
||||||
validationType: DomainValidationType.DOMAIN_VALIDATION_TYPE_UNSPECIFIED,
|
domainName: domainName,
|
||||||
});
|
validationType: DomainValidationType.DOMAIN_VALIDATION_TYPE_UNSPECIFIED,
|
||||||
setTimeout(() => {
|
});
|
||||||
|
} else {
|
||||||
this.loadDomains();
|
this.loadDomains();
|
||||||
}, 1000);
|
}
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
this.toast.showError(error);
|
this.toast.showError(error);
|
||||||
@ -120,10 +126,8 @@ export class DomainsComponent implements OnInit {
|
|||||||
width: '500px',
|
width: '500px',
|
||||||
});
|
});
|
||||||
|
|
||||||
dialogRef.afterClosed().subscribe((reload: boolean) => {
|
dialogRef.afterClosed().subscribe(() => {
|
||||||
if (reload) {
|
this.loadDomains();
|
||||||
this.loadDomains();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user