[cpif] r218 - in trunk: backend frontend-web
svn at argo.es
svn at argo.es
Sun Jul 1 02:12:04 CEST 2007
Author: jcea
Date: Sun Jul 1 02:12:03 2007
New Revision: 218
Log:
Movemos cosas donde le toca
Modified:
trunk/backend/database.py
trunk/frontend-web/url_LOGIN.py
Modified: trunk/backend/database.py
==============================================================================
--- trunk/backend/database.py (original)
+++ trunk/backend/database.py Sun Jul 1 02:12:03 2007
@@ -154,6 +154,16 @@
return usuarios["usuarios"].get(nick_normalizado,None)
+def get_openid(conn,usuario,OpenID) :
+ OpenIDs=conn.get_root()["usuarios"]["usuarios"].get(normaliza_nick(usuario))
+ if not OpenIDs : return None
+ OpenIDs=OpenIDs["OpenID"]
+ if OpenID in OpenIDs : return True
+ if OpenID[-1]=="/" :
+ return OpenID[:-1] in OpenIDs
+ else :
+ return OpenID+"/" in OpenIDs
+
def metatag_add(conn,nombre) :
from durus.btree import BTree
from durus.persistent_dict import PersistentDict
Modified: trunk/frontend-web/url_LOGIN.py
==============================================================================
--- trunk/frontend-web/url_LOGIN.py (original)
+++ trunk/frontend-web/url_LOGIN.py Sun Jul 1 02:12:03 2007
@@ -3,8 +3,9 @@
from globales import monitor,openid_support
def gestiona_url(handler,path,usuario) :
+ import database
if path[0]=="LOGIN" :
- import cgi,database
+ import cgi
try:
ctype,pdict=cgi.parse_header(handler.headers.getheader('content-type'))
cuerpo=cgi.FieldStorage(fp=handler.rfile,headers=handler.headers,environ={'REQUEST_METHOD':'POST'},keep_blank_values=1)
@@ -28,23 +29,17 @@
@monitor
def login(conn,usuario,clave) :
return database.usuario_verifica(conn,nick=usuario,clave=clave)
+
resultado=login(usuario_form,clave_form)
if resultado :
nick,cookie=resultado
if cookie :
cookie="cpif_auth=%s; path=/; expires=Wed, 01-Jan-2030 00:00:00 GMT;" %cookie
return (302,{"Set-Cookie":cookie,"Location":"/"+"/".join(path)},"")
- elif openid_support and usuario_form and OpenID_form:
+ elif openid_support and usuario_form and OpenID_form :
@monitor
def get_openid(conn,usuario,OpenID) :
- OpenIDs=conn.get_root()["usuarios"]["usuarios"].get(database.normaliza_nick(usuario))
- if not OpenIDs : return None
- OpenIDs=OpenIDs["OpenID"]
- if OpenID in OpenIDs : return True
- if OpenID[-1]=="/" :
- return OpenID[:-1] in OpenIDs
- else :
- return OpenID+"/" in OpenIDs
+ return database.get_openid(conn,usuario,OpenID)
if get_openid(usuario_form,OpenID_form) :
from openid.consumer import consumer
More information about the cpif
mailing list