mirror of
https://github.com/zitadel/zitadel.git
synced 2025-02-28 21:37:24 +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
|
||||
mat-icon-button
|
||||
[disabled]="(canwrite$ | async) === false || domain.isVerified"
|
||||
*ngIf="canwrite$ | async"
|
||||
*ngIf="(canwrite$ | async) && verifyOrgDomains"
|
||||
(click)="verifyDomain(domain)"
|
||||
>
|
||||
<i class="las la-pen"></i>
|
||||
|
@ -19,6 +19,7 @@ export class DomainsComponent implements OnInit {
|
||||
public domains: Domain.AsObject[] = [];
|
||||
public primaryDomain: string = '';
|
||||
public InfoSectionType: any = InfoSectionType;
|
||||
public verifyOrgDomains: boolean | undefined;
|
||||
|
||||
constructor(
|
||||
private mgmtService: ManagementService,
|
||||
@ -38,6 +39,10 @@ export class DomainsComponent implements OnInit {
|
||||
}
|
||||
|
||||
public loadDomains(): void {
|
||||
this.mgmtService.getDomainPolicy().then((result) => {
|
||||
this.verifyOrgDomains = result.policy?.validateOrgDomains;
|
||||
});
|
||||
|
||||
this.mgmtService.listOrgDomains().then((result) => {
|
||||
this.domains = result.resultList;
|
||||
this.primaryDomain = this.domains.find((domain) => domain.isPrimary)?.domainName ?? '';
|
||||
@ -68,13 +73,14 @@ export class DomainsComponent implements OnInit {
|
||||
.addOrgDomain(domainName)
|
||||
.then(() => {
|
||||
this.toast.showInfo('ORG.TOAST.DOMAINADDED', true);
|
||||
this.verifyDomain({
|
||||
domainName: domainName,
|
||||
validationType: DomainValidationType.DOMAIN_VALIDATION_TYPE_UNSPECIFIED,
|
||||
});
|
||||
setTimeout(() => {
|
||||
if (this.verifyOrgDomains) {
|
||||
this.verifyDomain({
|
||||
domainName: domainName,
|
||||
validationType: DomainValidationType.DOMAIN_VALIDATION_TYPE_UNSPECIFIED,
|
||||
});
|
||||
} else {
|
||||
this.loadDomains();
|
||||
}, 1000);
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
this.toast.showError(error);
|
||||
@ -120,10 +126,8 @@ export class DomainsComponent implements OnInit {
|
||||
width: '500px',
|
||||
});
|
||||
|
||||
dialogRef.afterClosed().subscribe((reload: boolean) => {
|
||||
if (reload) {
|
||||
this.loadDomains();
|
||||
}
|
||||
dialogRef.afterClosed().subscribe(() => {
|
||||
this.loadDomains();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user