From 36e21f79e58a245083f5d8bb0324054a07eecb2f Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 27 Apr 2012 15:28:45 +0530 Subject: [PATCH] setup profile before calling on login post session --- py/webnotes/auth.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/py/webnotes/auth.py b/py/webnotes/auth.py index 3a71b6d9be..6177ce59be 100644 --- a/py/webnotes/auth.py +++ b/py/webnotes/auth.py @@ -62,12 +62,12 @@ class HTTPRequest: webnotes.msgprint(webnotes.conn.get_global("__session_status_message")) raise webnotes.SessionStopped('Session Stopped') + # load profile + self.setup_profile() + # run login triggers if webnotes.form_dict.get('cmd')=='login': webnotes.login_manager.run_trigger('on_login_post_session') - - # load profile - self.setup_profile() # write out cookies webnotes.cookie_manager.set_cookies() @@ -81,11 +81,12 @@ class HTTPRequest: def setup_profile(self): webnotes.user = webnotes.profile.Profile() + # load the profile data - if webnotes.session['data'].get('profile'): - webnotes.user.load_from_session(webnotes.session['data']['profile']) - else: - webnotes.user.load_profile() + if not webnotes.session['data'].get('profile'): + webnotes.session['data']['profile'] = webnotes.user.load_profile() + + webnotes.user.load_from_session(webnotes.session['data']['profile']) # set database login # ------------------