Error message on invalid credentials

This commit is contained in:
Andre Beging
2022-05-30 11:05:19 +02:00
parent a9ce2810c8
commit 607fab1d04
2 changed files with 12 additions and 7 deletions

View File

@@ -1,4 +1,3 @@
using System.Text.RegularExpressions;
using Blazorise;
using Microsoft.AspNetCore.Components.Web;
@@ -26,9 +25,9 @@ namespace FoodsharingSiegen.Server.Pages
#region Private Properties
/// <summary>
/// Gets or sets the value of the mailaddress (ab)
/// Gets or sets the value of the mail-address (ab)
/// </summary>
private string? Mailaddress { get; set; }
private string? MailAddress { get; set; }
/// <summary>
/// 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]
if (string.IsNullOrWhiteSpace(Mailaddress) || string.IsNullOrWhiteSpace(Password))
if (string.IsNullOrWhiteSpace(MailAddress) || string.IsNullOrWhiteSpace(Password))
{
Mailaddress = string.Empty;
MailAddress = string.Empty;
Password = string.Empty;
return;
}
var loginR = await AuthService.Login(Mailaddress, Password);
var loginR = await AuthService.Login(MailAddress, Password);
if (loginR.Success)
{
NavigationManager.NavigateTo("/", true);
}
else
{
await Notification?.Error(loginR.ErrorMessage)!;
}
}
#endregion