Commit ff93f75e authored by Alain Takoudjou's avatar Alain Takoudjou

add missing changes in user sessions management

parent 1e9dd387
...@@ -64,6 +64,7 @@ def getSession(config): ...@@ -64,6 +64,7 @@ def getSession(config):
def saveSession(config, session, account): def saveSession(config, session, account):
user = os.path.join(config['runner_workdir'], '.users') user = os.path.join(config['runner_workdir'], '.users')
backup = False
try: try:
if account[1]: if account[1]:
salt = "runner81" #to be changed salt = "runner81" #to be changed
...@@ -72,12 +73,14 @@ def saveSession(config, session, account): ...@@ -72,12 +73,14 @@ def saveSession(config, session, account):
account[1] = session['account'][1] account[1] = session['account'][1]
#backup previous data #backup previous data
open(user+'.back', 'w').write(';'.join(session['account'])) open(user+'.back', 'w').write(';'.join(session['account']))
backup = True
#save new account data #save new account data
open(user, 'w').write((';'.join(account)).encode("utf-8")) open(user, 'w').write((';'.join(account)).encode("utf-8"))
session['account'] = account session['account'] = account
return True return True
except Exception, e: except Exception, e:
try: try:
if backup:
os.remove(user) os.remove(user)
os.rename(user+'.back', user) os.rename(user+'.back', user)
except: except:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment