WIP: Added validation to login form #9
Open
collins
wants to merge 4 commits from BISKI2023-18
into dev
7 changed files with 72 additions and 26 deletions
@ -10,8 +10,11 @@ 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; } |
|||
public bool validStatus = false; |
|||
barhen
commented 2 years ago
Review
@collins please start public variables with capital letters |
|||
|
|||
//NotificationMessage notificationMessage = new NotificationMessage();
|
|||
private Userauth authenticatedUser; |
|||
/// <summary>
|
|||
@ -45,6 +48,9 @@ namespace Biskilog_Accounting.Client.Pages.Auth |
|||
var responseMain = await m_http.PostAsJsonAsync("api/authentication/type-a", authenticatedUser); |
|||
if (responseMain.IsSuccessStatusCode) |
|||
{ |
|||
|
|||
validStatus = true; |
|||
|
|||
string token = await responseMain.Content.ReadAsStringAsync(); |
|||
await m_tokenService.SetToken(token, m_remember); |
|||
|
|||
@ -52,12 +58,16 @@ namespace Biskilog_Accounting.Client.Pages.Auth |
|||
m_http.DefaultRequestHeaders.Authorization = authHeader; |
|||
|
|||
m_navigationManager.NavigateTo("/"); |
|||
|
|||
|
|||
} |
|||
|
|||
|
|||
else if (responseMain.StatusCode == System.Net.HttpStatusCode.BadRequest) |
|||
{ |
|||
} |
|||
} |
|||
catch (Exception ex) |
|||
catch (Exception ex) |
|||
{ |
|||
Console.WriteLine(ex.ToString()); |
|||
} |
|||
@ -108,5 +118,18 @@ namespace Biskilog_Accounting.Client.Pages.Auth |
|||
m_password = value; |
|||
StateHasChanged(); |
|||
} |
|||
|
|||
public string errormeaasge(string message) |
|||
{ |
|||
showPasswordError = string.IsNullOrEmpty(m_email); |
|||
showUsernameError = string.IsNullOrEmpty(m_password); |
|||
|
|||
if (showUsernameError && showPasswordError) |
|||
{ |
|||
message = ""; |
|||
} |
|||
return message; |
|||
|
|||
} |
|||
} |
|||
} |
@ -1,44 +1,44 @@ |
|||
{ |
|||
"iisExpress": { |
|||
"applicationUrl": "http://localhost:24369", |
|||
"sslPort": 44366 |
|||
}, |
|||
"iisSettings": { |
|||
"windowsAuthentication": false, |
|||
"anonymousAuthentication": true, |
|||
"iisExpress": { |
|||
"applicationUrl": "http://localhost:54487/", |
|||
"sslPort": 44383 |
|||
} |
|||
}, |
|||
"profiles": { |
|||
"http": { |
|||
"commandName": "Project", |
|||
"launchBrowser": true, |
|||
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", |
|||
"applicationUrl": "http://localhost:5136", |
|||
"environmentVariables": { |
|||
"ASPNETCORE_ENVIRONMENT": "Development" |
|||
}, |
|||
"dotnetRunMessages": true, |
|||
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", |
|||
"applicationUrl": "http://localhost:5136" |
|||
"dotnetRunMessages": true |
|||
}, |
|||
"https": { |
|||
"commandName": "Project", |
|||
"launchBrowser": true, |
|||
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", |
|||
"applicationUrl": "https://localhost:7247;http://localhost:5136", |
|||
"environmentVariables": { |
|||
"ASPNETCORE_ENVIRONMENT": "Development" |
|||
}, |
|||
"dotnetRunMessages": true, |
|||
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", |
|||
"applicationUrl": "https://localhost:7247;http://localhost:5136" |
|||
"dotnetRunMessages": true |
|||
}, |
|||
"IIS Express": { |
|||
"commandName": "IISExpress", |
|||
"launchBrowser": true, |
|||
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", |
|||
"environmentVariables": { |
|||
"ASPNETCORE_ENVIRONMENT": "Development" |
|||
}, |
|||
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}" |
|||
} |
|||
}, |
|||
"iisExpress": { |
|||
"applicationUrl": "http://localhost:24369", |
|||
"sslPort": 44366 |
|||
}, |
|||
"iisSettings": { |
|||
"windowsAuthentication": false, |
|||
"anonymousAuthentication": true, |
|||
"iisExpress": { |
|||
"applicationUrl": "http://localhost:54487/", |
|||
"sslPort": 44383 |
|||
} |
|||
} |
|||
} |
|||
} |
Loading…
Reference in new issue
please use m_variableName when creating member variables