mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-18 20:29:27 +00:00
Fixed issues with latest patches
This commit is contained in:
@@ -33,7 +33,7 @@ class ServiceUsernameField(forms.CharField):
|
|||||||
field = super(ServiceUsernameField, self).clean(request)
|
field = super(ServiceUsernameField, self).clean(request)
|
||||||
|
|
||||||
# Checks that usernames consist of letters and numbers only
|
# Checks that usernames consist of letters and numbers only
|
||||||
if not re.match("^[A-Za-z0-9_-]*$", username):
|
if not re.match("^[A-Za-z0-9_-]*$", field):
|
||||||
raise forms.ValidationError("Invalid character in username, use letters and numbers only")
|
raise forms.ValidationError("Invalid character in username, use letters and numbers only")
|
||||||
|
|
||||||
def UserServiceAccountForm(user):
|
def UserServiceAccountForm(user):
|
||||||
@@ -50,11 +50,12 @@ def UserServiceAccountForm(user):
|
|||||||
|
|
||||||
def clean(self):
|
def clean(self):
|
||||||
try:
|
try:
|
||||||
acc = ServiceAccount.objects.get(service_uid=self.cleaned_data['username'],service==self.cleaned_data['service'])
|
acc = ServiceAccount.objects.get(service_uid=self.cleaned_data['username'],service=self.cleaned_data['service'])
|
||||||
except ServiceAccount.DoesNotExist:
|
except ServiceAccount.DoesNotExist:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
raise forms.ValidationError("That username is already taken")
|
raise forms.ValidationError("That username is already taken")
|
||||||
|
return self.cleaned_data
|
||||||
|
|
||||||
|
|
||||||
return ServiceAccountForm
|
return ServiceAccountForm
|
||||||
|
|||||||
Reference in New Issue
Block a user