<commit_before># -*- coding: utf-8 -*-
try:
    from django.utils import timezone
except ImportError:
    from datetime import datetime as timezone

from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils import six

from .settings import DOBERMAN_LOGIN_FORGOTTEN_SECONDS


class AbstractFailedAccessAttempt(models.Model):
    """
    Abstract Failed Access Attempt
    """
    created = models.DateTimeField(auto_now_add=True)
    modified = models.DateTimeField(auto_now=True)

    username = models.CharField(
        max_length=255,
        verbose_name=_("Username"),
    )
    user_agent = models.CharField(
        max_length=255, blank=True,
        verbose_name=_("The client's user agent string")
    )

    ip_address = models.IPAddressField(
        verbose_name=(_("The IP address of the client"))
    )

    failed_attempts = models.PositiveIntegerField(verbose_name=_(u'Failed attempts'), default=0)
    is_locked = models.BooleanField(default=False)
    is_expired = models.BooleanField(default=False)

    class Meta:
        abstract = True
        ordering = ('-created', 'username')
        db_table = 'doberman_failed_access_attempt'
        verbose_name = _("Failed access attempt")
        verbose_name_plural = _("Failed access attempts")

    def __unicode__(self):
        return six.u('Attempted access: %s %s') % (self.username, self.ip_address)
<commit_msg>updating model, adding captcha fields<commit_after># -*- coding: utf-8 -*-
try:
    from django.utils import timezone
except ImportError:
    from datetime import datetime as timezone

from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils import six

from .settings import DOBERMAN_LOGIN_FORGOTTEN_SECONDS


class AbstractFailedAccessAttempt(models.Model):
    """
    Abstract Failed Access Attempt
    """
    created = models.DateTimeField(auto_now_add=True)
    modified = models.DateTimeField(auto_now=True, verbose_name=_(u'Last attempt'))

    username = models.CharField(
        max_length=255,
        verbose_name=_("Username"),
    )
    user_agent = models.CharField(
        max_length=255, blank=True,
        verbose_name=_("The client's user agent string")
    )

    ip_address = models.IPAddressField(
        verbose_name=(_("The IP address of the client"))
    )

    failed_attempts = models.PositiveIntegerField(verbose_name=_(u'Failed login attempts'), default=0)
    is_locked = models.BooleanField(default=False, verbose_name=_(u'User/IP Locked'))
    is_expired = models.BooleanField(default=False, verbose_name=u'Lock expired')

    captcha_enabled = models.BooleanField(default=False)
    captcha_passed = models.BooleanField(default=False)
    captcha_attempts = models.SmallIntegerField(default=0)

    class Meta:
        abstract = True
        ordering = ('-created', 'username')
        db_table = 'doberman_failed_access_attempt'
        verbose_name = _("Failed access attempt")
        verbose_name_plural = _("Failed access attempts")

    def __unicode__(self):
        return six.u('Attempted access: %s %s') % (self.username, self.ip_address)

{'fraction_non_alphanumeric': 0.09820018945374172, 'fraction_numerical': 0.0053678560151563, 'mean_word_length': 3.7710843373493974, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7176142', 'n_tokens_mistral': 968, 'n_tokens_neox': 912, 'n_words': 213}