mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-07-24 14:11:29 +00:00
Potential fix for 2fa redirect loop
This commit is contained in:
parent
a797b9f07a
commit
082e575f5e
1 changed files with 5 additions and 2 deletions
|
@ -31,9 +31,11 @@ public class TwoFactorLoginPage : BaseLayout
|
|||
User? user = await this.Database.Users.Where(u => u.UserId == token.UserId).FirstOrDefaultAsync();
|
||||
if (user == null) return this.Redirect("~/login");
|
||||
|
||||
if (!user.IsTwoFactorSetup) return this.Redirect(this.RedirectUrl);
|
||||
if (user.IsTwoFactorSetup) return this.Page();
|
||||
|
||||
return this.Page();
|
||||
token.Verified = true;
|
||||
await this.Database.SaveChangesAsync();
|
||||
return this.Redirect(this.RedirectUrl);
|
||||
}
|
||||
|
||||
public async Task<IActionResult> OnPost([FromForm] string? code, [FromForm] string? redirect, [FromForm] string? backup)
|
||||
|
@ -54,6 +56,7 @@ public class TwoFactorLoginPage : BaseLayout
|
|||
{
|
||||
token.Verified = true;
|
||||
await this.Database.SaveChangesAsync();
|
||||
return this.Redirect(this.RedirectUrl);
|
||||
}
|
||||
|
||||
// if both are null or neither are null, there should only be one at at time
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue