forked from vlex/remote_auth
-
Notifications
You must be signed in to change notification settings - Fork 0
/
RemoteAuth.py
executable file
·33 lines (21 loc) · 941 Bytes
/
RemoteAuth.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/python
import md5
import time
def remote_auth(name,email):
token = [token]
account_id = [ACCOUNT ID]
timestamp = int (time.time())
st_tmp = name+email+account_id+token+str(timestamp)
m = md5.new()
m.update(st_tmp)
hash = m.hexdigest() # Encriptamos los datos
return 'http://vlex.com/session/remote_auth?name='+name+'&email='+email+'&account_id='+account_id+'×tamp='+str(timestamp)+'&hash='+hash
# En este caso, name y email son estaticos. La idea es que se recuperen los valores correspondientes al usuario logado
# pseudocodigo -> name = SESION.current_user.email email = SESION.current_user.email
# NOTA: Recomendamos utilizar el email del usuario como name tambien.
name = [USUARIO]
email = [E-MAIL]
# Generamos el link a vlex incluyendo el parametro hash
url = remote_auth(name,email)
print "Content-Type: text/html\n\n"
print "<meta http-equiv=\"Refresh\" content=\"0;URL="+url+"\" />\n"