mirror of
https://github.com/zitadel/zitadel.git
synced 2025-02-28 19:57:22 +00:00
fix(console): create org without password, storage prefix for pinned projects (#543)
* fix storage prefix, org create * lint * storage fix granted project
This commit is contained in:
parent
22ba33c2ef
commit
22d4fc8872
@ -12,11 +12,11 @@
|
||||
<h1>{{'ORG.PAGES.ORGDETAIL_TITLE' | translate}}</h1>
|
||||
<form [formGroup]="orgForm" (ngSubmit)="next()">
|
||||
<div class="content">
|
||||
<mat-form-field class="formfield">
|
||||
<mat-form-field class="formfield" appearance="outline">
|
||||
<mat-label>{{ 'ORG_DETAIL.DETAIL.NAME' | translate }}</mat-label>
|
||||
<input matInput formControlName="name" />
|
||||
</mat-form-field>
|
||||
<mat-form-field class="formfield">
|
||||
<mat-form-field class="formfield" appearance="outline">
|
||||
<mat-label>{{ 'ORG_DETAIL.DETAIL.DOMAIN' | translate }}</mat-label>
|
||||
<input matInput formControlName="domain" />
|
||||
</mat-form-field>
|
||||
@ -122,7 +122,8 @@
|
||||
<ng-container *ngIf="usePassword && pwdForm">
|
||||
<p class="section">{{ 'USER.CREATE.PASSWORDSECTION' | translate }}</p>
|
||||
|
||||
<app-password-complexity-view [policy]="this.policy" [password]="password">
|
||||
<app-password-complexity-view class="complexity-view" [policy]="this.policy"
|
||||
[password]="password">
|
||||
</app-password-complexity-view>
|
||||
|
||||
<form [formGroup]="pwdForm" class="form">
|
||||
|
@ -156,3 +156,8 @@ h1 {
|
||||
flex-basis: 100%;
|
||||
margin: .5rem;
|
||||
}
|
||||
|
||||
.complexity-view {
|
||||
width: 100%;
|
||||
margin: 0 .5rem;
|
||||
}
|
||||
|
@ -89,8 +89,12 @@ export class OrgCreateComponent {
|
||||
registerUserRequest.setLastName(this.lastName?.value);
|
||||
registerUserRequest.setNickName(this.nickName?.value);
|
||||
registerUserRequest.setGender(this.gender?.value);
|
||||
registerUserRequest.setPassword(this.password?.value);
|
||||
registerUserRequest.setPreferredLanguage(this.preferredLanguage?.value);
|
||||
|
||||
if (this.usePassword && this.password) {
|
||||
registerUserRequest.setPassword(this.password?.value);
|
||||
}
|
||||
|
||||
this.adminService
|
||||
.SetUpOrg(createOrgRequest, registerUserRequest)
|
||||
.then((data: OrgSetUpResponse) => {
|
||||
|
@ -102,8 +102,6 @@ export class AppCreateComponent implements OnInit, OnDestroy {
|
||||
this.oidcApp.responseTypesList = this.formresponseTypesList?.value;
|
||||
this.oidcApp.grantTypesList = this.formgrantTypesList?.value;
|
||||
this.oidcApp.authMethodType = this.formauthMethodType?.value;
|
||||
|
||||
console.log(this.oidcApp);
|
||||
});
|
||||
|
||||
this.firstFormGroup = this.fb.group({
|
||||
@ -113,10 +111,8 @@ export class AppCreateComponent implements OnInit, OnDestroy {
|
||||
|
||||
this.firstFormGroup.valueChanges.subscribe(value => {
|
||||
if (this.firstFormGroup.valid) {
|
||||
console.log('change firstform', value);
|
||||
switch (value.applicationType) {
|
||||
case OIDCApplicationType.OIDCAPPLICATIONTYPE_NATIVE:
|
||||
console.log('NATIVE');
|
||||
this.oidcResponseTypes[0].checked = true;
|
||||
this.oidcApp.responseTypesList = [OIDCResponseType.OIDCRESPONSETYPE_CODE];
|
||||
|
||||
@ -128,8 +124,6 @@ export class AppCreateComponent implements OnInit, OnDestroy {
|
||||
this.postRedirectControl = new FormControl('', [nativeValidator as ValidatorFn]);
|
||||
break;
|
||||
case OIDCApplicationType.OIDCAPPLICATIONTYPE_WEB:
|
||||
console.log('WEB');
|
||||
|
||||
this.oidcAuthMethodType[0].disabled = false;
|
||||
this.oidcAuthMethodType[1].disabled = true; // NONE DISABLED
|
||||
this.oidcAuthMethodType[2].disabled = false; // POST POSSIBLE
|
||||
@ -147,8 +141,6 @@ export class AppCreateComponent implements OnInit, OnDestroy {
|
||||
this.postRedirectControl = new FormControl('', [webValidator as ValidatorFn]);
|
||||
break;
|
||||
case OIDCApplicationType.OIDCAPPLICATIONTYPE_USER_AGENT:
|
||||
console.log('USERAGENT');
|
||||
|
||||
this.oidcResponseTypes[0].checked = true;
|
||||
this.oidcApp.responseTypesList = [OIDCResponseType.OIDCRESPONSETYPE_CODE];
|
||||
|
||||
|
@ -2,8 +2,9 @@ import { animate, animateChild, query, stagger, style, transition, trigger } fro
|
||||
import { SelectionModel } from '@angular/cdk/collections';
|
||||
import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { Org } from 'src/app/proto/generated/auth_pb';
|
||||
import { ProjectGrantView, ProjectState, ProjectType } from 'src/app/proto/generated/management_pb';
|
||||
import { AuthService } from 'src/app/services/auth.service';
|
||||
import { StorageKey, StorageService } from 'src/app/services/storage.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-granted-project-grid',
|
||||
@ -41,7 +42,7 @@ export class GrantedProjectGridComponent implements OnChanges {
|
||||
public ProjectState: any = ProjectState;
|
||||
public ProjectType: any = ProjectType;
|
||||
|
||||
constructor(private authService: AuthService, private router: Router) {
|
||||
constructor(private storage: StorageService, private router: Router) {
|
||||
this.selection.changed.subscribe(selection => {
|
||||
this.setPrefixedItem('pinned-granted-projects', JSON.stringify(
|
||||
this.selection.selected.map(item => item.projectId),
|
||||
@ -90,13 +91,13 @@ export class GrantedProjectGridComponent implements OnChanges {
|
||||
}
|
||||
|
||||
private async getPrefixedItem(key: string): Promise<string | null> {
|
||||
const prefix = (await this.authService.GetActiveOrg()).id;
|
||||
return localStorage.getItem(`${prefix}:${key}`);
|
||||
const org = this.storage.getItem<Org.AsObject>(StorageKey.organization) as Org.AsObject;
|
||||
return localStorage.getItem(`${org.id}:${key}`);
|
||||
}
|
||||
|
||||
private async setPrefixedItem(key: string, value: any): Promise<void> {
|
||||
const prefix = (await this.authService.GetActiveOrg()).id;
|
||||
return localStorage.setItem(`${prefix}:${key}`, value);
|
||||
const org = this.storage.getItem<Org.AsObject>(StorageKey.organization) as Org.AsObject;
|
||||
return localStorage.setItem(`${org.id}:${key}`, value);
|
||||
}
|
||||
|
||||
public navigateToProject(projectId: string, id: string, event: any): void {
|
||||
|
@ -2,8 +2,10 @@ import { animate, animateChild, keyframes, query, stagger, style, transition, tr
|
||||
import { SelectionModel } from '@angular/cdk/collections';
|
||||
import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { Org } from 'src/app/proto/generated/auth_pb';
|
||||
import { ProjectState, ProjectType, ProjectView } from 'src/app/proto/generated/management_pb';
|
||||
import { AuthService } from 'src/app/services/auth.service';
|
||||
import { StorageKey, StorageService } from 'src/app/services/storage.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-owned-project-grid',
|
||||
@ -47,7 +49,7 @@ export class OwnedProjectGridComponent implements OnChanges {
|
||||
public ProjectState: any = ProjectState;
|
||||
public ProjectType: any = ProjectType;
|
||||
|
||||
constructor(private router: Router, private authService: AuthService) {
|
||||
constructor(private router: Router, private authService: AuthService, private storage: StorageService) {
|
||||
this.selection.changed.subscribe(selection => {
|
||||
this.setPrefixedItem('pinned-projects', JSON.stringify(
|
||||
this.selection.selected.map(item => item.projectId),
|
||||
@ -87,7 +89,6 @@ export class OwnedProjectGridComponent implements OnChanges {
|
||||
const array: string[] = JSON.parse(storageEntry);
|
||||
const toSelect: ProjectView.AsObject[] = this.items.filter((item, index) => {
|
||||
if (array.includes(item.projectId)) {
|
||||
// this.notPinned.splice(index, 1);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
@ -104,13 +105,13 @@ export class OwnedProjectGridComponent implements OnChanges {
|
||||
}
|
||||
|
||||
private async getPrefixedItem(key: string): Promise<string | null> {
|
||||
const prefix = (await this.authService.GetActiveOrg()).id;
|
||||
return localStorage.getItem(`${prefix}:${key}`);
|
||||
const org = this.storage.getItem<Org.AsObject>(StorageKey.organization) as Org.AsObject;
|
||||
return localStorage.getItem(`${org.id}:${key}`);
|
||||
}
|
||||
|
||||
private async setPrefixedItem(key: string, value: any): Promise<void> {
|
||||
const prefix = (await this.authService.GetActiveOrg()).id;
|
||||
return localStorage.setItem(`${prefix}:${key}`, value);
|
||||
const org = this.storage.getItem<Org.AsObject>(StorageKey.organization) as Org.AsObject;
|
||||
return localStorage.setItem(`${org.id}:${key}`, value);
|
||||
}
|
||||
|
||||
public navigateToProject(id: string, event: any): void {
|
||||
|
@ -84,7 +84,6 @@ export class ProjectRoleCreateComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
public addRole(): void {
|
||||
console.log(this.formArray.value);
|
||||
const rolesToAdd: ProjectRoleAdd[] = this.formArray.value.map((element: any) => {
|
||||
const role = new ProjectRoleAdd();
|
||||
role.setKey(element.key);
|
||||
|
@ -45,8 +45,7 @@ export class AuthService {
|
||||
),
|
||||
).pipe(
|
||||
take(1),
|
||||
mergeMap(token => {
|
||||
console.log(token);
|
||||
mergeMap(() => {
|
||||
return from(this.userService.GetMyUserProfile().then(userprofile => userprofile.toObject()));
|
||||
}),
|
||||
finalize(() => {
|
||||
@ -55,7 +54,6 @@ export class AuthService {
|
||||
);
|
||||
|
||||
this.activeOrgChanged.subscribe(() => {
|
||||
console.log('org change');
|
||||
this.loadPermissions();
|
||||
});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user