mirror of
https://github.com/zitadel/zitadel.git
synced 2025-03-01 01:57:23 +00:00
fix(console): set user language (#4028)
fix: cnsl user language Co-authored-by: Livio Spring <livio.a@gmail.com>
This commit is contained in:
parent
9347a196c0
commit
e8a01abcdb
@ -43,7 +43,7 @@ function passwordConfirmValidator(c: AbstractControl): any {
|
|||||||
export class UserCreateComponent implements OnDestroy {
|
export class UserCreateComponent implements OnDestroy {
|
||||||
public user: AddHumanUserRequest.AsObject = new AddHumanUserRequest().toObject();
|
public user: AddHumanUserRequest.AsObject = new AddHumanUserRequest().toObject();
|
||||||
public genders: Gender[] = [Gender.GENDER_FEMALE, Gender.GENDER_MALE, Gender.GENDER_UNSPECIFIED];
|
public genders: Gender[] = [Gender.GENDER_FEMALE, Gender.GENDER_MALE, Gender.GENDER_UNSPECIFIED];
|
||||||
public languages: string[] = ['de', 'en'];
|
public languages: string[] = ['de', 'en', 'it', 'fr'];
|
||||||
public userForm!: UntypedFormGroup;
|
public userForm!: UntypedFormGroup;
|
||||||
public pwdForm!: UntypedFormGroup;
|
public pwdForm!: UntypedFormGroup;
|
||||||
|
|
||||||
@ -94,6 +94,10 @@ export class UserCreateComponent implements OnDestroy {
|
|||||||
this.envSuffixLabel = this.envSuffix();
|
this.envSuffixLabel = this.envSuffix();
|
||||||
this.changeDetRef.detectChanges();
|
this.changeDetRef.detectChanges();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.mgmtService.getSupportedLanguages().then((lang) => {
|
||||||
|
this.languages = lang.languagesList;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public close(): void {
|
public close(): void {
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
import { Component, Inject } from '@angular/core';
|
import { Component, Inject } from '@angular/core';
|
||||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||||
|
import { Buffer } from 'buffer';
|
||||||
import { Timestamp } from 'google-protobuf/google/protobuf/timestamp_pb';
|
import { Timestamp } from 'google-protobuf/google/protobuf/timestamp_pb';
|
||||||
import { Metadata } from 'src/app/proto/generated/zitadel/metadata_pb';
|
import { Metadata } from 'src/app/proto/generated/zitadel/metadata_pb';
|
||||||
|
import { GrpcAuthService } from 'src/app/services/grpc-auth.service';
|
||||||
import { ManagementService } from 'src/app/services/mgmt.service';
|
import { ManagementService } from 'src/app/services/mgmt.service';
|
||||||
import { ToastService } from 'src/app/services/toast.service';
|
import { ToastService } from 'src/app/services/toast.service';
|
||||||
|
|
||||||
@ -17,7 +19,8 @@ export class MetadataDialogComponent {
|
|||||||
public ts!: Timestamp.AsObject | undefined;
|
public ts!: Timestamp.AsObject | undefined;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private service: ManagementService,
|
private managementService: ManagementService,
|
||||||
|
private authService: GrpcAuthService,
|
||||||
private toast: ToastService,
|
private toast: ToastService,
|
||||||
public dialogRef: MatDialogRef<MetadataDialogComponent>,
|
public dialogRef: MatDialogRef<MetadataDialogComponent>,
|
||||||
@Inject(MAT_DIALOG_DATA) public data: any,
|
@Inject(MAT_DIALOG_DATA) public data: any,
|
||||||
@ -46,17 +49,25 @@ export class MetadataDialogComponent {
|
|||||||
public loadMetadata(): Promise<void> {
|
public loadMetadata(): Promise<void> {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
if (this.injData.userId) {
|
if (this.injData.userId) {
|
||||||
return this.service.listUserMetadata(this.injData.userId).then((resp) => {
|
return this.managementService.listUserMetadata(this.injData.userId).then((resp) => {
|
||||||
this.metadata = resp.resultList.map((md) => {
|
this.metadata = resp.resultList.map((md) => {
|
||||||
return {
|
return {
|
||||||
key: md.key,
|
key: md.key,
|
||||||
value: atob(md.value as string),
|
value: Buffer.from(md.value as string, 'base64'),
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
this.ts = resp.details?.viewTimestamp;
|
this.ts = resp.details?.viewTimestamp;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
return Promise.reject();
|
return this.authService.listMyMetadata().then((resp) => {
|
||||||
|
this.metadata = resp.resultList.map((md) => {
|
||||||
|
return {
|
||||||
|
key: md.key,
|
||||||
|
value: Buffer.from(md.value as string, 'base64'),
|
||||||
|
};
|
||||||
|
});
|
||||||
|
this.ts = resp.details?.viewTimestamp;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,7 +104,7 @@ export class MetadataDialogComponent {
|
|||||||
|
|
||||||
public setMetadata(key: string, value: string): void {
|
public setMetadata(key: string, value: string): void {
|
||||||
if (key && value) {
|
if (key && value) {
|
||||||
this.service
|
this.managementService
|
||||||
.setUserMetadata(key, btoa(value), this.injData.userId)
|
.setUserMetadata(key, btoa(value), this.injData.userId)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.toast.showInfo('USER.METADATA.SETSUCCESS', true);
|
this.toast.showInfo('USER.METADATA.SETSUCCESS', true);
|
||||||
@ -105,7 +116,7 @@ export class MetadataDialogComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public removeMetadata(key: string): Promise<void> {
|
public removeMetadata(key: string): Promise<void> {
|
||||||
return this.service
|
return this.managementService
|
||||||
.removeUserMetadata(key, this.injData.userId)
|
.removeUserMetadata(key, this.injData.userId)
|
||||||
.then((resp) => {
|
.then((resp) => {
|
||||||
this.toast.showInfo('USER.METADATA.REMOVESUCCESS', true);
|
this.toast.showInfo('USER.METADATA.REMOVESUCCESS', true);
|
||||||
|
@ -39,7 +39,7 @@ export class UserDetailComponent implements OnInit {
|
|||||||
public user!: User.AsObject;
|
public user!: User.AsObject;
|
||||||
public metadata: Metadata.AsObject[] = [];
|
public metadata: Metadata.AsObject[] = [];
|
||||||
public genders: Gender[] = [Gender.GENDER_MALE, Gender.GENDER_FEMALE, Gender.GENDER_DIVERSE];
|
public genders: Gender[] = [Gender.GENDER_MALE, Gender.GENDER_FEMALE, Gender.GENDER_DIVERSE];
|
||||||
public languages: string[] = ['de', 'en'];
|
public languages: string[] = ['de', 'en', 'it', 'fr'];
|
||||||
|
|
||||||
public ChangeType: any = ChangeType;
|
public ChangeType: any = ChangeType;
|
||||||
public loading: boolean = true;
|
public loading: boolean = true;
|
||||||
@ -91,6 +91,10 @@ export class UserDetailComponent implements OnInit {
|
|||||||
this.mediaMatcher.matchMedia(mediaq).onchange = (small) => {
|
this.mediaMatcher.matchMedia(mediaq).onchange = (small) => {
|
||||||
this.changeSelection(small.matches);
|
this.changeSelection(small.matches);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.mgmtUserService.getSupportedLanguages().then((lang) => {
|
||||||
|
this.languages = lang.languagesList;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private changeSelection(small: boolean): void {
|
private changeSelection(small: boolean): void {
|
||||||
|
@ -5,88 +5,91 @@ import { BehaviorSubject, from, merge, Observable, of, Subject } from 'rxjs';
|
|||||||
import { catchError, filter, finalize, map, mergeMap, switchMap, take, timeout } from 'rxjs/operators';
|
import { catchError, filter, finalize, map, mergeMap, switchMap, take, timeout } from 'rxjs/operators';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
AddMyAuthFactorOTPRequest,
|
AddMyAuthFactorOTPRequest,
|
||||||
AddMyAuthFactorOTPResponse,
|
AddMyAuthFactorOTPResponse,
|
||||||
AddMyAuthFactorU2FRequest,
|
AddMyAuthFactorU2FRequest,
|
||||||
AddMyAuthFactorU2FResponse,
|
AddMyAuthFactorU2FResponse,
|
||||||
AddMyPasswordlessLinkRequest,
|
AddMyPasswordlessLinkRequest,
|
||||||
AddMyPasswordlessLinkResponse,
|
AddMyPasswordlessLinkResponse,
|
||||||
AddMyPasswordlessRequest,
|
AddMyPasswordlessRequest,
|
||||||
AddMyPasswordlessResponse,
|
AddMyPasswordlessResponse,
|
||||||
GetMyEmailRequest,
|
GetMyEmailRequest,
|
||||||
GetMyEmailResponse,
|
GetMyEmailResponse,
|
||||||
GetMyLabelPolicyRequest,
|
GetMyLabelPolicyRequest,
|
||||||
GetMyLabelPolicyResponse,
|
GetMyLabelPolicyResponse,
|
||||||
GetMyPasswordComplexityPolicyRequest,
|
GetMyPasswordComplexityPolicyRequest,
|
||||||
GetMyPasswordComplexityPolicyResponse,
|
GetMyPasswordComplexityPolicyResponse,
|
||||||
GetMyPhoneRequest,
|
GetMyPhoneRequest,
|
||||||
GetMyPhoneResponse,
|
GetMyPhoneResponse,
|
||||||
GetMyPrivacyPolicyRequest,
|
GetMyPrivacyPolicyRequest,
|
||||||
GetMyPrivacyPolicyResponse,
|
GetMyPrivacyPolicyResponse,
|
||||||
GetMyProfileRequest,
|
GetMyProfileRequest,
|
||||||
GetMyProfileResponse,
|
GetMyProfileResponse,
|
||||||
GetMyUserRequest,
|
GetMyUserRequest,
|
||||||
GetMyUserResponse,
|
GetMyUserResponse,
|
||||||
GetSupportedLanguagesRequest,
|
GetSupportedLanguagesRequest,
|
||||||
GetSupportedLanguagesResponse,
|
GetSupportedLanguagesResponse,
|
||||||
ListMyAuthFactorsRequest,
|
ListMyAuthFactorsRequest,
|
||||||
ListMyAuthFactorsResponse,
|
ListMyAuthFactorsResponse,
|
||||||
ListMyLinkedIDPsRequest,
|
ListMyLinkedIDPsRequest,
|
||||||
ListMyLinkedIDPsResponse,
|
ListMyLinkedIDPsResponse,
|
||||||
ListMyMembershipsRequest,
|
ListMyMembershipsRequest,
|
||||||
ListMyMembershipsResponse,
|
ListMyMembershipsResponse,
|
||||||
ListMyPasswordlessRequest,
|
ListMyMetadataRequest,
|
||||||
ListMyPasswordlessResponse,
|
ListMyMetadataResponse,
|
||||||
ListMyProjectOrgsRequest,
|
ListMyPasswordlessRequest,
|
||||||
ListMyProjectOrgsResponse,
|
ListMyPasswordlessResponse,
|
||||||
ListMyUserChangesRequest,
|
ListMyProjectOrgsRequest,
|
||||||
ListMyUserChangesResponse,
|
ListMyProjectOrgsResponse,
|
||||||
ListMyUserGrantsRequest,
|
ListMyUserChangesRequest,
|
||||||
ListMyUserGrantsResponse,
|
ListMyUserChangesResponse,
|
||||||
ListMyUserSessionsRequest,
|
ListMyUserGrantsRequest,
|
||||||
ListMyUserSessionsResponse,
|
ListMyUserGrantsResponse,
|
||||||
ListMyZitadelPermissionsRequest,
|
ListMyUserSessionsRequest,
|
||||||
ListMyZitadelPermissionsResponse,
|
ListMyUserSessionsResponse,
|
||||||
RemoveMyAuthFactorOTPRequest,
|
ListMyZitadelPermissionsRequest,
|
||||||
RemoveMyAuthFactorOTPResponse,
|
ListMyZitadelPermissionsResponse,
|
||||||
RemoveMyAuthFactorU2FRequest,
|
RemoveMyAuthFactorOTPRequest,
|
||||||
RemoveMyAuthFactorU2FResponse,
|
RemoveMyAuthFactorOTPResponse,
|
||||||
RemoveMyAvatarRequest,
|
RemoveMyAuthFactorU2FRequest,
|
||||||
RemoveMyAvatarResponse,
|
RemoveMyAuthFactorU2FResponse,
|
||||||
RemoveMyLinkedIDPRequest,
|
RemoveMyAvatarRequest,
|
||||||
RemoveMyLinkedIDPResponse,
|
RemoveMyAvatarResponse,
|
||||||
RemoveMyPasswordlessRequest,
|
RemoveMyLinkedIDPRequest,
|
||||||
RemoveMyPasswordlessResponse,
|
RemoveMyLinkedIDPResponse,
|
||||||
RemoveMyPhoneRequest,
|
RemoveMyPasswordlessRequest,
|
||||||
RemoveMyPhoneResponse,
|
RemoveMyPasswordlessResponse,
|
||||||
RemoveMyUserRequest,
|
RemoveMyPhoneRequest,
|
||||||
RemoveMyUserResponse,
|
RemoveMyPhoneResponse,
|
||||||
ResendMyEmailVerificationRequest,
|
RemoveMyUserRequest,
|
||||||
ResendMyEmailVerificationResponse,
|
RemoveMyUserResponse,
|
||||||
ResendMyPhoneVerificationRequest,
|
ResendMyEmailVerificationRequest,
|
||||||
ResendMyPhoneVerificationResponse,
|
ResendMyEmailVerificationResponse,
|
||||||
SendMyPasswordlessLinkRequest,
|
ResendMyPhoneVerificationRequest,
|
||||||
SendMyPasswordlessLinkResponse,
|
ResendMyPhoneVerificationResponse,
|
||||||
SetMyEmailRequest,
|
SendMyPasswordlessLinkRequest,
|
||||||
SetMyEmailResponse,
|
SendMyPasswordlessLinkResponse,
|
||||||
SetMyPhoneRequest,
|
SetMyEmailRequest,
|
||||||
SetMyPhoneResponse,
|
SetMyEmailResponse,
|
||||||
UpdateMyPasswordRequest,
|
SetMyPhoneRequest,
|
||||||
UpdateMyPasswordResponse,
|
SetMyPhoneResponse,
|
||||||
UpdateMyProfileRequest,
|
UpdateMyPasswordRequest,
|
||||||
UpdateMyProfileResponse,
|
UpdateMyPasswordResponse,
|
||||||
UpdateMyUserNameRequest,
|
UpdateMyProfileRequest,
|
||||||
UpdateMyUserNameResponse,
|
UpdateMyProfileResponse,
|
||||||
VerifyMyAuthFactorOTPRequest,
|
UpdateMyUserNameRequest,
|
||||||
VerifyMyAuthFactorOTPResponse,
|
UpdateMyUserNameResponse,
|
||||||
VerifyMyAuthFactorU2FRequest,
|
VerifyMyAuthFactorOTPRequest,
|
||||||
VerifyMyAuthFactorU2FResponse,
|
VerifyMyAuthFactorOTPResponse,
|
||||||
VerifyMyPasswordlessRequest,
|
VerifyMyAuthFactorU2FRequest,
|
||||||
VerifyMyPasswordlessResponse,
|
VerifyMyAuthFactorU2FResponse,
|
||||||
VerifyMyPhoneRequest,
|
VerifyMyPasswordlessRequest,
|
||||||
VerifyMyPhoneResponse,
|
VerifyMyPasswordlessResponse,
|
||||||
|
VerifyMyPhoneRequest,
|
||||||
|
VerifyMyPhoneResponse,
|
||||||
} from '../proto/generated/zitadel/auth_pb';
|
} from '../proto/generated/zitadel/auth_pb';
|
||||||
import { ChangeQuery } from '../proto/generated/zitadel/change_pb';
|
import { ChangeQuery } from '../proto/generated/zitadel/change_pb';
|
||||||
|
import { MetadataQuery } from '../proto/generated/zitadel/metadata_pb';
|
||||||
import { ListQuery } from '../proto/generated/zitadel/object_pb';
|
import { ListQuery } from '../proto/generated/zitadel/object_pb';
|
||||||
import { Org, OrgFieldName, OrgQuery } from '../proto/generated/zitadel/org_pb';
|
import { Org, OrgFieldName, OrgQuery } from '../proto/generated/zitadel/org_pb';
|
||||||
import { Gender, MembershipQuery, User, WebAuthNVerification } from '../proto/generated/zitadel/user_pb';
|
import { Gender, MembershipQuery, User, WebAuthNVerification } from '../proto/generated/zitadel/user_pb';
|
||||||
@ -145,6 +148,25 @@ export class GrpcAuthService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public listMyMetadata(
|
||||||
|
offset?: number,
|
||||||
|
limit?: number,
|
||||||
|
queryList?: MetadataQuery[],
|
||||||
|
): Promise<ListMyMetadataResponse.AsObject> {
|
||||||
|
const req = new ListMyMetadataRequest();
|
||||||
|
const metadata = new ListQuery();
|
||||||
|
if (offset) {
|
||||||
|
metadata.setOffset(offset);
|
||||||
|
}
|
||||||
|
if (limit) {
|
||||||
|
metadata.setLimit(limit);
|
||||||
|
}
|
||||||
|
if (queryList) {
|
||||||
|
req.setQueriesList(queryList);
|
||||||
|
}
|
||||||
|
return this.grpcService.auth.listMyMetadata(req, null).then((resp) => resp.toObject());
|
||||||
|
}
|
||||||
|
|
||||||
public async getActiveOrg(id?: string): Promise<Org.AsObject> {
|
public async getActiveOrg(id?: string): Promise<Org.AsObject> {
|
||||||
if (id) {
|
if (id) {
|
||||||
const find = this.cachedOrgs.find((tmp) => tmp.id === id);
|
const find = this.cachedOrgs.find((tmp) => tmp.id === id);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user