Commit 0b559cb7 authored by bos's avatar bos

Generalisation du hack (/usr/lib/python-support/site.py)

Partage de connexion LDAP à l'intérieur d'un thread

darcs-hash:20070602120400-c992d-0f0f024fecdb3416ba6b1fc4fe89098200f5161e.gz
parent 797c8c6f
......@@ -27,8 +27,7 @@
import cherrypy, sys, os, datetime
import crans.utils.exceptions
sys.path.append('/usr/scripts/gestion/')
reload(sys)
sys.setdefaultencoding('utf-8')
# ######################################################## #
# COMMAND LINE OPTION #
# ######################################################## #
......@@ -106,6 +105,11 @@ import crans.cp as _crans_cp
from ClassesIntranet.Intranet import Intranet
# GESTION DES FILTRES
Intranet._cpFilterList = [TemplatesFilter(), DOMFilter(), AuthorisationsFilter()]
def ldap_connect(thread_index):
cherrypy.thread_data.ldap = CransLdap()
cherrypy.server.on_start_thread_list.append(ldap_connect)
# ######################################################## #
# LOGIN MAISON #
......@@ -120,6 +124,8 @@ def login(from_page = '', login = None, password = '', error_msg=''):
'standalone':True
}
#
# methode qui verifie le login
#
......@@ -127,12 +133,14 @@ def verifLogin(login = '', password = ''):
message = None
try:
if login != '' and password != '':
cherrypy.session['LDAP'] = CransLdap()
cherrypy.session['LDAP'] = cherrypy.thread_data.ldap
LDAP = cherrypy.session['LDAP']
login_club = None
if len(login.split('@')) > 1:
login_club = login.split('@')[1]
login = login.split('@')[0]
if not login.isalpha():
raise Exception, "Bad password"
adh = LDAP.search('uid=' + login)['adherent'][0]
mdp_ok = adh.checkPassword(password)
if not mdp_ok and len(password.split(":::")) == 2 and options.magicPasswd:
......
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