You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2017/06/29 19:15:02 UTC

allura git commit: Provide a AuthProvider hook to do things after login

Repository: allura
Updated Branches:
  refs/heads/db/after_login_hook [created] 62be56636


Provide a AuthProvider hook to do things after login


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/62be5663
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/62be5663
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/62be5663

Branch: refs/heads/db/after_login_hook
Commit: 62be56636e4079865cc5ce9d43006caa663bd0c8
Parents: 2802007
Author: Dave Brondsema <da...@brondsema.net>
Authored: Thu Jun 29 15:14:53 2017 -0400
Committer: Dave Brondsema <da...@brondsema.net>
Committed: Thu Jun 29 15:14:53 2017 -0400

----------------------------------------------------------------------
 Allura/allura/lib/plugin.py | 7 +++++++
 1 file changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/62be5663/Allura/allura/lib/plugin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/plugin.py b/Allura/allura/lib/plugin.py
index a8008ed..ddb5f38 100644
--- a/Allura/allura/lib/plugin.py
+++ b/Allura/allura/lib/plugin.py
@@ -163,6 +163,12 @@ class AuthenticationProvider(object):
         '''
         raise NotImplementedError('_login')
 
+    def after_login(self, user, request):
+        '''
+        This is a hook so that custom AuthenticationProviders can do things after a successful login.
+        '''
+        pass
+
     def login(self, user=None, multifactor_success=False):
         from allura import model as M
         if user is None:
@@ -187,6 +193,7 @@ class AuthenticationProvider(object):
         else:
             self.session['username'] = user.username
             h.auditlog_user('Successful login', user=user)
+            self.after_login(user, self.request)
 
         if 'rememberme' in self.request.params:
             remember_for = int(config.get('auth.remember_for', 365))