mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-05-22 17:12:26 +00:00
User settings, level settings, language and timezone selection and more. (#471)
* Initial work for user settings page * Finish user setting and slot setting pages * Don't show slot upload date on home page and fix team pick redirection * Fix upload image button alignment on mobile * Fix image upload on iPhone * Remove unused css and add selected button color * Fix login email check and bump ChromeDriver to 105 * Remove duplicated code and allow users to leave fields empty * Add unpublish button on level settings and move settings button position * Don't show edit button on mini card * Self review bug fixes and users can no longer use an in-use email
This commit is contained in:
parent
9073a8266f
commit
f6a7fe6283
53 changed files with 973 additions and 118 deletions
|
@ -0,0 +1,48 @@
|
|||
using LBPUnion.ProjectLighthouse.Configuration;
|
||||
using LBPUnion.ProjectLighthouse.Middlewares;
|
||||
using LBPUnion.ProjectLighthouse.PlayerData.Profiles;
|
||||
|
||||
namespace LBPUnion.ProjectLighthouse.Servers.Website.Middlewares;
|
||||
|
||||
public class UserRequiredRedirectMiddleware : MiddlewareDBContext
|
||||
{
|
||||
public UserRequiredRedirectMiddleware(RequestDelegate next) : base(next)
|
||||
{ }
|
||||
|
||||
public override async Task InvokeAsync(HttpContext ctx, Database database)
|
||||
{
|
||||
User? user = database.UserFromWebRequest(ctx.Request);
|
||||
if (user == null || ctx.Request.Path.StartsWithSegments("/logout"))
|
||||
{
|
||||
await this.next(ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
if (user.PasswordResetRequired && !ctx.Request.Path.StartsWithSegments("/passwordResetRequired") &&
|
||||
!ctx.Request.Path.StartsWithSegments("/passwordReset"))
|
||||
{
|
||||
ctx.Response.Redirect("/passwordResetRequired");
|
||||
return;
|
||||
}
|
||||
|
||||
if (ServerConfiguration.Instance.Mail.MailEnabled)
|
||||
{
|
||||
// The normal flow is for users to set their email during login so just force them to log out
|
||||
if (user.EmailAddress == null)
|
||||
{
|
||||
ctx.Response.Redirect("/logout");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!user.EmailAddressVerified &&
|
||||
!ctx.Request.Path.StartsWithSegments("/login/sendVerificationEmail") &&
|
||||
!ctx.Request.Path.StartsWithSegments("/verifyEmail"))
|
||||
{
|
||||
ctx.Response.Redirect("/login/sendVerificationEmail");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
await this.next(ctx);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue