From 768e7740d5a37b34794b5bdc823a13c55a4cc9b7 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Sun, 2 Mar 2014 18:06:44 -0500 Subject: [PATCH] Add way to save user data after login The login manager that successfully authenticated the user can now pass data to be stored in the user facility of the session. Signed-off-by: Simo Sorce --- ipsilon/login/common.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ipsilon/login/common.py b/ipsilon/login/common.py index 4ffdd8a..b7000b2 100755 --- a/ipsilon/login/common.py +++ b/ipsilon/login/common.py @@ -34,7 +34,7 @@ class LoginManagerBase(PluginObject): base = cherrypy.config.get('base.mount', "") raise cherrypy.HTTPRedirect('%s/login/%s' % (base, path)) - def auth_successful(self, username): + def auth_successful(self, username, userdata=None): # save ref before calling UserSession login() as it # may regenerate the session session = UserSession() @@ -43,6 +43,12 @@ class LoginManagerBase(PluginObject): ref = cherrypy.config.get('base.mount', "") + '/' session.login(username) + + # Save additional data provided by the login manager + if userdata: + for key in userdata: + session.save_data('user', key, userdata[key]) + raise cherrypy.HTTPRedirect(ref) def auth_failed(self): -- 2.20.1