|
@@ -100,6 +100,12 @@ class Session: |
|
|
else: |
|
|
else: |
|
|
self.start() |
|
|
self.start() |
|
|
|
|
|
|
|
|
|
|
|
# set local session |
|
|
|
|
|
webnotes.local.session = self.data |
|
|
|
|
|
|
|
|
|
|
|
# write out latest cookies |
|
|
|
|
|
webnotes.local.cookie_manager.set_cookies() |
|
|
|
|
|
|
|
|
def start(self): |
|
|
def start(self): |
|
|
"""start a new session""" |
|
|
"""start a new session""" |
|
|
# generate sid |
|
|
# generate sid |
|
@@ -125,14 +131,7 @@ class Session: |
|
|
# update profile |
|
|
# update profile |
|
|
webnotes.conn.sql("""UPDATE tabProfile SET last_login = '%s', last_ip = '%s' |
|
|
webnotes.conn.sql("""UPDATE tabProfile SET last_login = '%s', last_ip = '%s' |
|
|
where name='%s'""" % (webnotes.utils.now(), webnotes.get_request_header('REMOTE_ADDR'), self.data['user'])) |
|
|
where name='%s'""" % (webnotes.utils.now(), webnotes.get_request_header('REMOTE_ADDR'), self.data['user'])) |
|
|
webnotes.conn.commit() |
|
|
|
|
|
|
|
|
|
|
|
# set cookies to write |
|
|
|
|
|
webnotes.local.session = self.data |
|
|
|
|
|
|
|
|
|
|
|
# write cookies |
|
|
|
|
|
webnotes.local.cookie_manager.set_cookies() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
webnotes.conn.commit() |
|
|
|
|
|
|
|
|
def insert_session_record(self): |
|
|
def insert_session_record(self): |
|
|
webnotes.conn.sql("""insert into tabSessions |
|
|
webnotes.conn.sql("""insert into tabSessions |
|
|