Add caminus username validation api

This commit is contained in:
Trever Fischer
2012-02-19 17:44:09 -05:00
parent 6c980fa047
commit ed0a884292
5 changed files with 23 additions and 20 deletions

14
api/handlers.py Normal file
View File

@@ -0,0 +1,14 @@
from piston.handler import AnonymousBaseHandler
from profiles.models import MinecraftProfile
class WhitelistHandler(AnonymousBaseHandler):
allowed_methods = ('GET',)
def read(self, request, username=None):
if username:
try:
profile = MinecraftProfile.objects.get(mc_username__exact=username)
except Exception, e:
return False
return profile.user.is_active
return False