diff --git a/src/Billing/Models/PayPalIPNTransactionModel.cs b/src/Billing/Models/PayPalIPNTransactionModel.cs index 6fd0dfa0c..30b696d3a 100644 --- a/src/Billing/Models/PayPalIPNTransactionModel.cs +++ b/src/Billing/Models/PayPalIPNTransactionModel.cs @@ -82,11 +82,9 @@ public class PayPalIPNTransactionModel IsAccountCredit = custom.Contains("account_credit:1"); } - private static string Extract(IReadOnlyDictionary data, string key) - { - var success = data.TryGetValue(key, out var value); - return success ? value : null; - } + private static string Extract(IReadOnlyDictionary data, string key) => + data.TryGetValue(key, out var value) ? value : null; + private static DateTime ToUTCDateTime(string input) { diff --git a/src/Identity/Controllers/AccountsController.cs b/src/Identity/Controllers/AccountsController.cs index c3cad4a4a..18c2b418c 100644 --- a/src/Identity/Controllers/AccountsController.cs +++ b/src/Identity/Controllers/AccountsController.cs @@ -31,8 +31,7 @@ namespace Bit.Identity.Controllers; [ExceptionHandlerFilter] public class AccountsController : Controller { - private readonly ICurrentContext _currentContext; - private readonly ILogger _logger; + private readonly ICurrentContext _currentContext; private readonly IUserRepository _userRepository; private readonly IRegisterUserCommand _registerUserCommand; private readonly ICaptchaValidationService _captchaValidationService; @@ -44,8 +43,7 @@ public class AccountsController : Controller private readonly IDataProtectorTokenFactory _registrationEmailVerificationTokenDataFactory; public AccountsController( - ICurrentContext currentContext, - ILogger logger, + ICurrentContext currentContext, IUserRepository userRepository, IRegisterUserCommand registerUserCommand, ICaptchaValidationService captchaValidationService, @@ -57,8 +55,7 @@ public class AccountsController : Controller IDataProtectorTokenFactory registrationEmailVerificationTokenDataFactory ) { - _currentContext = currentContext; - _logger = logger; + _currentContext = currentContext; _userRepository = userRepository; _registerUserCommand = registerUserCommand; _captchaValidationService = captchaValidationService; diff --git a/src/Identity/Models/Request/Accounts/RegisterRequestModel.cs b/src/Identity/Models/Request/Accounts/RegisterRequestModel.cs index 8f3cefcfc..79d246a68 100644 --- a/src/Identity/Models/Request/Accounts/RegisterRequestModel.cs +++ b/src/Identity/Models/Request/Accounts/RegisterRequestModel.cs @@ -41,25 +41,13 @@ public class RegisterRequestModel : IValidatableObject, ICaptchaProtectedModel Email = Email, MasterPasswordHint = MasterPasswordHint, Kdf = Kdf.GetValueOrDefault(KdfType.PBKDF2_SHA256), - KdfIterations = KdfIterations.GetValueOrDefault(AuthConstants.PBKDF2_ITERATIONS.Default), + KdfIterations = KdfIterations ?? AuthConstants.PBKDF2_ITERATIONS.Default, KdfMemory = KdfMemory, - KdfParallelism = KdfParallelism + KdfParallelism = KdfParallelism, + ReferenceData = ReferenceData != null ? JsonSerializer.Serialize(ReferenceData) : null, + Key = Key }; - - if (ReferenceData != null) - { - user.ReferenceData = JsonSerializer.Serialize(ReferenceData); - } - - if (Key != null) - { - user.Key = Key; - } - - if (Keys != null) - { - Keys.ToUser(user); - } + Keys?.ToUser(user); return user; }