< Summary

Information
Class: Syki.Front.Pages.Cross.LoginMfaPage
Assembly: Front
File(s): /home/runner/work/syki/syki/Front/Pages/Cross/LoginMfaPage.razor
Tag: 22_11348620282
Line coverage
0%
Covered lines: 0
Uncovered lines: 11
Coverable lines: 11
Total lines: 86
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 6
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
HandleCodeChanged()0%2040%

File(s)

/home/runner/work/syki/syki/Front/Pages/Cross/LoginMfaPage.razor

#LineLine coverage
 1@namespace Syki.Front.Pages.Cross
 2
 3@page "/login-mfa"
 4
 5<SykiPageTitle Title="Login MFA" />
 6
 7<MudContainer Class="mt-4 mb-8" MaxWidth="MaxWidth.ExtraSmall">
 8    <MudOverlay @bind-Visible="@_loading" LightBackground="true" Absolute="false">
 9        <MudProgressCircular Color="Color.Info" Indeterminate="true" Size="Size.Large" />
 10    </MudOverlay>
 11    <style>input { text-align: center; font-size: 24px !important; letter-spacing: 3px !important; }</style>
 12    <MudCard Class="px-4 pt-8" Style="height: 460px">
 13        <MudCardContent>
 14            <MudStack AlignItems="AlignItems.Center">
 15                <MudAlert NoIcon="true" Class="px-4 mb-4" Severity="Severity.Info" Variant="Variant.Text" ContentAlignme
 16                    <MudStack Row="true" Justify="Justify.SpaceAround">
 17                        <MudText>Insira o código gerado pelo app Google Authenticator para realizar o login</MudText>
 18                    </MudStack>
 19                </MudAlert>
 20                <MudForm>
 21                    <style>
 22                        .align-center input{
 23                            text-align: center;
 24                        }
 25                    </style>
 26                    <MudNumericField
 27                        T="int?"
 28                        Immediate="true"
 29                        OnlyValidateIfDirty="true"
 30                        ReadOnly="@_loading"
 31                        Style="width: 200px;"
 32                        Value="@_code"
 33                        ValueChanged="@HandleCodeChanged"
 34                        Variant="Variant.Outlined"
 35                        HideSpinButtons="true"
 36                        AutoFocus="true"
 37                        Typo="Typo.h6"
 38                        Class="mt-8"
 39                        Margin="Margin.Dense"
 40                        Max="999999"
 41                        MaxLength="6"
 42                        Min="0"
 43                    />
 44                </MudForm>
 045                @if (_showCodeFeedback)
 46                {
 47                    <MudAlert Class="mt-4" Severity="Severity.Error" Variant="Variant.Text">
 48                        <MudStack Row="true" Justify="Justify.SpaceAround">
 49                            <MudText>Código inválido</MudText>
 50                        </MudStack>
 51                    </MudAlert>
 52                }
 53            </MudStack>
 54        </MudCardContent>
 55    </MudCard>
 56</MudContainer>
 57
 58@inject LoginMfaClient Client
 59@inject NavigationManager Nav
 60
 61@code
 62{
 63    private int? _code;
 64    private bool _loading;
 65    private bool _showCodeFeedback;
 66
 67    private async Task HandleCodeChanged(int? newValue)
 68    {
 069        _showCodeFeedback = false;
 070        _code = newValue;
 71
 072        if (_code.ToString().Length == 6)
 73        {
 074            _loading = true;
 075            var result = await Client.Login(_code.ToString()!);
 76
 077            if (result.AccessToken != null)
 78            {
 079                Nav.NavigateTo("/");
 80            }
 81
 082            _showCodeFeedback = true;
 083            _loading = false;
 84        }
 085    }
 86}

Methods/Properties

HandleCodeChanged()