Merge branch 'master' into forced-username

Conflicts:

	sso/forms.py
This commit is contained in:
2010-03-14 10:20:58 +00:00
9 changed files with 66 additions and 36 deletions

View File

@@ -37,6 +37,16 @@ def UserServiceAccountForm(user):
character = forms.ChoiceField(chars)
service = forms.ChoiceField(services)
def clean_username(self):
field = self.cleaned_data.get('username', '')
# Checks that usernames consist of letters and numbers only
if not re.match("^[A-Za-z0-9_-]*$", field):
raise forms.ValidationError("Invalid character in username, use letters and numbers only")
return field
def clean(self):
if not self.cleaned_data['character'].corporation.group in self.cleaned_data['service'].groups.all():
raise form.ValidationError("%s is not in a corporation allowed to access %s" % (self.cleaned_data['character'].name, self.cleaned_data['service'])