Impression pour les clubs
darcs-hash:20070530200203-c992d-a350d0f59467491516306c8d1947201b2db51130.gz
This commit is contained in:
parent
f9f5e869ee
commit
c0223fc29e
1 changed files with 16 additions and 6 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue