def on_login_post_session(login_manager): """ called after login update login_from and delete parallel sessions """ # Clear previous sessions i.e. logout previous log-in attempts allow_multiple_sessions = ['*****@*****.**', 'Administrator', 'Guest'] if webnotes.session['user'] not in allow_multiple_sessions: from webnotes.sessions import clear_sessions clear_sessions(webnotes.session.user, keep_current=True) # check if account is expired check_if_expired() if webnotes.session['user'] not in ('Guest', '*****@*****.**'): # create feed from webnotes.utils import nowtime from webnotes.profile import get_user_fullname webnotes.conn.begin() home.make_feed('Login', 'Profile', login_manager.user, login_manager.user, '%s logged in at %s' % (get_user_fullname(login_manager.user), nowtime()), login_manager.user=='Administrator' and '#8CA2B3' or '#1B750D') webnotes.conn.commit() if webnotes.conn.get_value("Profile", webnotes.session.user, "user_type") == "Website User": from website.helpers.cart import set_cart_count set_cart_count()
def on_login_post_session(login_manager): """ called after login update login_from and delete parallel sessions """ # Clear previous sessions i.e. logout previous log-in attempts allow_multiple_sessions = ["*****@*****.**", "Administrator", "Guest"] if webnotes.session["user"] not in allow_multiple_sessions: from webnotes.sessions import clear_sessions clear_sessions(webnotes.session.user, keep_current=True) # check if account is expired check_if_expired() if webnotes.session["user"] not in ("Guest", "*****@*****.**"): # create feed from webnotes.utils import nowtime from webnotes.profile import get_user_fullname home.make_feed( "Login", "Profile", login_manager.user, login_manager.user, "%s logged in at %s" % (get_user_fullname(login_manager.user), nowtime()), login_manager.user == "Administrator" and "#8CA2B3" or "#1B750D", )
def on_login_post_session(login_manager): """ called after login update login_from and delete parallel sessions """ # Clear previous sessions i.e. logout previous log-in attempts allow_multiple_sessions = ['*****@*****.**', 'Administrator', 'Guest'] if webnotes.session['user'] not in allow_multiple_sessions: from webnotes.sessions import clear_sessions clear_sessions(webnotes.session.user, keep_current=True) # check if account is expired check_if_expired() if webnotes.session['user'] not in ('Guest', '*****@*****.**'): # create feed from webnotes.utils import nowtime from webnotes.profile import get_user_fullname webnotes.conn.begin() home.make_feed( 'Login', 'Profile', login_manager.user, login_manager.user, '%s logged in at %s' % (get_user_fullname(login_manager.user), nowtime()), login_manager.user == 'Administrator' and '#8CA2B3' or '#1B750D') webnotes.conn.commit() if webnotes.conn.get_value("Profile", webnotes.session.user, "user_type") == "Website User": from website.helpers.cart import set_cart_count set_cart_count()
def logout(self, arg='', user=None): if not user: user = webnotes.session.user self.user = user self.run_trigger('on_logout') if user in ['*****@*****.**', 'Administrator']: webnotes.conn.sql('delete from tabSessions where sid=%s', webnotes.session.get('sid')) webnotes.cache().delete_value("session:" + webnotes.session.get("sid")) else: from webnotes.sessions import clear_sessions clear_sessions(user)
def logout(self, arg='', user=None): if not user: user = webnotes.session.user self.run_trigger('on_logout') if user in ['*****@*****.**', 'Administrator']: webnotes.conn.sql('delete from tabSessions where sid=%s', webnotes.session.get('sid')) webnotes.cache().delete_value("session:" + webnotes.session.get("sid")) else: from webnotes.sessions import clear_sessions clear_sessions(user) if user == webnotes.session.user: webnotes.add_cookies["full_name"] = "" webnotes.add_cookies["sid"] = ""
def logout(self, arg="", user=None): if not user: user = webnotes.session.user self.run_trigger("on_logout") if user in ["*****@*****.**", "Administrator"]: webnotes.conn.sql("delete from tabSessions where sid=%s", webnotes.session.get("sid")) webnotes.cache().delete_value("session:" + webnotes.session.get("sid")) else: from webnotes.sessions import clear_sessions clear_sessions(user) if user == webnotes.session.user: webnotes.add_cookies["full_name"] = "" webnotes.add_cookies["sid"] = ""
def logout(self, arg='', user=None): if not user: user = webnotes.session.user self.run_trigger('on_logout') if user in ['*****@*****.**', 'Administrator']: webnotes.conn.sql('delete from tabSessions where sid=%s', webnotes.session.get('sid')) webnotes.cache().delete_value("session:" + webnotes.session.get("sid")) else: from webnotes.sessions import clear_sessions clear_sessions(user) if user == webnotes.session.user: webnotes.session.sid = "" webnotes.local._response.delete_cookie("full_name") webnotes.local._response.delete_cookie("user_id") webnotes.local._response.delete_cookie("sid") webnotes.local._response.set_cookie("full_name", "") webnotes.local._response.set_cookie("user_id", "") webnotes.local._response.set_cookie("sid", "")
def on_login_post_session(login_manager): """ called after login update login_from and delete parallel sessions """ # Clear previous sessions i.e. logout previous log-in attempts allow_multiple_sessions = ["*****@*****.**", "Administrator", "Guest"] if webnotes.session["user"] not in allow_multiple_sessions: from webnotes.sessions import clear_sessions clear_sessions(webnotes.session.user, keep_current=True) # check if account is expired check_if_expired() if webnotes.session["user"] not in ("Guest", "*****@*****.**"): # create feed from webnotes.utils import nowtime from webnotes.profile import get_user_fullname webnotes.conn.begin() home.make_feed( "Login", "Profile", login_manager.user, login_manager.user, "%s logged in at %s" % (get_user_fullname(login_manager.user), nowtime()), login_manager.user == "Administrator" and "#8CA2B3" or "#1B750D", ) webnotes.conn.commit() if ( webnotes.conn.get_default("shopping_cart_enabled") and webnotes.conn.get_value("Profile", webnotes.session.user, "user_type") == "Website User" ): from selling.utils.cart import set_cart_count set_cart_count()