mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-06 19:36:41 +00:00
# Which Problems Are Solved
- Hides for users MFA options are not allowed by org policy.
- Fix for "ng test" across "console"
# How the Problems Are Solved
- Before displaying MFA options we call "listMyMultiFactors" from parent
component to filter MFA allowed by org
# Additional Changes
- Dependency Injection was fixed around ng unit tests
# Additional Context
admin view
<img width="698" alt="Screenshot 2025-02-06 at 00 26 50"
src="https://github.com/user-attachments/assets/1b642c8a-a640-4bdd-a1ca-bde70c263567"
/>
user view
<img width="751" alt="Screenshot 2025-02-06 at 00 27 16"
src="https://github.com/user-attachments/assets/e1c99907-3226-46ce-b8bc-e993af4b4cae"
/>
test
<img width="1500" alt="Screenshot 2025-02-06 at 00 01 36"
src="https://github.com/user-attachments/assets/d2d8ead1-9f0f-4916-a2fc-f4db9c71cfa8"
/>
The issue: https://github.com/zitadel/zitadel/issues/9176
The bug report:
https://discord.com/channels/927474939156643850/1307006457815896094
---------
Co-authored-by: a k <rdyto1@macbook-pro-1.home>
Co-authored-by: a k <rdyto1@macbook-pro.home>
Co-authored-by: a k <rdyto1@macbook-pro-2.home>
Co-authored-by: Ramon <mail@conblem.me>
(cherry picked from commit 839c761357)
74 lines
2.7 KiB
TypeScript
74 lines
2.7 KiB
TypeScript
import { Injectable } from '@angular/core';
|
|
import { GrpcService } from './grpc.service';
|
|
import { create } from '@bufbuild/protobuf';
|
|
import {
|
|
AddMyAuthFactorOTPSMSResponse,
|
|
GetMyLoginPolicyResponse,
|
|
GetMyLoginPolicyRequestSchema,
|
|
GetMyPasswordComplexityPolicyResponse,
|
|
GetMyUserResponse,
|
|
ListMyAuthFactorsRequestSchema,
|
|
ListMyAuthFactorsResponse,
|
|
RemoveMyAuthFactorOTPEmailRequestSchema,
|
|
RemoveMyAuthFactorOTPEmailResponse,
|
|
RemoveMyAuthFactorOTPRequestSchema,
|
|
RemoveMyAuthFactorOTPResponse,
|
|
RemoveMyAuthFactorU2FRequestSchema,
|
|
RemoveMyAuthFactorU2FResponse,
|
|
RemoveMyAuthFactorOTPSMSRequestSchema,
|
|
RemoveMyAuthFactorOTPSMSResponse,
|
|
ListMyMetadataResponse,
|
|
VerifyMyPhoneResponse,
|
|
} from '@zitadel/proto/zitadel/auth_pb';
|
|
|
|
@Injectable({
|
|
providedIn: 'root',
|
|
})
|
|
export class NewAuthService {
|
|
constructor(private readonly grpcService: GrpcService) {}
|
|
|
|
public getMyUser(): Promise<GetMyUserResponse> {
|
|
return this.grpcService.authNew.getMyUser({});
|
|
}
|
|
|
|
public verifyMyPhone(code: string): Promise<VerifyMyPhoneResponse> {
|
|
return this.grpcService.authNew.verifyMyPhone({ code });
|
|
}
|
|
|
|
public addMyAuthFactorOTPSMS(): Promise<AddMyAuthFactorOTPSMSResponse> {
|
|
return this.grpcService.authNew.addMyAuthFactorOTPSMS({});
|
|
}
|
|
|
|
public listMyMetadata(): Promise<ListMyMetadataResponse> {
|
|
return this.grpcService.authNew.listMyMetadata({});
|
|
}
|
|
|
|
public listMyMultiFactors(): Promise<ListMyAuthFactorsResponse> {
|
|
return this.grpcService.authNew.listMyAuthFactors(create(ListMyAuthFactorsRequestSchema), null);
|
|
}
|
|
|
|
public removeMyAuthFactorOTPSMS(): Promise<RemoveMyAuthFactorOTPSMSResponse> {
|
|
return this.grpcService.authNew.removeMyAuthFactorOTPSMS(create(RemoveMyAuthFactorOTPSMSRequestSchema), null);
|
|
}
|
|
|
|
public getMyLoginPolicy(): Promise<GetMyLoginPolicyResponse> {
|
|
return this.grpcService.authNew.getMyLoginPolicy(create(GetMyLoginPolicyRequestSchema), null);
|
|
}
|
|
|
|
public removeMyMultiFactorOTP(): Promise<RemoveMyAuthFactorOTPResponse> {
|
|
return this.grpcService.authNew.removeMyAuthFactorOTP(create(RemoveMyAuthFactorOTPRequestSchema), null);
|
|
}
|
|
|
|
public removeMyMultiFactorU2F(tokenId: string): Promise<RemoveMyAuthFactorU2FResponse> {
|
|
return this.grpcService.authNew.removeMyAuthFactorU2F(create(RemoveMyAuthFactorU2FRequestSchema, { tokenId }), null);
|
|
}
|
|
|
|
public removeMyAuthFactorOTPEmail(): Promise<RemoveMyAuthFactorOTPEmailResponse> {
|
|
return this.grpcService.authNew.removeMyAuthFactorOTPEmail(create(RemoveMyAuthFactorOTPEmailRequestSchema), null);
|
|
}
|
|
|
|
public getMyPasswordComplexityPolicy(): Promise<GetMyPasswordComplexityPolicyResponse> {
|
|
return this.grpcService.authNew.getMyPasswordComplexityPolicy({});
|
|
}
|
|
}
|