Error message on invalid credentials
This commit is contained in:
@@ -3,6 +3,8 @@
|
|||||||
@using FoodsharingSiegen.Shared.Helper
|
@using FoodsharingSiegen.Shared.Helper
|
||||||
@layout LoginLayout
|
@layout LoginLayout
|
||||||
|
|
||||||
|
@inherits FoodsharingSiegen.Server.BaseClasses.FsBase
|
||||||
|
|
||||||
@inject AuthService AuthService
|
@inject AuthService AuthService
|
||||||
@inject NavigationManager NavigationManager
|
@inject NavigationManager NavigationManager
|
||||||
|
|
||||||
@@ -11,7 +13,7 @@
|
|||||||
<div class="card-header">FS Siegen</div>
|
<div class="card-header">FS Siegen</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<Validation Validator="ValidationHelper.ValidateMail" @bind-Status="@IsValidMail">
|
<Validation Validator="ValidationHelper.ValidateMail" @bind-Status="@IsValidMail">
|
||||||
<TextEdit @bind-Text="Mailaddress" Role="TextRole.Email" Placeholder="E-Mail" Class="mt-0" KeyUp="TextEdit_KeyUp"></TextEdit>
|
<TextEdit @bind-Text="MailAddress" Role="TextRole.Email" Placeholder="E-Mail" Class="mt-0" KeyUp="TextEdit_KeyUp"></TextEdit>
|
||||||
</Validation>
|
</Validation>
|
||||||
|
|
||||||
<Validation Validator="ValidationHelper.ValidatePassword" @bind-Status="@IsValidPassword">
|
<Validation Validator="ValidationHelper.ValidatePassword" @bind-Status="@IsValidPassword">
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
using System.Text.RegularExpressions;
|
|
||||||
using Blazorise;
|
using Blazorise;
|
||||||
using Microsoft.AspNetCore.Components.Web;
|
using Microsoft.AspNetCore.Components.Web;
|
||||||
|
|
||||||
@@ -26,9 +25,9 @@ namespace FoodsharingSiegen.Server.Pages
|
|||||||
#region Private Properties
|
#region Private Properties
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the value of the mailaddress (ab)
|
/// Gets or sets the value of the mail-address (ab)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private string? Mailaddress { get; set; }
|
private string? MailAddress { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the value of the password (ab)
|
/// Gets or sets the value of the password (ab)
|
||||||
@@ -46,18 +45,22 @@ namespace FoodsharingSiegen.Server.Pages
|
|||||||
{
|
{
|
||||||
//Todo Eingaben Validieren [04.04.22 - Andre Beging]
|
//Todo Eingaben Validieren [04.04.22 - Andre Beging]
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(Mailaddress) || string.IsNullOrWhiteSpace(Password))
|
if (string.IsNullOrWhiteSpace(MailAddress) || string.IsNullOrWhiteSpace(Password))
|
||||||
{
|
{
|
||||||
Mailaddress = string.Empty;
|
MailAddress = string.Empty;
|
||||||
Password = string.Empty;
|
Password = string.Empty;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var loginR = await AuthService.Login(Mailaddress, Password);
|
var loginR = await AuthService.Login(MailAddress, Password);
|
||||||
if (loginR.Success)
|
if (loginR.Success)
|
||||||
{
|
{
|
||||||
NavigationManager.NavigateTo("/", true);
|
NavigationManager.NavigateTo("/", true);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
await Notification?.Error(loginR.ErrorMessage)!;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
Reference in New Issue
Block a user