mirror of
https://github.com/nikdoof/test-auth.git
synced 2026-01-30 16:08:14 +00:00
Further validation of Eve API keys
This commit is contained in:
@@ -5,13 +5,13 @@ from sso.models import ServiceAccount, Service
|
|||||||
from reddit.models import RedditAccount
|
from reddit.models import RedditAccount
|
||||||
|
|
||||||
class EveAPIForm(forms.Form):
|
class EveAPIForm(forms.Form):
|
||||||
user_id = forms.CharField(label = u'User ID', max_length=10)
|
user_id = forms.IntegerField(label = u'User ID')
|
||||||
api_key = forms.CharField(label = u'API Key', max_length=100)
|
api_key = forms.CharField(label = u'API Key', max_length=64)
|
||||||
description = forms.CharField(max_length=100)
|
description = forms.CharField(max_length=100)
|
||||||
|
|
||||||
def clean(self):
|
def clean(self):
|
||||||
if not self.cleaned_data['user_id'].isdigit():
|
if not self.cleaned_data['api_key'].len() == 64:
|
||||||
raise forms.ValidationError("API User ID provided is not valid")
|
raise forms.ValidationError("API Key provided is invalid (Not 64 characters long)")
|
||||||
|
|
||||||
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'])
|
||||||
|
|||||||
Reference in New Issue
Block a user