Пример #1
0
        public string HashPassword(Customer user, string password)
        {
            Guard.NotNull(password, nameof(password));

            switch (user.PasswordFormat)
            {
            case PasswordFormat.Hashed:
                string saltKey = user.PasswordSalt.NullEmpty() ?? (user.PasswordSalt = _encryptor.CreateSaltKey(5));
                return(_encryptor.CreatePasswordHash(password, saltKey, _customerSettings.HashedPasswordFormat));

            case PasswordFormat.Encrypted:
                return(_encryptor.EncryptText(password));

            default:     // Clear
                return(password);
            }
        }
Пример #2
0
        public IEnumerable <Member> Get()
        {
            string password    = "******";
            var    saltKey     = _encryptor.CreateSaltKey(16);
            string newPassword = _encryptor.CreatePasswordHash(password, saltKey, "SHA1");

            _memberStorage.Insert(new Member("*****@*****.**", "87908666", DateTime.Now, newPassword, saltKey));
            return(_memberStorage.GetAll <Member>(nameof(Member), ""));
        }