Ignore:
Timestamp:
4 Jul 2013, 10:45:39 (11 years ago)
Author:
uli
Message:

Let authtenticators give back a reason if login fails.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.cas/trunk/waeup/cas/authenticators.py

    r10394 r10396  
    9797
    9898    def check_credentials(self, username='', password=''):
    99         """If username is ``'bird'`` and password ``'bebop'`` return
    100         ``True``, else ``False``.
     99        """If username is ``'bird'`` and password ``'bebop'`` check
     100        will succeed.
     101
     102        Returns a tuple ``(<STATUS>, <REASON>)`` with ``<STATUS>``
     103        being a boolean and ``<REASON>`` being a string giving the
     104        reason why login failed (if so) or an empty string.
    101105        """
    102         return username == 'bird' and password == 'bebop'
     106        reason = ''
     107        result = username == 'bird' and password == 'bebop'
     108        if not result:
     109            reason = 'Invalid username or password.'
     110        return result, reason
Note: See TracChangeset for help on using the changeset viewer.