< Summary

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

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
OnClick()0%7280%

File(s)

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

#LineLine coverage
 1@using Syki.Front.Components.Passwords
 2
 3@namespace Syki.Front.Pages.Cross
 4
 5@page "/login"
 6
 7<SykiPageTitle Title="Login" />
 8
 9<MudContainer Class="mt-4 mb-8" MaxWidth="MaxWidth.ExtraSmall">
 10    <MudOverlay @bind-Visible="@_loading" LightBackground="true" Absolute="false">
 11        <MudProgressCircular Color="Color.Info" Indeterminate="true" Size="Size.Large" />
 12    </MudOverlay>
 013    <MudForm @ref="@_form">
 014        <MudCard Class="px-4 pt-0 pb-4">
 015            <MudImage Src="logo_512x512.png" Alt="Syki" Elevation="25" Class="rounded-lg mx-20 mt-10 mb-5"/>
 016            <MudCardContent>
 017                <MudTextField
 018                    InputType="InputType.Email"
 19                    Margin="Margin.Dense"
 20                    AutoFocus="true"
 21                    Label="Email"
 22                    Class="mt-0 pb-3"
 23                    OnlyValidateIfDirty="true"
 24                    @bind-Value="@_email"
 25                    Variant="Variant.Outlined"
 26                    Required="true"
 27                    RequiredError="Informe!"/>
 28                <PasswordTextField @bind-Value="@_password"/>
 29            </MudCardContent>
 30            <MudCardActions Class="justify-center">
 31                <MudStack Spacing="1">
 32                    <MudButton
 33                        Size="Size.Large"
 34                        OnClick="@OnClick"
 35                        Variant="Variant.Filled"
 36                        Color="Color.Primary"
 37                        Class="mx-auto mb-4 px-12">
 38                        Login
 39                    </MudButton>
 40                    <MudLink Href="/reset-password-token">Esqueci minha senha</MudLink>
 41                </MudStack>
 42            </MudCardActions>
 43        </MudCard>
 44    </MudForm>
 45</MudContainer>
 46
 47@inject ISnackbar Snackbar
 48@inject LoginClient Client
 49@inject NavigationManager Nav
 50
 51@code
 52{
 53    private bool _loading;
 54    private MudForm _form;
 55    private string _email;
 56    private string _password;
 57
 58    private async Task OnClick()
 59    {
 060        await _form.Validate();
 061        if (!_form.IsValid) return;
 62
 063        _loading = true;
 064        var result = await Client.Login(_email, _password);
 065        if (result.AccessToken != null)
 66        {
 067            Nav.NavigateTo("/");
 68        }
 069        if (result.RequiresTwoFactor)
 70        {
 071            Nav.NavigateTo("/login-mfa");
 72        }
 073        if (result.WrongEmailOrPassword)
 74        {
 075            Snackbar.Add("Email ou senha inválidos!", Severity.Error);
 76        }
 077        _loading = false;
 078    }
 79}

Methods/Properties

OnClick()