mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-14 14:52:15 +00:00
Added RedditAccount as a editable section to users, also added Admin side
This commit is contained in:
12
sso/forms.py
12
sso/forms.py
@@ -2,6 +2,7 @@ from django import forms
|
||||
|
||||
from eve_api.models.api_player import EVEAccount
|
||||
from sso.models import ServiceAccount, Service
|
||||
from reddit.models import RedditAccount
|
||||
|
||||
class EveAPIForm(forms.Form):
|
||||
user_id = forms.CharField(label = u'User ID', max_length=10)
|
||||
@@ -37,3 +38,14 @@ def UserServiceAccountForm(user):
|
||||
password = forms.CharField(label = u'Password',widget = forms.PasswordInput(render_value=False))
|
||||
|
||||
return ServiceAccountForm
|
||||
|
||||
class RedditAccountForm(forms.Form):
|
||||
username = forms.CharField(label = u'User ID', max_length=64)
|
||||
|
||||
def clean(self):
|
||||
try:
|
||||
eaccount = RedditAccount.objects.get(username=self.cleaned_data['username'])
|
||||
except RedditAccount.DoesNotExist:
|
||||
return self.cleaned_data
|
||||
else:
|
||||
raise forms.ValidationError("This User ID is already registered")
|
||||
|
||||
Reference in New Issue
Block a user