<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;

namespace BrockAllen.MembershipReboot
{
    public abstract class CookieBasedTwoFactorAuthPolicy :
        ITwoFactorAuthenticationPolicy,
        IEventHandler<SuccessfulTwoFactorAuthCodeLoginEvent>
    {
        const string CookieBasedTwoFactorAuthPolicyCookieName = "cbtfap";

        protected abstract bool HasCookie(string name, string value);
        protected abstract void IssueCookie(string name, string value);

        string GetCookieValue(UserAccount account)
        {
            return CryptoHelper.Hash(account.ID.ToString() + account.HashedPassword);
        }

        public bool RequestRequiresTwoFactorAuth(UserAccount account)
        {
            if (account == null) throw new ArgumentNullException("account");

            if (HasCookie(CookieBasedTwoFactorAuthPolicyCookieName, GetCookieValue(account)))<commit_msg>prefix cookie with membershipreboot<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;

namespace BrockAllen.MembershipReboot
{
    public abstract class CookieBasedTwoFactorAuthPolicy :
        ITwoFactorAuthenticationPolicy,
        IEventHandler<SuccessfulTwoFactorAuthCodeLoginEvent>
    {
        const string CookieBasedTwoFactorAuthPolicyCookieName = "mr.cbtfap";

        protected abstract bool HasCookie(string name, string value);
        protected abstract void IssueCookie(string name, string value);

        string GetCookieValue(UserAccount account)
        {
            return CryptoHelper.Hash(account.ID.ToString() + account.HashedPassword);
        }

        public bool RequestRequiresTwoFactorAuth(UserAccount account)
        {
            if (account == null) throw new ArgumentNullException("account");

            if (HasCookie(CookieBasedTwoFactorAuthPolicyCookieName, GetCookieValue(account)))
{'fraction_non_alphanumeric': 0.06891422905304909, 'fraction_numerical': 0.0, 'mean_word_length': 3.839328537170264, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5632540', 'n_tokens_mistral': 498, 'n_tokens_neox': 487, 'n_words': 116}