< Summary

Information
Class: Syki.Back.Features.Cross.LoginMfa.LoginMfaService
Assembly: Back
File(s): /home/runner/work/syki/syki/Back/Features/Cross/LoginMfa/LoginMfaService.cs
Tag: 22_11348620282
Line coverage
100%
Covered lines: 9
Uncovered lines: 0
Coverable lines: 9
Total lines: 22
Line coverage: 100%
Branch coverage
100%
Covered branches: 2
Total branches: 2
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
Login()100%22100%

File(s)

/home/runner/work/syki/syki/Back/Features/Cross/LoginMfa/LoginMfaService.cs

#LineLine coverage
 1using Syki.Back.Features.Cross.CreateUser;
 2using Syki.Back.Features.Cross.GenerateJWT;
 3
 4namespace Syki.Back.Features.Cross.LoginMfa;
 5
 36public class LoginMfaService(GenerateJWTService service, SignInManager<SykiUser> signInManager) : ICrossService
 7{
 8    public async Task<LoginMfaOut> Login(LoginMfaIn data)
 9    {
 310        var token = data.Token!.OnlyNumbers();
 311        var result = await signInManager.TwoFactorAuthenticatorSignInAsync(token, false, false);
 12
 313        if (!result.Succeeded)
 214            return new LoginMfaOut { Wrong2FactorCode = true };
 15
 116        var user = await signInManager.GetTwoFactorAuthenticationUserAsync();
 17
 118        var jwt = await service.Generate(user!.Email!);
 19
 120        return new LoginMfaOut { AccessToken = jwt };
 321    }
 22}