|
|
@ -13,6 +13,7 @@ namespace Biskilog_Accounting.Client.Pages.Auth |
|
|
|
private bool showUsernameError, showPasswordError; |
|
|
|
private bool m_remember { get; set; } |
|
|
|
protected bool IsVisible { get; set; } |
|
|
|
public bool validStatus = false; |
|
|
|
|
|
|
|
//NotificationMessage notificationMessage = new NotificationMessage();
|
|
|
|
private Userauth authenticatedUser; |
|
|
@ -47,19 +48,17 @@ namespace Biskilog_Accounting.Client.Pages.Auth |
|
|
|
var responseMain = await m_http.PostAsJsonAsync("api/authentication/type-a", authenticatedUser); |
|
|
|
if (responseMain.IsSuccessStatusCode) |
|
|
|
{ |
|
|
|
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); |
|
|
|
validStatus = true; |
|
|
|
|
|
|
|
var authHeader = new AuthenticationHeaderValue("Bearer", token); |
|
|
|
m_http.DefaultRequestHeaders.Authorization = authHeader; |
|
|
|
string token = await responseMain.Content.ReadAsStringAsync(); |
|
|
|
await m_tokenService.SetToken(token, m_remember); |
|
|
|
|
|
|
|
var authHeader = new AuthenticationHeaderValue("Bearer", token); |
|
|
|
m_http.DefaultRequestHeaders.Authorization = authHeader; |
|
|
|
|
|
|
|
m_navigationManager.NavigateTo("/"); |
|
|
|
|
|
|
|
m_navigationManager.NavigateTo("/"); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
@ -120,6 +119,17 @@ namespace Biskilog_Accounting.Client.Pages.Auth |
|
|
|
StateHasChanged(); |
|
|
|
} |
|
|
|
|
|
|
|
public string errormeaasge(string message) |
|
|
|
{ |
|
|
|
showPasswordError = string.IsNullOrEmpty(m_email); |
|
|
|
showUsernameError = string.IsNullOrEmpty(m_password); |
|
|
|
|
|
|
|
if (showUsernameError && showPasswordError) |
|
|
|
{ |
|
|
|
message = ""; |
|
|
|
} |
|
|
|
return message; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |