From 4db77ab78d9d59f3a709d867f797bac0b030a338 Mon Sep 17 00:00:00 2001 From: Derek Holloway Date: Thu, 15 May 2025 21:16:52 -0700 Subject: [PATCH] fix fields not found in forms --- ToDo.txt | 3 --- .../Pages/Account/ActivityPages/Login.razor | 4 +-- .../Account/ActivityPages/Register.razor | 6 ++--- .../Account/ActivityPages/ResetPassword.razor | 26 ++++++++++++------- 4 files changed, 22 insertions(+), 17 deletions(-) diff --git a/ToDo.txt b/ToDo.txt index 3d24646..acb0021 100755 --- a/ToDo.txt +++ b/ToDo.txt @@ -12,8 +12,5 @@ AccountInventory.cs ProjectMistData.cs Data inside the sql doesnt match what is inside the database -account/resetpassword - make the account your resetting password for visible in ui - ForgotPassword Email / Resetpassword Email Needs styles that match the theme of the website \ No newline at end of file diff --git a/src/MistoxWebsite.Client/Pages/Account/ActivityPages/Login.razor b/src/MistoxWebsite.Client/Pages/Account/ActivityPages/Login.razor index ffda1eb..9d32bb4 100755 --- a/src/MistoxWebsite.Client/Pages/Account/ActivityPages/Login.razor +++ b/src/MistoxWebsite.Client/Pages/Account/ActivityPages/Login.razor @@ -55,8 +55,8 @@ ReturnURL = string.IsNullOrEmpty(ReturnURL) ? "/" : ReturnURL; ErrorMsgs = new List(); - if(UserName != null ) { - if(Password != null ) { + if( !string.IsNullOrEmpty(UserName) ) { + if( !string.IsNullOrEmpty(Password) ) { if (Password.Length >= 6 ) { HttpResponseMessage TestLogin = await Http.PostAsJsonAsync("api/account/login", new MistoxWebsite.Shared.Account(){ UserName = UserName, PasswordHash = Password, EmailVerified = StayLoggedIn }); string result = await TestLogin.Content.ReadAsStringAsync(); diff --git a/src/MistoxWebsite.Client/Pages/Account/ActivityPages/Register.razor b/src/MistoxWebsite.Client/Pages/Account/ActivityPages/Register.razor index 9b78446..48dc4bd 100755 --- a/src/MistoxWebsite.Client/Pages/Account/ActivityPages/Register.razor +++ b/src/MistoxWebsite.Client/Pages/Account/ActivityPages/Register.razor @@ -75,10 +75,10 @@ ErrorMsgs = new List(); - if (Email != null){ + if ( !string.IsNullOrEmpty(Email) ){ if( CheckEmail( Email ) ) { - if(UserName != null ) { - if(Password != null ) { + if( !string.IsNullOrEmpty(UserName) ) { + if( !string.IsNullOrEmpty(Password) ) { if (Password.Length >= 6 ) { HttpResponseMessage TestRegister = await Http.PostAsJsonAsync("api/account/register", new Account(){ UserName = UserName, diff --git a/src/MistoxWebsite.Client/Pages/Account/ActivityPages/ResetPassword.razor b/src/MistoxWebsite.Client/Pages/Account/ActivityPages/ResetPassword.razor index 80beacd..eee74bf 100755 --- a/src/MistoxWebsite.Client/Pages/Account/ActivityPages/ResetPassword.razor +++ b/src/MistoxWebsite.Client/Pages/Account/ActivityPages/ResetPassword.razor @@ -4,7 +4,7 @@

Reset Password

- User: @UserName +

User: @UserName

@@ -50,15 +50,23 @@ protected async Task TryChange() { Result = "Waiting on response from server"; - HttpResponseMessage TestLogin = await Http.PostAsJsonAsync("api/account/resetpassword", new Account(){ UserName = UserName, PasswordHash = NewPassword, Error = ResetPwd }); - string result = await TestLogin.Content.ReadAsStringAsync(); - bool success = result == "true" ? true : false; - if (success){ - Result = "Password changed successfully"; - await Task.Delay(2000); - Nav.NavigateTo("/", true); + if (NewPassword.Length >= 6){ + if (NewPassword != RepeatPassword){ + HttpResponseMessage TestLogin = await Http.PostAsJsonAsync("api/account/resetpassword", new Account(){ UserName = UserName, PasswordHash = NewPassword, Error = ResetPwd }); + string result = await TestLogin.Content.ReadAsStringAsync(); + bool success = result == "true" ? true : false; + if (success){ + Result = "Password changed successfully"; + await Task.Delay(2000); + Nav.NavigateTo("/", true); + }else{ + Result = "Something is wrong"; + } + }else{ + Result = "Passwords must match"; + } }else{ - Result = "Something is wrong"; + Result = "Password must be at least 6 Characters long"; } }