correction du bug de login (j'espre)

darcs-hash:20061117140933-f46e9-af7e3b0bf4126861a3e9f9c1eb09227c3c6535c7.gz
This commit is contained in:
gdetrez 2006-11-17 15:09:33 +01:00
parent b488b68dcf
commit 4f3b212b2d
6 changed files with 80 additions and 86 deletions

View file

@ -1,10 +1,22 @@
#! /usr/bin/env python
# -*- coding: iso-8859-15 -*-
# ##################################################################################################### #
# MonCompte
# ##################################################################################################### #
# Description:
#
# Informations:
#
# Pages:
#
#
# ##################################################################################################### #
import cherrypy, sys, os, datetime
# libraries crans
sys.path.append('/usr/scripts/gestion/')
from config_mail import MailConfig
if (cherrypy.config.configMap["global"]["server.environment"] == "development"):
from ldap_crans_test import *
# print("monCompte : unsing test ldap : env=" + cherrypy.config.configMap["global"]["server.environment"])
@ -15,12 +27,6 @@ else:
class monCompte:
__ldap = None
def __init__(self):
self.__ldap = cherrypy.config.configMap["global"]["crans_ldap"]
def getCurrentAdministrativeYear(self):
'''
premiere partie de l''annee scolaire en cours
@ -43,7 +49,7 @@ class monCompte:
# l'adherent + les formulaires
#
def index(self, message = '', error = '', currentTab = 'mainTab'):
adh = self.__ldap.search('uid=' + cherrypy.session['uid'])['adherent'][0]
adh = cherrypy.session['LDAP'].search('uid=' + cherrypy.session['uid'])['adherent'][0]
t = {}
t['message'] = message
t['error'] = error
@ -120,7 +126,7 @@ class monCompte:
# via paypal
#
def rechargerCompteImpression(self, etape = '1', combien = None):
adh = self.__ldap.search('uid=' + cherrypy.session['uid'])['adherent'][0]
adh = cherrypy.session['LDAP'].search('uid=' + cherrypy.session['uid'])['adherent'][0]
if (etape == "1"): # Introduction
return {
'template' :'MonCompteRechargePaypal1',
@ -220,7 +226,7 @@ class monCompte:
# Adherent:nom
##########################
def changeNomAdherent(self, nouveauNom):
adh = self.__ldap.search('uid=' + cherrypy.session['uid'], 'w')['adherent'][0]
adh = cherrypy.session['LDAP'].search('uid=' + cherrypy.session['uid'], 'w')['adherent'][0]
try:
adh.nom(nouveauNom)
adh.save()
@ -245,7 +251,7 @@ class monCompte:
msg = 'Erreur, la confirmation ne correspond pas au nouveau mot de passe.'
return self.index(error=msg)
adh = self.__ldap.search('uid=' + cherrypy.session['uid'],'w')['adherent'][0]
adh = cherrypy.session['LDAP'].search('uid=' + cherrypy.session['uid'],'w')['adherent'][0]
if adh.checkPassword(ancienPassword):
adh.changePasswd(nouveauPassword1)
adh.save()
@ -263,7 +269,7 @@ class monCompte:
# Adherent:prenom
##########################
def changePrenomAdherent(self, nouveauPrenom):
adh = self.__ldap.search('uid=' + cherrypy.session['uid'], 'w')['adherent'][0]
adh = cherrypy.session['LDAP'].search('uid=' + cherrypy.session['uid'], 'w')['adherent'][0]
try:
adh.prenom(nouveauPrenom)
adh.save()
@ -278,7 +284,7 @@ class monCompte:
# Adherent:tel
##########################
def changeTelAdherent(self, nouveauTel):
adh = self.__ldap.search('uid=' + cherrypy.session['uid'], 'w')['adherent'][0]
adh = cherrypy.session['LDAP'].search('uid=' + cherrypy.session['uid'], 'w')['adherent'][0]
try:
adh.tel(nouveauTel)
adh.save()
@ -293,7 +299,7 @@ class monCompte:
# mail:alias:creation
##########################
def newAlias(self, alias):
adh = self.__ldap.search('uid=' + cherrypy.session['uid'],'w')['adherent'][0]
adh = cherrypy.session['LDAP'].search('uid=' + cherrypy.session['uid'],'w')['adherent'][0]
if adh.alias().__len__() >= 3:
return self.index(error=u"Vous avez plus de 2 alias. Demander à un câbleur pour en rajouter.")
try:
@ -328,7 +334,7 @@ class monCompte:
rewriteMailHeaders = True
try:
adh = self.__ldap.search('uid=' + cherrypy.session['uid'],'w')['adherent'][0]
adh = cherrypy.session['LDAP'].search('uid=' + cherrypy.session['uid'],'w')['adherent'][0]
if forwarding_address!=None:
MailConfig(cherrypy.session['uid'], forward=forwarding_address, spam=spanTreatment)
adh.contourneGreylist(contourneGreylist)