Ignore:
Timestamp:
4 Apr 2013, 15:12:43 (11 years ago)
Author:
uli
Message:

Provide infrastructure to remember failed logins.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/interfaces.py

    r9816 r10055  
    446446        required = False,)
    447447
     448class IFailedLoginInfo(IKofaObject):
     449    """Info about failed logins.
     450
     451    Timestamps are supposed to be stored as floats using time.time()
     452    or similar.
     453    """
     454    num = schema.Int(
     455        title = _(u'Number of failed logins'),
     456        description = _(u'Number of failed logins'),
     457        required = True,
     458        default = 0,
     459        )
     460
     461    last = schema.Float(
     462        title = _(u'Timestamp'),
     463        description = _(u'Timestamp of last failed login or `None`'),
     464        required = False,
     465        default = None,
     466        )
     467
     468    def as_tuple():
     469        """Get login info as tuple ``<NUM>, <TIMESTAMP>``.
     470        """
     471
     472    def set_values(num=0, last=None):
     473        """Set number of failed logins and timestamp of last one.
     474        """
     475
     476    def increase():
     477        """Increase the current number of failed logins and set timestamp.
     478        """
     479
     480    def reset():
     481        """Set failed login counters back to zero.
     482        """
     483
     484
    448485class IUserAccount(IKofaObject):
    449486    """A user account.
    450487    """
     488
     489    failed_logins = Attribute("""FailedLoginInfo for this account""")
     490
    451491    name = schema.TextLine(
    452492        title = _(u'User Id'),
     
    486526        required = False,
    487527        )
     528
     529
    488530
    489531class IPasswordValidator(Interface):
Note: See TracChangeset for help on using the changeset viewer.