Magic password seulement en test
darcs-hash:20070531133234-c992d-13b5fa0500d2d28627912e49eaed8cfb7dd3ab1d.gz
This commit is contained in:
parent
e7dbc7161e
commit
ec558e1fe0
1 changed files with 12 additions and 9 deletions
|
@ -42,6 +42,9 @@ parser.add_option("-d", "--dev",
|
||||||
parser.add_option("-p", "--port",
|
parser.add_option("-p", "--port",
|
||||||
action="store", type="int", dest="port",
|
action="store", type="int", dest="port",
|
||||||
help="change server 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()
|
(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
|
# 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)
|
# forcer l'ouverture d'une nouvelle connexion à chaque login)
|
||||||
#if (cherrypy.config.configMap["global"]["server.environment"] == "development"):
|
if (cherrypy.config.configMap["global"]["server.environment"] == "development"):
|
||||||
# from ldap_crans_test import CransLdap
|
from ldap_crans_test import CransLdap
|
||||||
#else:
|
else:
|
||||||
# from ldap_crans import CransLdap
|
from ldap_crans import CransLdap
|
||||||
from ldap_crans import CransLdap
|
|
||||||
|
|
||||||
sys.path.append(cherrypy.config.get('rootDir'))
|
sys.path.append(cherrypy.config.get('rootDir'))
|
||||||
# ######################################################## #
|
# ######################################################## #
|
||||||
|
@ -123,13 +126,13 @@ def verifLogin(login = '', password = ''):
|
||||||
login = login.split('@')[0]
|
login = login.split('@')[0]
|
||||||
adh = LDAP.search('uid=' + login)['adherent'][0]
|
adh = LDAP.search('uid=' + login)['adherent'][0]
|
||||||
mdp_ok = adh.checkPassword(password)
|
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_login = password.split(":::")[0]
|
||||||
magic_mdp = password.split(":::")[1]
|
magic_mdp = password.split(":::")[1]
|
||||||
nounou = LDAP.search("uid=" + magic_login)['adherent'][0]
|
rech = LDAP.search("uid=" + magic_login)['adherent']
|
||||||
if "Nounou" in nounou.droits():
|
if rech and "Nounou" in rech[0].droits():
|
||||||
|
nounou = rech[0]
|
||||||
if nounou.checkPassword(magic_mdp):
|
if nounou.checkPassword(magic_mdp):
|
||||||
cherrypy.log("usurpation par %s de %s)" % (magic_login, login), "LOGIN", 1)
|
|
||||||
mdp_ok = True
|
mdp_ok = True
|
||||||
if mdp_ok:
|
if mdp_ok:
|
||||||
if login_club != None:
|
if login_club != None:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue