public void GetSalt_ReturnsUniqueSaltPerInstance()
        {
            var passwordOne = new Password(ClearTextPassword);
            var passwordTwo = new Password(ClearTextPassword);

            Assert.AreNotEqual(passwordOne.GetSalt(), passwordTwo.GetSalt());
        }
        public void GetSalt_ReturnsUsedSalt()
        {
            var password = new Password(ClearTextPassword, Salt);

            string actualSalt = password.GetSalt();

            Assert.AreEqual(Salt, actualSalt);
        }
        public void SetPassword()
        {
            var userRepository = new UserRepository();
            var userEntity = userRepository.GetBy(Id);

            var password = new Password(ConfirmedPassword);
            userEntity.HashedPassword = password.GetHashed();
            userEntity.Salt = password.GetSalt();

            userRepository.SaveChanges();
        }
Exemple #4
0
        public void SetPassword()
        {
            var userRepository = new UserRepository();
            var userEntity     = userRepository.GetBy(Id);

            var password = new Password(ConfirmedPassword);

            userEntity.HashedPassword = password.GetHashed();
            userEntity.Salt           = password.GetSalt();

            userRepository.SaveChanges();
        }
        private UserEntity ToUserEntity()
        {
            var password = new Password(Password);

            var userEntity = new UserEntity
            {
                Name           = Name,
                Email          = Email,
                IsConfirmed    = false,
                Id             = Id,
                Salt           = password.GetSalt(),
                HashedPassword = password.GetHashed(),
            };

            userEntity.Roles.Add(new RoleRepository().GetRole(Role.Regular));

            return(userEntity);
        }
        private UserEntity ToUserEntity()
        {
            var password = new Password(Password);

            var userEntity = new UserEntity
            {
                Name = Name,
                Email = Email,
                IsConfirmed = false,
                Id = Id,
                Salt = password.GetSalt(),
                HashedPassword = password.GetHashed(),
            };

            userEntity.Roles.Add(new RoleRepository().GetRole(Role.Regular));

            return userEntity;
        }