1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-17 00:03:17 -05:00
This commit is contained in:
Todd Martin 2025-06-13 17:01:56 -04:00
parent a08f7c5c7b
commit 87d008b08f
No known key found for this signature in database
GPG Key ID: 663E7AF5C839BC8F
6 changed files with 9 additions and 10 deletions

View File

@ -15,7 +15,6 @@ using Bit.Core.Repositories;
using Bit.Core.Services; using Bit.Core.Services;
using Bit.Core.Tokens; using Bit.Core.Tokens;
using Bit.Core.Utilities; using Bit.Core.Utilities;
using Core.Auth.Enums;
using Fido2NetLib; using Fido2NetLib;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity;

View File

@ -1,8 +1,8 @@
namespace Core.Auth.Enums; namespace Core.Auth.Enums;
public enum TwoFactorEmailPurpose public enum TwoFactorEmailPurpose
{ {
Login, Login,
Setup, Setup,
NewDeviceVerification, NewDeviceVerification,
} }

View File

@ -1,4 +1,4 @@
using Bit.Core.Entities; using Bit.Core.Entities;
namespace Bit.Core.Auth.Services; namespace Bit.Core.Auth.Services;
@ -8,4 +8,4 @@ public interface ITwoFactorEmailService
Task SendTwoFactorSetupEmailAsync(User user); Task SendTwoFactorSetupEmailAsync(User user);
Task SendNewDeviceVerificationEmailAsync(User user); Task SendNewDeviceVerificationEmailAsync(User user);
Task<bool> VerifyTwoFactorEmailAsync(User user, string token); Task<bool> VerifyTwoFactorEmailAsync(User user, string token);
} }

View File

@ -1,4 +1,4 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.Reflection; using System.Reflection;
using Bit.Core.Auth.Enums; using Bit.Core.Auth.Enums;
using Bit.Core.Context; using Bit.Core.Context;
@ -91,4 +91,4 @@ public class TwoFactorEmailService : ITwoFactorEmailService
return await _userManager.VerifyTwoFactorTokenAsync(user, return await _userManager.VerifyTwoFactorTokenAsync(user,
CoreHelpers.CustomProviderName(TwoFactorProviderType.Email), token); CoreHelpers.CustomProviderName(TwoFactorProviderType.Email), token);
} }
} }

View File

@ -185,7 +185,7 @@ public class HandlebarsMailService : IMailService
SiteName = _globalSettings.SiteName, SiteName = _globalSettings.SiteName,
// We only want to remind users to set up 2FA if they're getting a new device verification email. // We only want to remind users to set up 2FA if they're getting a new device verification email.
// For login with 2FA, and setup of 2FA, we do not want to show the reminder because users are already doing so. // For login with 2FA, and setup of 2FA, we do not want to show the reminder because users are already doing so.
DisplayTwoFactorReminder = purpose == TwoFactorEmailPurpose.NewDeviceVerification DisplayTwoFactorReminder = purpose == TwoFactorEmailPurpose.NewDeviceVerification
}; };
await AddMessageContentAsync(message, "Auth.TwoFactorEmail", model); await AddMessageContentAsync(message, "Auth.TwoFactorEmail", model);
message.MetaData.Add("SendGridBypassListManagement", true); message.MetaData.Add("SendGridBypassListManagement", true);

View File

@ -1,4 +1,4 @@
using Bit.Core.Auth.Enums; using Bit.Core.Auth.Enums;
using Bit.Core.Auth.Models; using Bit.Core.Auth.Models;
using Bit.Core.Auth.Services; using Bit.Core.Auth.Services;
using Bit.Core.Context; using Bit.Core.Context;
@ -207,4 +207,4 @@ public class TwoFactorEmailServiceTests
// .SendTwoFactorEmailAsync(Arg.Any<string>(), Arg.Any<string>(), Arg.Any<string>(), Arg.Any<string>(), Arg.Any<string>(), Arg.Any<bool>()); // .SendTwoFactorEmailAsync(Arg.Any<string>(), Arg.Any<string>(), Arg.Any<string>(), Arg.Any<string>(), Arg.Any<string>(), Arg.Any<bool>());
// } // }
} }