public User CreateUser(string username, string password) { var user = new User(); user.Username = username; user.PasswordSalt = crypto.CreateSalt(); user.PasswordHash = crypto.GetPasswordHash(password, user.PasswordSalt); return(user); }
public Account Register(RegisterRepresentation newRegistration) { newRegistration.Password = _cryptographer.GetPasswordHash( newRegistration.Password, _cryptographer.CreateSalt()); var newAccount = _registrationMapper.Map(newRegistration); if (newAccount.Provider == "OAuth") { newAccount.ConfirmEmail(DateTime.Now); } return(newAccount); }
public object Execute(UpdateUserCommandMessage commandMessage) { var user = _repository.GetById(commandMessage.Id) ?? new User(); user.Name = commandMessage.Name; user.EmailAddress = commandMessage.EmailAddress; user.PasswordSalt = _cryptographer.CreateSalt(); user.PasswordHash = _cryptographer.GetPasswordHash(commandMessage.Password, user.PasswordSalt); user.Username = commandMessage.Username; _repository.Save(user); return(user); // new ReturnValue { Type = typeof(User), Value = user }; }