Skip to content

Commit

Permalink
Merge pull request #4948 from zyhfish/task/fix-4947
Browse files Browse the repository at this point in the history
Fix #4947: check the 2FA settings.
  • Loading branch information
sbwalker authored Dec 24, 2024
2 parents 9bfaa02 + af7b4db commit d19d7d2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Oqtane.Server/Managers/UserManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,10 @@ public User VerifyTwoFactor(User user, string token)
user = _users.GetUser(user.Username);
if (user != null)
{
if (user.TwoFactorRequired && user.TwoFactorCode == token && DateTime.UtcNow < user.TwoFactorExpiry)
var alias = _tenantManager.GetAlias();
var twoFactorSetting = _settings.GetSetting(EntityNames.Site, alias.SiteId, "LoginOptions:TwoFactor")?.SettingValue ?? "false";
var twoFactorRequired = twoFactorSetting == "required" || user.TwoFactorRequired;
if (twoFactorRequired && user.TwoFactorCode == token && DateTime.UtcNow < user.TwoFactorExpiry)
{
user.IsAuthenticated = true;
}
Expand Down

0 comments on commit d19d7d2

Please sign in to comment.