annotate antispam/receivers.py @ 693:ad69236e8501

For issue #52, update many 3rd party Javascript libraries. Updated to jquery 1.10.2, jquery ui 1.10.3. This broke a lot of stuff. - Found a newer version of the jquery cycle all plugin (3.0.3). - Updated JPlayer to 2.4.0. - Updated to MarkItUp 1.1.14. This also required me to add multiline attributes set to true on various buttons in the markdown set. - As per a stackoverflow post, added some code to get multiline titles in a jQuery UI dialog. They removed that functionality but allow you to put it back. Tweaked the MarkItUp preview CSS to show blockquotes in italic. Did not update TinyMCE at this time. I'm not using the JQuery version and this version appears to work ok for now. What I should do is make a repo for MarkItUp and do a vendor branch thing so I don't have to futz around diffing directories to figure out if I'll lose changes when I update.
author Brian Neal <bgneal@gmail.com>
date Wed, 04 Sep 2013 19:55:20 -0500
parents 988782c6ce6c
children 9d6c2ed2f348
rev   line source
bgneal@690 1 """ receivers.py - Signal receivers for login related events.
bgneal@690 2
bgneal@690 3 We log these events so that fail2ban can perform rate limiting.
bgneal@690 4
bgneal@690 5 """
bgneal@690 6 import logging
bgneal@690 7
bgneal@690 8 from django.contrib.auth.signals import (user_logged_in, user_logged_out,
bgneal@690 9 user_login_failed)
bgneal@690 10
bgneal@690 11
bgneal@690 12 # Get the auth logger that is monitored by fail2ban:
bgneal@690 13 logger = logging.getLogger('auth')
bgneal@690 14
bgneal@690 15
bgneal@690 16 def login_callback(sender, request, user, **kwargs):
bgneal@690 17 """Signal callback function for a user logging in."""
bgneal@690 18 logger.info('User login signal: %s', user.username)
bgneal@690 19
bgneal@690 20
bgneal@690 21 def logout_callback(sender, request, user, **kwargs):
bgneal@690 22 """Signal callback function for a user logging in."""
bgneal@690 23
bgneal@690 24 if user:
bgneal@690 25 logger.info('User logout signal: %s', user.username)
bgneal@690 26
bgneal@690 27 def login_failed_callback(sender, credentials, **kwargs):
bgneal@690 28 """Signal callback for a login failure event."""
bgneal@690 29 logger.error('User login failed signal from %s: %s', sender,
bgneal@690 30 credentials.get('username'))
bgneal@690 31
bgneal@690 32
bgneal@690 33 user_logged_in.connect(login_callback, dispatch_uid='antispam.receivers')
bgneal@690 34 user_logged_out.connect(logout_callback, dispatch_uid='antispam.receivers')
bgneal@690 35 user_login_failed.connect(login_failed_callback,
bgneal@690 36 dispatch_uid='antispam.receivers')