1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-21 12:05:42 +01:00

Improved code readability

This commit is contained in:
Sala-Sergiu 2024-08-01 18:07:34 +03:00
parent f5c771a057
commit bc7546ddaa
3 changed files with 11 additions and 28 deletions

View File

@ -82,11 +82,9 @@ public class PayPalIPNTransactionModel
IsAccountCredit = custom.Contains("account_credit:1");
}
private static string Extract(IReadOnlyDictionary<string, string> data, string key)
{
var success = data.TryGetValue(key, out var value);
return success ? value : null;
}
private static string Extract(IReadOnlyDictionary<string, string> data, string key) =>
data.TryGetValue(key, out var value) ? value : null;
private static DateTime ToUTCDateTime(string input)
{

View File

@ -32,7 +32,6 @@ namespace Bit.Identity.Controllers;
public class AccountsController : Controller
{
private readonly ICurrentContext _currentContext;
private readonly ILogger<AccountsController> _logger;
private readonly IUserRepository _userRepository;
private readonly IRegisterUserCommand _registerUserCommand;
private readonly ICaptchaValidationService _captchaValidationService;
@ -45,7 +44,6 @@ public class AccountsController : Controller
public AccountsController(
ICurrentContext currentContext,
ILogger<AccountsController> logger,
IUserRepository userRepository,
IRegisterUserCommand registerUserCommand,
ICaptchaValidationService captchaValidationService,
@ -58,7 +56,6 @@ public class AccountsController : Controller
)
{
_currentContext = currentContext;
_logger = logger;
_userRepository = userRepository;
_registerUserCommand = registerUserCommand;
_captchaValidationService = captchaValidationService;

View File

@ -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;
}