allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kentontay...@apache.org
Subject [2/2] allura git commit: Provide a AuthProvider hook to do things after login
Date Mon, 17 Jul 2017 16:11:45 GMT
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/e4cb7958
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/e4cb7958
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/e4cb7958

Branch: refs/heads/master
Commit: e4cb79584b3205a5fe2292e2eb371011c969a70e
Parents: bdcdcbf
Author: Dave Brondsema <dave@brondsema.net>
Authored: Thu Jun 29 15:14:53 2017 -0400
Committer: Kenton Taylor <ktaylor@slashdotmedia.com>
Committed: Mon Jul 17 14:23:10 2017 +0000

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


http://git-wip-us.apache.org/repos/asf/allura/blob/e4cb7958/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))


Mime
View raw message