Commit c0223fc2 authored by bos's avatar bos

Impression pour les clubs

darcs-hash:20070530200203-c992d-a350d0f59467491516306c8d1947201b2db51130.gz
parent f9f5e869
......@@ -106,6 +106,7 @@ def login(from_page = '', login = None, password = '', error_msg=''):
'values':{'login':login, 'password':password, 'from_page':from_page, 'message':error_msg},
'standalone':True
}
#
# methode qui verifie le login
#
......@@ -115,11 +116,24 @@ def verifLogin(login = '', password = ''):
if login != '' and password != '':
cherrypy.session['LDAP'] = CransLdap()
LDAP = cherrypy.session['LDAP']
login_club = None
if len(login.split('@')) > 1:
login_club = login.split('@')[1]
login = login.split('@')[0]
adh = LDAP.search('uid=' + login)['adherent'][0]
if adh.checkPassword(password):
cherrypy.session['uid'] = login
if login_club != None:
club = LDAP.search('uid=%s'%login_club)['club'][0]
if adh.id() not in club._data['responsable']:
raise Exception, "Pas respo club"
cherrypy.session['uid'] = login_club
cherrypy.session['droits'] = []
cherrypy.session['estClub'] = True
else:
cherrypy.session['uid'] = login
cherrypy.session['droits'] = adh.droits()
cherrypy.session['estClub'] = False
cherrypy.session['session_key'] = True
cherrypy.session['droits'] = adh.droits()
cherrypy.log("User logged in : %s" % cherrypy.session['uid'], "LOGIN")
return
else:
......@@ -132,10 +146,6 @@ def verifLogin(login = '', password = ''):
message = u"L'authentification a echoué."
return message
# on indique tout ca a cherrypy
settings={'/': {
'sessionAuthenticateFilter.checkLoginAndPassword': verifLogin,
......
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