mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-05-28 11:42:28 +00:00
Move servers to LBPU.PL.Servers
This commit is contained in:
parent
545b5a0709
commit
b2ec7eae57
116 changed files with 173 additions and 162 deletions
|
@ -1,53 +0,0 @@
|
|||
#nullable enable
|
||||
using JetBrains.Annotations;
|
||||
using LBPUnion.ProjectLighthouse.Helpers;
|
||||
using LBPUnion.ProjectLighthouse.Types;
|
||||
using LBPUnion.ProjectLighthouse.Website.Pages.Layouts;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace LBPUnion.ProjectLighthouse.Website.Pages;
|
||||
|
||||
public class PasswordResetPage : BaseLayout
|
||||
{
|
||||
public PasswordResetPage(Database database) : base(database)
|
||||
{}
|
||||
|
||||
public string? Error { get; private set; }
|
||||
|
||||
[UsedImplicitly]
|
||||
public async Task<IActionResult> OnPost(string password, string confirmPassword)
|
||||
{
|
||||
User? user = this.Database.UserFromWebRequest(this.Request);
|
||||
if (user == null) return this.Redirect("~/login");
|
||||
|
||||
if (string.IsNullOrWhiteSpace(password))
|
||||
{
|
||||
this.Error = "The password field is required.";
|
||||
return this.Page();
|
||||
}
|
||||
|
||||
if (password != confirmPassword)
|
||||
{
|
||||
this.Error = "Passwords do not match!";
|
||||
return this.Page();
|
||||
}
|
||||
|
||||
user.Password = CryptoHelper.BCryptHash(password);
|
||||
user.PasswordResetRequired = false;
|
||||
|
||||
await this.Database.SaveChangesAsync();
|
||||
|
||||
if (!user.EmailAddressVerified) return this.Redirect("~/login/sendVerificationEmail");
|
||||
|
||||
return this.Redirect("~/");
|
||||
}
|
||||
|
||||
[UsedImplicitly]
|
||||
public IActionResult OnGet()
|
||||
{
|
||||
User? user = this.Database.UserFromWebRequest(this.Request);
|
||||
if (user == null) return this.Redirect("~/login");
|
||||
|
||||
return this.Page();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue