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 |
public partial class Login |
||||
{ |
{ |
||||
private string m_email, m_password; |
private string m_email, m_password; |
||||
|
private bool showUsernameError, showPasswordError; |
||||
|
|||||
private bool m_remember { get; set; } |
private bool m_remember { get; set; } |
||||
protected bool IsVisible { 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();
|
//NotificationMessage notificationMessage = new NotificationMessage();
|
||||
private Userauth authenticatedUser; |
private Userauth authenticatedUser; |
||||
/// <summary>
|
/// <summary>
|
||||
@ -45,6 +48,9 @@ namespace Biskilog_Accounting.Client.Pages.Auth |
|||||
var responseMain = await m_http.PostAsJsonAsync("api/authentication/type-a", authenticatedUser); |
var responseMain = await m_http.PostAsJsonAsync("api/authentication/type-a", authenticatedUser); |
||||
if (responseMain.IsSuccessStatusCode) |
if (responseMain.IsSuccessStatusCode) |
||||
{ |
{ |
||||
|
|
||||
|
validStatus = true; |
||||
|
|
||||
string token = await responseMain.Content.ReadAsStringAsync(); |
string token = await responseMain.Content.ReadAsStringAsync(); |
||||
await m_tokenService.SetToken(token, m_remember); |
await m_tokenService.SetToken(token, m_remember); |
||||
|
|
||||
@ -52,12 +58,16 @@ namespace Biskilog_Accounting.Client.Pages.Auth |
|||||
m_http.DefaultRequestHeaders.Authorization = authHeader; |
m_http.DefaultRequestHeaders.Authorization = authHeader; |
||||
|
|
||||
m_navigationManager.NavigateTo("/"); |
m_navigationManager.NavigateTo("/"); |
||||
|
|
||||
|
|
||||
} |
} |
||||
|
|
||||
|
|
||||
else if (responseMain.StatusCode == System.Net.HttpStatusCode.BadRequest) |
else if (responseMain.StatusCode == System.Net.HttpStatusCode.BadRequest) |
||||
{ |
{ |
||||
} |
} |
||||
} |
} |
||||
catch (Exception ex) |
catch (Exception ex) |
||||
{ |
{ |
||||
Console.WriteLine(ex.ToString()); |
Console.WriteLine(ex.ToString()); |
||||
} |
} |
||||
@ -108,5 +118,18 @@ namespace Biskilog_Accounting.Client.Pages.Auth |
|||||
m_password = value; |
m_password = value; |
||||
StateHasChanged(); |
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": { |
"profiles": { |
||||
"http": { |
"http": { |
||||
"commandName": "Project", |
"commandName": "Project", |
||||
"launchBrowser": true, |
"launchBrowser": true, |
||||
|
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", |
||||
|
"applicationUrl": "http://localhost:5136", |
||||
"environmentVariables": { |
"environmentVariables": { |
||||
"ASPNETCORE_ENVIRONMENT": "Development" |
"ASPNETCORE_ENVIRONMENT": "Development" |
||||
}, |
}, |
||||
"dotnetRunMessages": true, |
"dotnetRunMessages": true |
||||
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", |
|
||||
"applicationUrl": "http://localhost:5136" |
|
||||
}, |
}, |
||||
"https": { |
"https": { |
||||
"commandName": "Project", |
"commandName": "Project", |
||||
"launchBrowser": true, |
"launchBrowser": true, |
||||
|
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", |
||||
|
"applicationUrl": "https://localhost:7247;http://localhost:5136", |
||||
"environmentVariables": { |
"environmentVariables": { |
||||
"ASPNETCORE_ENVIRONMENT": "Development" |
"ASPNETCORE_ENVIRONMENT": "Development" |
||||
}, |
}, |
||||
"dotnetRunMessages": true, |
"dotnetRunMessages": true |
||||
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", |
|
||||
"applicationUrl": "https://localhost:7247;http://localhost:5136" |
|
||||
}, |
}, |
||||
"IIS Express": { |
"IIS Express": { |
||||
"commandName": "IISExpress", |
"commandName": "IISExpress", |
||||
"launchBrowser": true, |
"launchBrowser": true, |
||||
|
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", |
||||
"environmentVariables": { |
"environmentVariables": { |
||||
"ASPNETCORE_ENVIRONMENT": "Development" |
"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