def email(request): authenticator = JSONAuthenticator() try: authenticator.validate(request) except AuthenticationException: return authenticator.error_response() return authenticator.response({"email":authenticator.user.email})
def email(request): authenticator = JSONAuthenticator() print 'json auth' try: authenticator.validate(request) except AuthenticationException: return authenticator.error_response() return authenticator.response({"email":authenticator.user.email,'id':authenticator.user.id})
def date_joined(request): scope = AccessRange.objects.get(key="date_joined") authenticator = JSONAuthenticator(scope=scope) try: authenticator.validate(request) except AuthenticationException: return authenticator.error_response() return authenticator.response({ "date_joined":str(authenticator.user.date_joined)})
def last_login(request): scope = AccessRange.objects.get(key="last_login") authenticator = JSONAuthenticator(scope=scope) try: authenticator.validate(request) except AuthenticationException: return authenticator.error_response() data = {"date_joined":str(request.user.date_joined)} return authenticator.response({ "last_login":str(authenticator.user.last_login)})
def email(request): print "in email" authenticator = JSONAuthenticator() try: authenticator.validate(request) except AuthenticationException: return authenticator.error_response() response = authenticator.response({"email":authenticator.user.email}) print "returning ", response return response
def email(request): print "in email" authenticator = JSONAuthenticator() try: authenticator.validate(request) except AuthenticationException: return authenticator.error_response() response = authenticator.response({"email": authenticator.user.email}) print "returning ", response return response
def profile(request): authenticator = JSONAuthenticator() try: authenticator.validate(request) except AuthenticationException: return authenticator.error_response() return authenticator.response( {"email": authenticator.user.email, "id": authenticator.user.id, "name": authenticator.user.username, "login": authenticator.user.username })
def last_login(request): print "in last_login" scope = AccessRange.objects.get(key="last_login") authenticator = JSONAuthenticator(scope=scope) try: authenticator.validate(request) except AuthenticationException: return authenticator.error_response() response = authenticator.response({ "last_login":str(authenticator.user.last_login)}) print "returning ", response return response
def last_login(request): print "in last_login" scope = AccessRange.objects.get(key="last_login") authenticator = JSONAuthenticator(scope=scope) try: authenticator.validate(request) except AuthenticationException: return authenticator.error_response() response = authenticator.response( {"last_login": str(authenticator.user.last_login)}) print "returning ", response return response
def whoami(request): """Test authentication""" authenticator = JSONAuthenticator() try: authenticator.validate(request) except AuthenticationException: return authenticator.error_response() user = authenticator.access_token.user return authenticator.response({ "user": user.username, "url": user.get_profile().get_absolute_url(), "image_url": user.get_profile().image_or_default() })
def whoami(request): """Test authentication""" authenticator = JSONAuthenticator() try: authenticator.validate(request) except AuthenticationException: return authenticator.error_response() user = authenticator.access_token.user return authenticator.response({ "user": user.username, "url": user.get_profile().get_absolute_url(), "email": user.email, "image_url": user.get_profile().image_or_default() })
def userinfo(request): authenticator = JSONAuthenticator() # XXX: Scope? try: authenticator.validate(request) except AuthenticationException: return authenticator.error_response() return authenticator.response({ "email": authenticator.user.email, "username": authenticator.user.username, "first_name": authenticator.user.first_name, "last_name": authenticator.user.last_name, "is_staff": authenticator.user.is_staff, "is_active": authenticator.user.is_active, "is_superuser": authenticator.user.is_superuser })