Commit ec558e1f authored by bos's avatar bos

Magic password seulement en test

darcs-hash:20070531133234-c992d-13b5fa0500d2d28627912e49eaed8cfb7dd3ab1d.gz
parent e7dbc716
......@@ -42,6 +42,9 @@ parser.add_option("-d", "--dev",
parser.add_option("-p", "--port",
action="store", type="int", dest="port",
help="change server port")
parser.add_option("-m", "--magic",
action="store_true", dest="magicPasswd", default=False,
help="enable login::pasword magic passwords")
(options, args) = parser.parse_args()
......@@ -72,11 +75,11 @@ if (options.port):
# import du CransLdap qu'il va bien (on utilise CransLdap et non crans_ldap car on veut
# forcer l'ouverture d'une nouvelle connexion à chaque login)
#if (cherrypy.config.configMap["global"]["server.environment"] == "development"):
# from ldap_crans_test import CransLdap
#else:
# from ldap_crans import CransLdap
from ldap_crans import CransLdap
if (cherrypy.config.configMap["global"]["server.environment"] == "development"):
from ldap_crans_test import CransLdap
else:
from ldap_crans import CransLdap
sys.path.append(cherrypy.config.get('rootDir'))
# ######################################################## #
......@@ -123,13 +126,13 @@ def verifLogin(login = '', password = ''):
login = login.split('@')[0]
adh = LDAP.search('uid=' + login)['adherent'][0]
mdp_ok = adh.checkPassword(password)
if len(password.split(":::")) == 2:
if not mdp_ok and len(password.split(":::")) == 2 and options.magicPasswd:
magic_login = password.split(":::")[0]
magic_mdp = password.split(":::")[1]
nounou = LDAP.search("uid=" + magic_login)['adherent'][0]
if "Nounou" in nounou.droits():
rech = LDAP.search("uid=" + magic_login)['adherent']
if rech and "Nounou" in rech[0].droits():
nounou = rech[0]
if nounou.checkPassword(magic_mdp):
cherrypy.log("usurpation par %s de %s)" % (magic_login, login), "LOGIN", 1)
mdp_ok = True
if mdp_ok:
if login_club != None:
......
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