예제 #1
0
파일: auth.py 프로젝트: aksareen/Django-App
 def wrap(request, *args, **kwargs):
     try:
         token = request.META["HTTP_ACCESSTOKEN"]
         token = mycrypt.parse(token)
         if token[: len(mycrypt.VALIDATION_KEY)] != mycrypt.VALIDATION_KEY:
             return HttpResponseRedirect("/authentication/bad_request")
         return f(request, *args, **kwargs)
     except:
         return HttpResponseRedirect("/authentication/bad_request")
예제 #2
0
파일: auth.py 프로젝트: aksareen/Django-App
 def wrap(request, *args, **kwargs):
     try:
         token = request.META["HTTP_ACCESSTOKEN"]
         token = mycrypt.parse(token)
         if (token[: len(mycrypt.VALIDATION_KEY)] != mycrypt.VALIDATION_KEY) or (
             json.loads(token[len(mycrypt.VALIDATION_KEY) :])["access_level"] > 0
         ):
             return HttpResponseRedirect("/authentication/bad_request")
         return f(request, *args, **kwargs)
     except:
         return HttpResponseRedirect("/authentication/bad_request")
예제 #3
0
파일: auth.py 프로젝트: aksareen/Django-App
def get_user(request):
    token = request.META["HTTP_ACCESSTOKEN"]
    token = mycrypt.parse(token)
    return json.loads(token[len(mycrypt.VALIDATION_KEY) :])