using System.Text.RegularExpressions; using Blazorise; using Microsoft.AspNetCore.Components.Web; namespace FoodsharingSiegen.Server.Pages { /// /// The login class (a. beging, 11.04.2022) /// public partial class Login { #region Public Properties /// /// Gets or sets the value of the is valid mail (ab) /// public ValidationStatus IsValidMail { get; set; } /// /// Gets or sets the value of the is valid password (ab) /// public ValidationStatus IsValidPassword { get; set; } #endregion #region Private Properties /// /// Gets or sets the value of the mailaddress (ab) /// private string? Mailaddress { get; set; } /// /// Gets or sets the value of the password (ab) /// private string? Password { get; set; } #endregion #region Private Method PerformLogin /// /// Performs the login (a. beging, 11.04.2022) /// private async Task PerformLogin() { //Todo Eingaben Validieren [04.04.22 - Andre Beging] if (string.IsNullOrWhiteSpace(Mailaddress) || string.IsNullOrWhiteSpace(Password)) { Mailaddress = string.Empty; Password = string.Empty; return; } var loginR = await AuthService.Login(Mailaddress, Password); if (loginR.Success) { NavigationManager.NavigateTo("/", true); } } #endregion #region Private Method TextEdit_KeyUp /// /// Texts the edit key up using the specified arg (a. beging, 11.04.2022) /// /// The arg private async Task TextEdit_KeyUp(KeyboardEventArgs arg) { if (arg.Key == "Enter") await PerformLogin(); } #endregion } }