Notify user of action happening on button press

This commit is contained in:
2025-05-15 21:01:38 -07:00
parent 5c37017bd5
commit 05e14894ac
3 changed files with 11 additions and 9 deletions
-6
View File
@@ -14,12 +14,6 @@ ProjectMistData.cs
account/resetpassword account/resetpassword
make the account your resetting password for visible in ui make the account your resetting password for visible in ui
Passwords aren't obscured
After sucess and 3 seconds pass, change location to login frame
ForgotPassword
No notice something is happening when button pressed
When the email is sent and waiting on timeout the error is : something went wrong and it should be cannot send email request that quickly
ForgotPassword Email / Resetpassword Email ForgotPassword Email / Resetpassword Email
Needs styles that match the theme of the website Needs styles that match the theme of the website
@@ -34,7 +34,7 @@
} }
public async Task TrySendCode() { public async Task TrySendCode() {
Result = "Waiting on response from server";
HttpResponseMessage TestLogin = await Http.PostAsJsonAsync("api/account/sendresetpassword", new Account(){ Email = Email }); HttpResponseMessage TestLogin = await Http.PostAsJsonAsync("api/account/sendresetpassword", new Account(){ Email = Email });
Result = await TestLogin.Content.ReadAsStringAsync(); Result = await TestLogin.Content.ReadAsStringAsync();
@@ -4,6 +4,7 @@
<form class="center big-frame background-border"> <form class="center big-frame background-border">
<h3>Reset Password</h3> <h3>Reset Password</h3>
<span>User: @UserName</span>
<div class="frame-item"> <div class="frame-item">
<input type="password" placeholder=" " @bind="NewPassword" @onkeyup="OnKeyDown" /> <input type="password" placeholder=" " @bind="NewPassword" @onkeyup="OnKeyDown" />
<label>New Password</label> <label>New Password</label>
@@ -48,10 +49,17 @@
} }
protected async Task TryChange() { 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 }); HttpResponseMessage TestLogin = await Http.PostAsJsonAsync("api/account/resetpassword", new Account(){ UserName = UserName, PasswordHash = NewPassword, Error = ResetPwd });
string result = await TestLogin.Content.ReadAsStringAsync(); string result = await TestLogin.Content.ReadAsStringAsync();
Result = result == "true" ? "Password changed successfully" : "Something is wrong"; bool success = result == "true" ? true : false;
if (success){
Result = "Password changed successfully";
await Task.Delay(2000);
Nav.NavigateTo("/", true);
}else{
Result = "Something is wrong";
}
} }
} }