mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-13 22:32:15 +00:00
Fix the validation data on the EVEAPIForm
This commit is contained in:
@@ -19,6 +19,8 @@ class EveAPIForm(forms.Form):
|
|||||||
if re.search(r'[^\.a-zA-Z0-9]', self.cleaned_data['api_key']):
|
if re.search(r'[^\.a-zA-Z0-9]', self.cleaned_data['api_key']):
|
||||||
raise forms.ValidationError("Provided API Key has invalid characters.")
|
raise forms.ValidationError("Provided API Key has invalid characters.")
|
||||||
|
|
||||||
|
return self.cleaned_data['api_key']
|
||||||
|
|
||||||
def clean_user_id(self):
|
def clean_user_id(self):
|
||||||
|
|
||||||
if not 'user_id' in self.cleaned_data or self.cleaned_data['user_id'] == '':
|
if not 'user_id' in self.cleaned_data or self.cleaned_data['user_id'] == '':
|
||||||
@@ -27,7 +29,8 @@ class EveAPIForm(forms.Form):
|
|||||||
try:
|
try:
|
||||||
eaccount = EVEAccount.objects.get(api_user_id=self.cleaned_data['user_id'])
|
eaccount = EVEAccount.objects.get(api_user_id=self.cleaned_data['user_id'])
|
||||||
except EVEAccount.DoesNotExist:
|
except EVEAccount.DoesNotExist:
|
||||||
return self.cleaned_data
|
pass
|
||||||
else:
|
else:
|
||||||
raise forms.ValidationError("This API User ID is already registered")
|
raise forms.ValidationError("This API User ID is already registered")
|
||||||
|
|
||||||
|
return self.cleaned_data['user_id']
|
||||||
|
|||||||
Reference in New Issue
Block a user