mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-21 12:28:46 +00:00
fix(console): cleanup structure, role guard, paginated requests, cleanup policies, toast i18n, view timestamp, preloading strategy, maennchenfindings, fix passwordchange (#483)
* routes, move grid to list comopnent * rename app list component, move to project sub * add owned-project-detail child module * seperate pipes * set password validators only if needed * create org initialize without pwd * no caps * self xss message * fix user table * fix project member paginator * fix project members pagination, user grant pag * move project grants, fix imports * fix owned project detail imports * use pipe and directives * ng content bindings, rem custom schemas * i18n, fix error toast parameter * toast i18n * side background * fix: sequence, add timestamp * audit * fix metanav background * org domain label * cleanup policy component * shorten user grant roles, mk cols visible as bind * move user components, show otp only if available * preload modules * fix password change * fix org create buttons * class css
This commit is contained in:
@@ -75,7 +75,7 @@ export class OrgContributorsComponent implements OnInit {
|
||||
Promise.all(users.map(user => {
|
||||
return this.orgService.AddMyOrgMember(user.id, roles);
|
||||
})).then(() => {
|
||||
this.toast.showError('members added');
|
||||
this.toast.showInfo('ORG.TOAST.MEMBERADDED', true);
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
|
||||
@@ -22,10 +22,13 @@
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
<button [disabled]="orgForm.invalid" color="primary" mat-raised-button class="continue-button"
|
||||
cdkFocusInitial type="submit">
|
||||
{{'CONTINUE' | translate}}
|
||||
</button>
|
||||
<div class="btn-container">
|
||||
<span class="fill-space"></span>
|
||||
<button [disabled]="orgForm.invalid" color="primary" mat-raised-button class="big-button"
|
||||
cdkFocusInitial type="submit">
|
||||
{{'CONTINUE' | translate}}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<!-- <div *ngIf="name?.touched" @openClose>
|
||||
@@ -174,7 +177,10 @@
|
||||
</ng-container>
|
||||
</div>
|
||||
<div class="btn-container">
|
||||
<button color="primary" class="continue-button" [disabled]="orgForm.invalid || userForm.invalid"
|
||||
<button color="primary" class="small-button" type="button" (click)="previous()"
|
||||
mat-stroked-button>{{ 'ACTIONS.BACK' | translate }}</button>
|
||||
<span class="fill-space"></span>
|
||||
<button color="primary" class="big-button" [disabled]="orgForm.invalid || userForm.invalid"
|
||||
type="submit" mat-raised-button>{{ 'ACTIONS.FINISH' | translate }}</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -74,7 +74,7 @@ h1 {
|
||||
.btn-container {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
button {
|
||||
.continue-button {
|
||||
margin-top: 3rem;
|
||||
display: block;
|
||||
padding: 0.5rem 4rem;
|
||||
@@ -125,19 +125,23 @@ h1 {
|
||||
|
||||
.btn-container {
|
||||
display: flex;
|
||||
margin: 0 -.5rem;
|
||||
|
||||
button {
|
||||
border-radius: .5rem;
|
||||
margin: 0 .5rem;
|
||||
}
|
||||
}
|
||||
|
||||
.continue-button {
|
||||
align-items: center;
|
||||
margin-top: 3rem;
|
||||
display: block;
|
||||
padding: 0.5rem 4rem;
|
||||
border-radius: 0.5rem;
|
||||
|
||||
.small-button {
|
||||
display: block;
|
||||
border-radius: 0.5rem;
|
||||
}
|
||||
|
||||
.fill-space {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.big-button {
|
||||
display: block;
|
||||
padding: 0.5rem 4rem;
|
||||
border-radius: 0.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
mat-checkbox {
|
||||
|
||||
@@ -96,8 +96,8 @@ export class OrgCreateComponent {
|
||||
.then((data: OrgSetUpResponse) => {
|
||||
this.router.navigate(['orgs', data.toObject().org?.id]);
|
||||
})
|
||||
.catch(data => {
|
||||
this.toast.showError(data.message);
|
||||
.catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
import { MatSelectModule } from '@angular/material/select';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { PipesModule } from 'src/app/pipes/pipes.module';
|
||||
import { HasRolePipeModule } from 'src/app/pipes/has-role-pipe.module';
|
||||
|
||||
import { OrgCreateRoutingModule } from './org-create-routing.module';
|
||||
import { OrgCreateComponent } from './org-create.component';
|
||||
@@ -25,7 +25,7 @@ import { OrgCreateComponent } from './org-create.component';
|
||||
MatButtonModule,
|
||||
MatIconModule,
|
||||
MatSelectModule,
|
||||
PipesModule,
|
||||
HasRolePipeModule,
|
||||
TranslateModule,
|
||||
MatCheckboxModule,
|
||||
],
|
||||
|
||||
+2
-2
@@ -2,8 +2,8 @@
|
||||
<div mat-dialog-content>
|
||||
<p class="desc"> {{'ORG.DOMAINS.ADD.DESCRIPTION' | translate}}</p>
|
||||
|
||||
<mat-form-field label="Access Code" required="true">
|
||||
<mat-label>Code</mat-label>
|
||||
<mat-form-field label="Domain" required="true">
|
||||
<mat-label>Domain</mat-label>
|
||||
<input matInput [(ngModel)]="newdomain" />
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
</ng-template>
|
||||
</div>
|
||||
|
||||
<metainfo class="side">
|
||||
<div class="side" metainfo>
|
||||
<div class="details">
|
||||
<div class="row">
|
||||
<span class="first">{{'ORG.PAGES.PRIMARYDOMAIN' | translate}}</span>
|
||||
@@ -46,5 +46,5 @@
|
||||
<app-changes *ngIf="org" [changeType]="ChangeType.ORG" [id]="org.id"></app-changes>
|
||||
</mat-tab>
|
||||
</mat-tab-group>
|
||||
</metainfo>
|
||||
</div>
|
||||
</app-meta-layout>
|
||||
@@ -91,13 +91,11 @@ export class OrgGridComponent {
|
||||
private getData(limit: number, offset: number): void {
|
||||
this.userService.SearchMyProjectOrgs(limit, offset).then(res => {
|
||||
this.orgList = res.toObject().resultList;
|
||||
console.log(this.orgList);
|
||||
|
||||
this.notPinned = Object.assign([], this.orgList);
|
||||
this.reorganizeItems();
|
||||
this.loading = false;
|
||||
}).catch(error => {
|
||||
console.error(error);
|
||||
this.toast.showError(error);
|
||||
this.loading = false;
|
||||
});
|
||||
|
||||
@@ -57,7 +57,7 @@ export class OrgMembersComponent implements AfterViewInit {
|
||||
public removeProjectMemberSelection(): void {
|
||||
Promise.all(this.selection.selected.map(member => {
|
||||
return this.orgService.RemoveMyOrgMember(member.userId).then(() => {
|
||||
this.toast.showInfo('Removed successfully');
|
||||
this.toast.showInfo('ORG.TOAST.MEMBERREMOVED', true);
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
@@ -66,7 +66,7 @@ export class OrgMembersComponent implements AfterViewInit {
|
||||
|
||||
public removeMember(member: ProjectMember.AsObject): void {
|
||||
this.orgService.RemoveMyOrgMember(member.userId).then(() => {
|
||||
this.toast.showInfo('Member removed successfully');
|
||||
this.toast.showInfo('ORG.TOAST.MEMBERREMOVED', true);
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
@@ -101,7 +101,7 @@ export class OrgMembersComponent implements AfterViewInit {
|
||||
Promise.all(users.map(user => {
|
||||
return this.orgService.AddMyOrgMember(user.id, roles);
|
||||
})).then(() => {
|
||||
this.toast.showError('members added');
|
||||
this.toast.showInfo('ORG.TOAST.MEMBERADDED', true);
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatButtonToggleModule } from '@angular/material/button-toggle';
|
||||
@@ -14,6 +14,7 @@ import { TranslateModule } from '@ngx-translate/core';
|
||||
import { HasRoleModule } from 'src/app/directives/has-role/has-role.module';
|
||||
import { CardModule } from 'src/app/modules/card/card.module';
|
||||
import { MetaLayoutModule } from 'src/app/modules/meta-layout/meta-layout.module';
|
||||
import { SharedModule } from 'src/app/modules/shared/shared.module';
|
||||
import { WarnDialogModule } from 'src/app/modules/warn-dialog/warn-dialog.module';
|
||||
|
||||
import { ChangesModule } from '../../modules/changes/changes.module';
|
||||
@@ -49,8 +50,7 @@ import { PolicyGridComponent } from './policy-grid/policy-grid.component';
|
||||
ChangesModule,
|
||||
AddDomainDialogModule,
|
||||
TranslateModule,
|
||||
SharedModule,
|
||||
],
|
||||
exports: [],
|
||||
schemas: [NO_ERRORS_SCHEMA],
|
||||
})
|
||||
export class OrgsModule { }
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div class="content" *ngIf="policyType === PolicyComponentType?.LOCKOUT">
|
||||
<div class="content" *ngIf="policyType === PolicyComponentType?.LOCKOUT && lockoutData">
|
||||
<mat-form-field class="description-formfield" appearance="outline">
|
||||
<mat-label>{{ 'ORG.POLICY.DATA.DESCRIPTION' | translate }}</mat-label>
|
||||
<input matInput name="description" ngDefaultControl [(ngModel)]="lockoutData.description"
|
||||
@@ -44,12 +44,12 @@
|
||||
<span class="left-desc">{{'ORG.POLICY.DATA.SHOWLOCKOUTFAILURES' | translate}}</span>
|
||||
<span class="fill-space"></span>
|
||||
<mat-slide-toggle color="primary" name="showLockOutFailures" ngDefaultControl
|
||||
[(ngModel)]="complexityData.showLockOutFailures">
|
||||
[(ngModel)]="lockoutData.showLockOutFailures">
|
||||
</mat-slide-toggle>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div *ngIf="policyType === PolicyComponentType?.COMPLEXITY" class="content">
|
||||
<div *ngIf="policyType === PolicyComponentType?.COMPLEXITY && complexityData" class="content">
|
||||
<mat-form-field class="description-formfield" appearance="outline">
|
||||
<mat-label>{{ 'ORG.POLICY.DATA.DESCRIPTION' | translate }}</mat-label>
|
||||
<input matInput name="description" ngDefaultControl [(ngModel)]="complexityData.description"
|
||||
@@ -98,7 +98,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="content" *ngIf="policyType === PolicyComponentType?.AGE">
|
||||
<div class="content" *ngIf="policyType === PolicyComponentType?.AGE && ageData">
|
||||
<mat-form-field class="description-formfield" appearance="outline">
|
||||
<mat-label>{{ 'ORG.POLICY.DATA.DESCRIPTION' | translate }}</mat-label>
|
||||
<input matInput name="description" ngDefaultControl [(ngModel)]="ageData.description"
|
||||
@@ -133,7 +133,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="content" *ngIf="policyType === PolicyComponentType?.IAM_POLICY">
|
||||
<div class="content" *ngIf="policyType === PolicyComponentType?.IAM_POLICY && iamData">
|
||||
<mat-form-field class="description-formfield" appearance="outline">
|
||||
<mat-label>{{ 'ORG.POLICY.DATA.DESCRIPTION' | translate }}</mat-label>
|
||||
<input matInput name="description" ngDefaultControl [(ngModel)]="iamData.description"
|
||||
|
||||
@@ -3,6 +3,12 @@ import { FormGroup } from '@angular/forms';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { BehaviorSubject, Subscription } from 'rxjs';
|
||||
import { switchMap } from 'rxjs/operators';
|
||||
import {
|
||||
OrgIamPolicy,
|
||||
PasswordAgePolicy,
|
||||
PasswordComplexityPolicy,
|
||||
PasswordLockoutPolicy,
|
||||
} from 'src/app/proto/generated/management_pb';
|
||||
import { AdminService } from 'src/app/services/admin.service';
|
||||
import { OrgService } from 'src/app/services/org.service';
|
||||
import { StorageService } from 'src/app/services/storage.service';
|
||||
@@ -39,31 +45,10 @@ export class PasswordPolicyComponent implements OnInit, OnDestroy {
|
||||
public lockoutForm!: FormGroup;
|
||||
public ageForm!: FormGroup;
|
||||
|
||||
public complexityData: any = {
|
||||
minLength: 8,
|
||||
description: '',
|
||||
hasNumber: true,
|
||||
hasSymbol: true,
|
||||
hasLowercase: true,
|
||||
hasUppercase: true,
|
||||
};
|
||||
|
||||
public lockoutData: any = {
|
||||
description: '',
|
||||
maxAttempts: 5,
|
||||
showLockOutFailures: true,
|
||||
};
|
||||
|
||||
public ageData: any = {
|
||||
description: '',
|
||||
expireWarnDays: 80,
|
||||
maxAgeDays: 90,
|
||||
};
|
||||
|
||||
public iamData: any = {
|
||||
description: '',
|
||||
userLoginMustBeDomain: false,
|
||||
};
|
||||
public complexityData!: PasswordComplexityPolicy.AsObject;
|
||||
public lockoutData!: PasswordLockoutPolicy.AsObject;
|
||||
public ageData!: PasswordAgePolicy.AsObject;
|
||||
public iamData!: OrgIamPolicy.AsObject;
|
||||
|
||||
private sub: Subscription = new Subscription();
|
||||
|
||||
@@ -102,19 +87,21 @@ export class PasswordPolicyComponent implements OnInit, OnDestroy {
|
||||
|
||||
if (this.componentAction === PolicyComponentAction.MODIFY) {
|
||||
this.getData(params).then(data => {
|
||||
switch (this.policyType) {
|
||||
case PolicyComponentType.LOCKOUT:
|
||||
this.lockoutData = data.toObject();
|
||||
break;
|
||||
case PolicyComponentType.AGE:
|
||||
this.ageData = data.toObject();
|
||||
break;
|
||||
case PolicyComponentType.COMPLEXITY:
|
||||
this.complexityData = data.toObject();
|
||||
break;
|
||||
case PolicyComponentType.IAM_POLICY:
|
||||
this.iamData = data.toObject();
|
||||
break;
|
||||
if (data) {
|
||||
switch (this.policyType) {
|
||||
case PolicyComponentType.LOCKOUT:
|
||||
this.lockoutData = data.toObject() as PasswordLockoutPolicy.AsObject;
|
||||
break;
|
||||
case PolicyComponentType.AGE:
|
||||
this.ageData = data.toObject() as PasswordAgePolicy.AsObject;
|
||||
break;
|
||||
case PolicyComponentType.COMPLEXITY:
|
||||
this.complexityData = data.toObject() as PasswordComplexityPolicy.AsObject;
|
||||
break;
|
||||
case PolicyComponentType.IAM_POLICY:
|
||||
this.iamData = data.toObject() as OrgIamPolicy.AsObject;
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -128,7 +115,8 @@ export class PasswordPolicyComponent implements OnInit, OnDestroy {
|
||||
this.sub.unsubscribe();
|
||||
}
|
||||
|
||||
private async getData(params: any): Promise<any> {
|
||||
private async getData(params: any):
|
||||
Promise<PasswordLockoutPolicy | PasswordAgePolicy | PasswordComplexityPolicy | OrgIamPolicy | undefined> {
|
||||
switch (params.policytype) {
|
||||
case PolicyComponentType.LOCKOUT:
|
||||
this.titleSub.next('ORG.POLICY.PWD_LOCKOUT.TITLE');
|
||||
@@ -270,8 +258,8 @@ export class PasswordPolicyComponent implements OnInit, OnDestroy {
|
||||
if (orgId) {
|
||||
this.adminService.CreateOrgIamPolicy(
|
||||
orgId,
|
||||
this.complexityData.description,
|
||||
this.complexityData.userLoginMustBeDomain,
|
||||
this.iamData.description,
|
||||
this.iamData.userLoginMustBeDomain,
|
||||
).then(() => {
|
||||
this.router.navigate(['org']);
|
||||
}).catch(error => {
|
||||
@@ -326,8 +314,8 @@ export class PasswordPolicyComponent implements OnInit, OnDestroy {
|
||||
if (orgId) {
|
||||
this.adminService.UpdateOrgIamPolicy(
|
||||
orgId,
|
||||
this.complexityData.description,
|
||||
this.complexityData.userLoginMustBeDomain,
|
||||
this.iamData.description,
|
||||
this.iamData.userLoginMustBeDomain,
|
||||
).then(() => {
|
||||
this.router.navigate(['org']);
|
||||
}).catch(error => {
|
||||
|
||||
Reference in New Issue
Block a user