Fix bug in user redirection middleware

This commit is contained in:
Slendy 2022-09-20 15:31:48 -05:00
parent 602f0c63d5
commit b7c4f17298
No known key found for this signature in database
GPG key ID: 7288D68361B91428

View file

@ -25,13 +25,19 @@ public class UserRequiredRedirectMiddleware : MiddlewareDBContext
return; return;
} }
if (user.PasswordResetRequired && !ctx.Request.Path.StartsWithSegments("/passwordResetRequired") && if (user.PasswordResetRequired)
{
if (!ctx.Request.Path.StartsWithSegments("/passwordResetRequired") &&
!ctx.Request.Path.StartsWithSegments("/passwordReset")) !ctx.Request.Path.StartsWithSegments("/passwordReset"))
{ {
ctx.Response.Redirect("/passwordResetRequired"); ctx.Response.Redirect("/passwordResetRequired");
return; return;
} }
await this.next(ctx);
return;
}
if (ServerConfiguration.Instance.Mail.MailEnabled) if (ServerConfiguration.Instance.Mail.MailEnabled)
{ {
// The normal flow is for users to set their email during login so just force them to log out // The normal flow is for users to set their email during login so just force them to log out