diff --git a/ProjectLighthouse/Pages/PasswordResetPage.cshtml b/ProjectLighthouse/Pages/PasswordResetPage.cshtml
new file mode 100644
index 00000000..e069274e
--- /dev/null
+++ b/ProjectLighthouse/Pages/PasswordResetPage.cshtml
@@ -0,0 +1,36 @@
+@page "/passwordReset"
+@model LBPUnion.ProjectLighthouse.Pages.PasswordResetPage
+
+@{
+ Layout = "Layouts/BaseLayout";
+}
+
+
+
+
+
+
Password Reset
+
+
\ No newline at end of file
diff --git a/ProjectLighthouse/Pages/PasswordResetPage.cshtml.cs b/ProjectLighthouse/Pages/PasswordResetPage.cshtml.cs
new file mode 100644
index 00000000..e0c473d3
--- /dev/null
+++ b/ProjectLighthouse/Pages/PasswordResetPage.cshtml.cs
@@ -0,0 +1,38 @@
+#nullable enable
+using System.Threading.Tasks;
+using LBPUnion.ProjectLighthouse.Helpers;
+using LBPUnion.ProjectLighthouse.Pages.Layouts;
+using LBPUnion.ProjectLighthouse.Types;
+using Microsoft.AspNetCore.Mvc;
+
+namespace LBPUnion.ProjectLighthouse.Pages
+{
+ public class PasswordResetPage : BaseLayout
+ {
+ public PasswordResetPage(Database database) : base(database)
+ {}
+
+ public bool WasResetRequest { get; private set; }
+ public async Task OnGet([FromQuery] string password, [FromQuery] string confirmPassword)
+ {
+ User? user = this.Database.UserFromWebRequest(this.Request);
+ if (user == null) return this.Redirect("~/login");
+
+ this.WasResetRequest = !string.IsNullOrEmpty(password) && !string.IsNullOrEmpty(confirmPassword);
+
+ if (this.WasResetRequest)
+ {
+ if (password != confirmPassword) return this.BadRequest();
+
+ user.Password = HashHelper.BCryptHash(password);
+ user.PasswordResetRequired = false;
+
+ await this.Database.SaveChangesAsync();
+
+ return this.Redirect("~/");
+ }
+
+ return this.Page();
+ }
+ }
+}
\ No newline at end of file
diff --git a/ProjectLighthouse/Pages/PasswordResetRequiredPage.cshtml b/ProjectLighthouse/Pages/PasswordResetRequiredPage.cshtml
index d0df1c4f..5dc62ef7 100644
--- a/ProjectLighthouse/Pages/PasswordResetRequiredPage.cshtml
+++ b/ProjectLighthouse/Pages/PasswordResetRequiredPage.cshtml
@@ -5,33 +5,9 @@
Layout = "Layouts/BaseLayout";
}
-
-
-
-
Password Reset Required
An admin has deemed it necessary that you reset your password. Please do so.
-
\ No newline at end of file
+
+ Reset Password
+
\ No newline at end of file
diff --git a/ProjectLighthouse/Pages/PasswordResetRequiredPage.cshtml.cs b/ProjectLighthouse/Pages/PasswordResetRequiredPage.cshtml.cs
index 803d2405..55c07595 100644
--- a/ProjectLighthouse/Pages/PasswordResetRequiredPage.cshtml.cs
+++ b/ProjectLighthouse/Pages/PasswordResetRequiredPage.cshtml.cs
@@ -1,7 +1,6 @@
#nullable enable
using System.Threading.Tasks;
using JetBrains.Annotations;
-using LBPUnion.ProjectLighthouse.Helpers;
using LBPUnion.ProjectLighthouse.Pages.Layouts;
using LBPUnion.ProjectLighthouse.Types;
using Microsoft.AspNetCore.Mvc;
@@ -15,25 +14,11 @@ namespace LBPUnion.ProjectLighthouse.Pages
public bool WasResetRequest { get; private set; }
- public async Task OnGet([FromQuery] string password, [FromQuery] string confirmPassword)
+ public async Task OnGet()
{
User? user = this.Database.UserFromWebRequest(this.Request);
if (user == null) return this.Redirect("~/login");
- if (!user.PasswordResetRequired) return this.Redirect("~/resetPassword");
-
- this.WasResetRequest = !string.IsNullOrEmpty(password) && !string.IsNullOrEmpty(confirmPassword);
-
- if (this.WasResetRequest)
- {
- if (password != confirmPassword) return this.BadRequest();
-
- user.Password = HashHelper.BCryptHash(password);
- user.PasswordResetRequired = false;
-
- await this.Database.SaveChangesAsync();
-
- return this.Redirect("~/");
- }
+ if (!user.PasswordResetRequired) return this.Redirect("~/passwordReset");
return this.Page();
}
diff --git a/ProjectLighthouse/Pages/UserPage.cshtml b/ProjectLighthouse/Pages/UserPage.cshtml
index 15af68f3..1fc50e7f 100644
--- a/ProjectLighthouse/Pages/UserPage.cshtml
+++ b/ProjectLighthouse/Pages/UserPage.cshtml
@@ -40,6 +40,13 @@
}
}
+ @if (Model.ProfileUser == Model.User)
+ {
+
+
+ Reset Password
+
+ }