Commit 1d281bc2 authored by Daniel STAN's avatar Daniel STAN

[voip|ldap] correction generation_num(aid)

On stocke au passage l'objet ldap de l'utilisateur, cela peut
toujours servir (ici à récupérer l'aid)
parent a9688618
......@@ -135,16 +135,10 @@ class Profile(models.Model):
le mot de passe, qui devra être redéfini."""
self.user = new_user
try:
dn = conn_pool.CONNS[new_user.username].dn.split(',')[0]
aid = conn_pool.LDAP_USERS[new_user.username]['aid'][0].value
sip_ext = '1%04d' % int(str(aid)[:4])
except KeyError:
raise Exception("Not allowed") # FIXME
# django.contrib.auth.logout(request.user)
# return django.shortcuts.redirect('login')
if dn.startswith('aid='):
sip_ext = '1%04d' % int(dn[4:])
else:
#return django.http.HttpResponseForbidden()
raise Exception("Not allowed") # FIXME
self.num = sip_ext
def set_password(self, new_pass):
......
......@@ -3,6 +3,7 @@
import django.shortcuts
from django.contrib.auth.decorators import login_required
from django.template import RequestContext
from django.views.decorators.debug import sensitive_post_parameters
from models import Profile, Call
from forms import ProfileForm
......@@ -24,6 +25,7 @@ def index(request):
{'profile': profile,})
@login_required
@sensitive_post_parameters('voicemail_password', 'pass_change2', 'pass_change1')
def edit(request):
try:
profile = Profile.objects.filter(user__exact=request.user)[0]
......
......@@ -59,6 +59,7 @@ class CransCASBackend(CASBackend):
return None
conn_pool.CONNS[django_username] = conn
conn_pool.LDAP_USERS[django_username] = ldap_user
self.refresh_droits(user, ldap_user)
self.refresh_fields(user, ldap_user)
return user
......
......@@ -22,4 +22,5 @@
CONNS = {}
OBJECTS = {}
LDAP_USERS = {}
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