mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-05-12 21:02:27 +00:00
Refactor Database into DatabaseContext Moved into separate folder so it actually has a namespace instead sitting in the root
31 lines
No EOL
1,003 B
C#
31 lines
No EOL
1,003 B
C#
#nullable enable
|
|
using LBPUnion.ProjectLighthouse.Configuration;
|
|
using LBPUnion.ProjectLighthouse.Database;
|
|
using LBPUnion.ProjectLighthouse.Helpers;
|
|
using LBPUnion.ProjectLighthouse.Servers.Website.Pages.Layouts;
|
|
using LBPUnion.ProjectLighthouse.Types.Entities.Profile;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace LBPUnion.ProjectLighthouse.Servers.Website.Pages.Email;
|
|
|
|
public class SendVerificationEmailPage : BaseLayout
|
|
{
|
|
public SendVerificationEmailPage(DatabaseContext database) : base(database)
|
|
{}
|
|
|
|
public bool Success { get; set; }
|
|
|
|
public async Task<IActionResult> OnGet()
|
|
{
|
|
if (!ServerConfiguration.Instance.Mail.MailEnabled) return this.NotFound();
|
|
|
|
User? user = this.Database.UserFromWebRequest(this.Request);
|
|
if (user == null) return this.Redirect("/login");
|
|
|
|
if (user.EmailAddressVerified) return this.Redirect("/");
|
|
|
|
this.Success = await SMTPHelper.SendVerificationEmail(this.Database, user);
|
|
|
|
return this.Page();
|
|
}
|
|
} |