Fixed password generation

This commit is contained in:
2025-06-17 21:01:57 +02:00
parent 061ce4cb3d
commit 56a7e76785
8 changed files with 722 additions and 42 deletions

View File

@@ -43,6 +43,9 @@ public class UserService : BaseService, IUserService
private User CreateUserData(CreateUserRequestData data, Role role)
{
var salt = _appSettings.EncryptionSettings?.Salt ?? String.Empty;
var pepper = CryptUtils.GeneratePepper();
var iterations = _appSettings.EncryptionSettings?.Iterations ?? 10;
User user = new()
{
CreationTime = DateTime.UtcNow,
@@ -52,10 +55,10 @@ public class UserService : BaseService, IUserService
FirstName = data.FirstName,
LastName = data.LastName,
Email = data.Email,
PasswordSalt = _appSettings.EncryptionSettings?.Salt ?? String.Empty,
PasswordPepper = CryptUtils.GeneratePepper(),
PasswordIterations = _appSettings.EncryptionSettings?.Iterations ?? 10,
Password = "",
PasswordSalt = salt,
PasswordPepper = pepper,
PasswordIterations = iterations,
Password = CryptUtils.GeneratePassword(data.Password, salt, iterations, pepper),
Role = role,
IsTestUser = false
};