|
|
@ -10,8 +10,10 @@ namespace Biskilog_Accounting.Client.Pages.Auth |
|
|
|
public partial class Login |
|
|
|
{ |
|
|
|
private string m_email, m_password; |
|
|
|
private bool showUsernameError, showPasswordError; |
|
|
|
private bool m_remember { get; set; } |
|
|
|
protected bool IsVisible { get; set; } |
|
|
|
|
|
|
|
//NotificationMessage notificationMessage = new NotificationMessage();
|
|
|
|
private Userauth authenticatedUser; |
|
|
|
/// <summary>
|
|
|
@ -45,14 +47,23 @@ namespace Biskilog_Accounting.Client.Pages.Auth |
|
|
|
var responseMain = await m_http.PostAsJsonAsync("api/authentication/type-a", authenticatedUser); |
|
|
|
if (responseMain.IsSuccessStatusCode) |
|
|
|
{ |
|
|
|
string token = await responseMain.Content.ReadAsStringAsync(); |
|
|
|
await m_tokenService.SetToken(token, m_remember); |
|
|
|
showUsernameError = string.IsNullOrEmpty(m_email); |
|
|
|
showPasswordError = string.IsNullOrEmpty(m_password); |
|
|
|
|
|
|
|
if(!showUsernameError && !showPasswordError) |
|
|
|
{ |
|
|
|
string token = await responseMain.Content.ReadAsStringAsync(); |
|
|
|
await m_tokenService.SetToken(token, m_remember); |
|
|
|
|
|
|
|
var authHeader = new AuthenticationHeaderValue("Bearer", token); |
|
|
|
m_http.DefaultRequestHeaders.Authorization = authHeader; |
|
|
|
var authHeader = new AuthenticationHeaderValue("Bearer", token); |
|
|
|
m_http.DefaultRequestHeaders.Authorization = authHeader; |
|
|
|
|
|
|
|
m_navigationManager.NavigateTo("/"); |
|
|
|
} |
|
|
|
|
|
|
|
m_navigationManager.NavigateTo("/"); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
else if (responseMain.StatusCode == System.Net.HttpStatusCode.BadRequest) |
|
|
|
{ |
|
|
|
} |
|
|
@ -108,5 +119,7 @@ namespace Biskilog_Accounting.Client.Pages.Auth |
|
|
|
m_password = value; |
|
|
|
StateHasChanged(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |