mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-10-06 16:19:58 +00:00
Rework the flow of setting email from the website
This commit is contained in:
parent
3f70563e1d
commit
cf1769ca77
8 changed files with 47 additions and 94 deletions
|
@ -58,15 +58,20 @@ public class UserRequiredRedirectMiddleware : MiddlewareDBContext
|
|||
return;
|
||||
}
|
||||
|
||||
if (!user.EmailAddressVerified && ServerConfiguration.Instance.Mail.MailEnabled)
|
||||
if (user.EmailAddress == null && 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)
|
||||
if (!pathContains(ctx, "/login/setEmail"))
|
||||
{
|
||||
ctx.Response.Redirect("/logout");
|
||||
ctx.Response.Redirect("/login/setEmail");
|
||||
return;
|
||||
}
|
||||
|
||||
await this.next(ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!user.EmailAddressVerified && ServerConfiguration.Instance.Mail.MailEnabled)
|
||||
{
|
||||
if (!pathContains(ctx, "/login/sendVerificationEmail", "/verifyEmail"))
|
||||
{
|
||||
ctx.Response.Redirect("/login/sendVerificationEmail");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue