import os
import string
import subprocess
+import time
+import cPickle
+import base64
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
- token = 'quentin'
+
+ 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',