]> git.openstreetmap.org Git - osqa.git/blobdiff - forum/views/auth.py
OSQA-605, store user logins in a separate action, this helps to easily retrieve the...
[osqa.git] / forum / views / auth.py
index c64aa1d513428d387a20cf61090cd3160a934bb5..1b18d6c08ee459315430155677af0ed7d617da87 100644 (file)
@@ -23,7 +23,7 @@ from forum.utils.mail import send_template_email
 from forum.authentication.base import InvalidAuthentication
 from forum.authentication import AUTH_PROVIDERS
 from forum.models import User, AuthKeyUserAssociation, ValidationHash
-from forum.actions import UserJoinsAction
+from forum.actions import UserJoinsAction, UserLoginAction
 from forum import settings
 
 from vars import ON_SIGNIN_SESSION_ATTR, PENDING_SUBMISSION_SESSION_ATTR
@@ -374,6 +374,9 @@ def login_and_forward(request, user, forward=None, message=None):
     user.backend = "django.contrib.auth.backends.ModelBackend"
     login(request, user)
 
+    # Store the login action
+    UserLoginAction(user=user, ip=request.META['REMOTE_ADDR']).save()
+
     if message is None:
         message = _("Welcome back %s, you are now logged in") % smart_unicode(user.username)