Commit 621c59a9 authored by Daniel STAN's avatar Daniel STAN

wiki: un peu plus de validation du pseudo

parent 4c976d72
......@@ -6,6 +6,7 @@ import urllib2
from django.utils.translation import ugettext as _
from django.utils.importlib import import_module
from lc_ldap.crans_utils import validate_name
conn_pool = import_module('conn_pool', 'intranet')
class LinkAccount(Form):
......@@ -65,6 +66,10 @@ class CreateAccount(Form):
def clean(self):
""" Teste la validité du couple login/mdp """
data = super(CreateAccount, self).clean()
try:
validate_name(data.get('wiki_name',''))
except ValueError:
raise ValidationError(_(u'Nom wiki invalide'))
if data.get('password1', '') != data.get('password2', ''):
raise ValidationError(_(u'Les mots de passe ne correspondent pas !'))
return data
......@@ -26,7 +26,7 @@ class WikiName(object):
luser = self._get_ldap_from_user(user)
try:
return luser['compteWiki'][0].value
except (KeyError, IndexError):
except (KeyError, IndexError, ValueError):
return None
@classmethod
......
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