mirror of
https://github.com/bitwarden/server.git
synced 2024-11-24 12:35:25 +01:00
Improved code readability
This commit is contained in:
parent
f5c771a057
commit
bc7546ddaa
@ -82,11 +82,9 @@ public class PayPalIPNTransactionModel
|
|||||||
IsAccountCredit = custom.Contains("account_credit:1");
|
IsAccountCredit = custom.Contains("account_credit:1");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string Extract(IReadOnlyDictionary<string, string> data, string key)
|
private static string Extract(IReadOnlyDictionary<string, string> data, string key) =>
|
||||||
{
|
data.TryGetValue(key, out var value) ? value : null;
|
||||||
var success = data.TryGetValue(key, out var value);
|
|
||||||
return success ? value : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static DateTime ToUTCDateTime(string input)
|
private static DateTime ToUTCDateTime(string input)
|
||||||
{
|
{
|
||||||
|
@ -31,8 +31,7 @@ namespace Bit.Identity.Controllers;
|
|||||||
[ExceptionHandlerFilter]
|
[ExceptionHandlerFilter]
|
||||||
public class AccountsController : Controller
|
public class AccountsController : Controller
|
||||||
{
|
{
|
||||||
private readonly ICurrentContext _currentContext;
|
private readonly ICurrentContext _currentContext;
|
||||||
private readonly ILogger<AccountsController> _logger;
|
|
||||||
private readonly IUserRepository _userRepository;
|
private readonly IUserRepository _userRepository;
|
||||||
private readonly IRegisterUserCommand _registerUserCommand;
|
private readonly IRegisterUserCommand _registerUserCommand;
|
||||||
private readonly ICaptchaValidationService _captchaValidationService;
|
private readonly ICaptchaValidationService _captchaValidationService;
|
||||||
@ -44,8 +43,7 @@ public class AccountsController : Controller
|
|||||||
private readonly IDataProtectorTokenFactory<RegistrationEmailVerificationTokenable> _registrationEmailVerificationTokenDataFactory;
|
private readonly IDataProtectorTokenFactory<RegistrationEmailVerificationTokenable> _registrationEmailVerificationTokenDataFactory;
|
||||||
|
|
||||||
public AccountsController(
|
public AccountsController(
|
||||||
ICurrentContext currentContext,
|
ICurrentContext currentContext,
|
||||||
ILogger<AccountsController> logger,
|
|
||||||
IUserRepository userRepository,
|
IUserRepository userRepository,
|
||||||
IRegisterUserCommand registerUserCommand,
|
IRegisterUserCommand registerUserCommand,
|
||||||
ICaptchaValidationService captchaValidationService,
|
ICaptchaValidationService captchaValidationService,
|
||||||
@ -57,8 +55,7 @@ public class AccountsController : Controller
|
|||||||
IDataProtectorTokenFactory<RegistrationEmailVerificationTokenable> registrationEmailVerificationTokenDataFactory
|
IDataProtectorTokenFactory<RegistrationEmailVerificationTokenable> registrationEmailVerificationTokenDataFactory
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
_currentContext = currentContext;
|
_currentContext = currentContext;
|
||||||
_logger = logger;
|
|
||||||
_userRepository = userRepository;
|
_userRepository = userRepository;
|
||||||
_registerUserCommand = registerUserCommand;
|
_registerUserCommand = registerUserCommand;
|
||||||
_captchaValidationService = captchaValidationService;
|
_captchaValidationService = captchaValidationService;
|
||||||
|
@ -41,25 +41,13 @@ public class RegisterRequestModel : IValidatableObject, ICaptchaProtectedModel
|
|||||||
Email = Email,
|
Email = Email,
|
||||||
MasterPasswordHint = MasterPasswordHint,
|
MasterPasswordHint = MasterPasswordHint,
|
||||||
Kdf = Kdf.GetValueOrDefault(KdfType.PBKDF2_SHA256),
|
Kdf = Kdf.GetValueOrDefault(KdfType.PBKDF2_SHA256),
|
||||||
KdfIterations = KdfIterations.GetValueOrDefault(AuthConstants.PBKDF2_ITERATIONS.Default),
|
KdfIterations = KdfIterations ?? AuthConstants.PBKDF2_ITERATIONS.Default,
|
||||||
KdfMemory = KdfMemory,
|
KdfMemory = KdfMemory,
|
||||||
KdfParallelism = KdfParallelism
|
KdfParallelism = KdfParallelism,
|
||||||
|
ReferenceData = ReferenceData != null ? JsonSerializer.Serialize(ReferenceData) : null,
|
||||||
|
Key = Key
|
||||||
};
|
};
|
||||||
|
Keys?.ToUser(user);
|
||||||
if (ReferenceData != null)
|
|
||||||
{
|
|
||||||
user.ReferenceData = JsonSerializer.Serialize(ReferenceData);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Key != null)
|
|
||||||
{
|
|
||||||
user.Key = Key;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Keys != null)
|
|
||||||
{
|
|
||||||
Keys.ToUser(user);
|
|
||||||
}
|
|
||||||
|
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user