Пример #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);
            }
        }