summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
867613f)
svn path=/trunk/web/; revision=118
import os
import string
import subprocess
import os
import string
import subprocess
+import time
+import cPickle
+import base64
print 'Content-Type: text/html\n'
sys.stderr = sys.stdout
print 'Content-Type: text/html\n'
sys.stderr = sys.stdout
machine = testMachineId(user, fields.getfirst('machine_id'))
if machine is None: #gave error page already
return
machine = testMachineId(user, fields.getfirst('machine_id'))
if machine is None: #gave error page already
return
+
+ TOKEN_KEY = "0M6W0U1IXexThi5idy8mnkqPKEq1LtEnlK/pZSn0cDrN"
+
+ data = {}
+ data["user"] = user
+ data["machine"]=machine
+ data["expires"]=time.time()+(5*60)
+ pickledData = cPickle.dumps(data)
+ m = hmac.new(TOKEN_KEY, digestmod=sha)
+ m.update(pickledData)
+ token = {'data': pickledData, 'digest': m.digest()}
+ token = cPickle.dumps(token)
+ token = base64.urlsafe_b64encode(token)
+
d = dict(user=user,
machine=machine,
hostname='localhost',
d = dict(user=user,
machine=machine,
hostname='localhost',