< Summary

Information
Class: Syki.Front.Pages.Cross.SendResetPasswordTokenPage
Assembly: Front
File(s): /home/runner/work/syki/syki/Front/Pages/Cross/SendResetPasswordTokenPage.razor
Tag: 22_11348620282
Line coverage
0%
Covered lines: 0
Uncovered lines: 16
Coverable lines: 16
Total lines: 78
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
Submit()0%2040%

File(s)

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

#LineLine coverage
 1@namespace Syki.Front.Pages.Cross
 2
 3@page "/reset-password-token"
 4
 5<SykiPageTitle Title="Recuperar senha" />
 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>
 011    <MudForm @ref="@_form">
 012        <MudCard Class="px-4 pt-0 pb-4">
 013            <MudImage Src="logo_512x512.png" Alt="Syki" Elevation="25" Class="rounded-lg mx-20 mt-10 mb-5"/>
 014            @if (_saved)
 015            {
 016                <MudAlert NoIcon="true" Class="mt-2 mb-6" Severity="Severity.Success" Variant="Variant.Text" ContentAlig
 17                    <MudText>Verifique seu email e utilize o link para redefinir a senha.</MudText>
 18                </MudAlert>
 19            }
 20            else
 21            {
 22                <MudCardContent>
 23                    <MudTextField
 24                        InputType="InputType.Email"
 25                        Margin="Margin.Dense"
 26                        AutoFocus="true"
 27                        Label="Email"
 28                        Class="mt-3"
 29                        OnlyValidateIfDirty="true"
 30                        @bind-Value="@_email"
 31                        Variant="Variant.Outlined"
 32                        Required="true"
 33                        RequiredError="Informe!"/>
 34                </MudCardContent>
 35                <MudCardActions Class="justify-center">
 36                    <MudButton
 37                        OnClick="@Submit"
 38                        Size="Size.Large"
 39                        Color="Color.Primary"
 40                        Variant="Variant.Filled"
 41                        Class="mb-4 px-12 my-0">
 42                        Recuperar
 43                    </MudButton>
 44                </MudCardActions>
 45            }
 46        </MudCard>
 47    </MudForm>
 48</MudContainer>
 49
 50@inject ISnackbar Snackbar
 51@inject SendResetPasswordTokenClient Client
 52
 53@code
 54{
 55    private bool _saved;
 56    private bool _loading;
 57    private MudForm _form;
 58    private string _email;
 59
 60    private async Task Submit()
 61    {
 062        await _form.Validate();
 063        if (!_form.IsValid) return;
 64
 065        _loading = true;
 066        var response = await Client.Send(_email);
 067        if (response.IsSuccessStatusCode)
 68        {
 069            _saved = true;
 70        }
 71        else
 72        {
 073            var error = await response.ToError();
 074            Snackbar.Add(error.Message, Severity.Error);
 75        }
 076        _loading = false;
 077    }
 78}

Methods/Properties

Submit()