|
@@ -35,8 +35,7 @@ from django.views.decorators.csrf import csrf_exempt
|
|
|
from django.views.generic import TemplateView
|
|
|
from django.views.generic import View
|
|
|
from jwt.algorithms import RSAAlgorithm
|
|
|
-from ratelimit.decorators import ratelimit
|
|
|
-
|
|
|
+from ratelimit import limits
|
|
|
from Ansjer.config import AuthCode_Expire, SERVER_DOMAIN, APNS_CONFIG, JPUSH_CONFIG, FCM_CONFIG, TUTK_PUSH_DOMAIN
|
|
|
from Ansjer.config import BASE_DIR, CONFIG_US, CONFIG_EUR, CONFIG_INFO, SERVER_DOMAIN_EUR, CONFIG_CN
|
|
|
from Controller.CheckUserData import DataValid, date_handler, RandomStr
|
|
@@ -62,7 +61,7 @@ class authCodeView(TemplateView):
|
|
|
# testtest11111111111111
|
|
|
return super(authCodeView, self).dispatch(*args, **kwargs)
|
|
|
|
|
|
- @ratelimit(key='ip', rate='2/m')
|
|
|
+ @limits(calls=2, period=60)
|
|
|
def post(self, request, *args, **kwargs):
|
|
|
request.encoding = 'utf-8'
|
|
|
lang = request.POST.get('language', None)
|
|
@@ -74,7 +73,7 @@ class authCodeView(TemplateView):
|
|
|
useremail = request.POST.get('userEmail', None)
|
|
|
return self.ValidationError(username, useremail, response)
|
|
|
|
|
|
- # @ratelimit(key='ip', rate='2/m')
|
|
|
+ # @limits(calls=2, period=60)
|
|
|
def get(self, request, *args, **kwargs):
|
|
|
# Device_User.objects.filter(userEmail='chanjunkai@163.com').delete()
|
|
|
request.encoding = 'utf-8'
|
|
@@ -499,7 +498,7 @@ class ForgetPwdView(TemplateView):
|
|
|
def dispatch(self, *args, **kwargs):
|
|
|
return super(ForgetPwdView, self).dispatch(*args, **kwargs)
|
|
|
|
|
|
- @ratelimit(key='ip', rate='1/m')
|
|
|
+ @limits(calls=2, period=60)
|
|
|
def get(self, request, *args, **kwargs):
|
|
|
request.encoding = 'utf-8'
|
|
|
response = ResponseObject()
|
|
@@ -509,7 +508,7 @@ class ForgetPwdView(TemplateView):
|
|
|
userName = request.GET.get('userName', None)
|
|
|
return self.ValidationError(userName, response)
|
|
|
|
|
|
- @ratelimit(key='ip', rate='1/m')
|
|
|
+ @limits(calls=2, period=60)
|
|
|
def post(self, request):
|
|
|
request.encoding = 'utf-8'
|
|
|
userName = request.POST.get('userName', None)
|
|
@@ -756,7 +755,7 @@ class v2authCodeView(TemplateView):
|
|
|
def dispatch(self, *args, **kwargs):
|
|
|
return super(v2authCodeView, self).dispatch(*args, **kwargs)
|
|
|
|
|
|
- @ratelimit(key='ip', rate='2/m')
|
|
|
+ @limits(calls=2, period=60)
|
|
|
def post(self, request, *args, **kwargs):
|
|
|
request.encoding = 'utf-8'
|
|
|
lang = request.POST.get('lang', None)
|
|
@@ -771,7 +770,7 @@ class v2authCodeView(TemplateView):
|
|
|
return response.json(5)
|
|
|
return self.ValidationError(request_dict, response)
|
|
|
|
|
|
- @ratelimit(key='ip', rate='2/m')
|
|
|
+ @limits(calls=2, period=60)
|
|
|
def get(self, request, *args, **kwargs):
|
|
|
# Device_User.objects.filter(userEmail='chanjunkai@163.com').delete()
|
|
|
request.encoding = 'utf-8'
|
|
@@ -1330,7 +1329,7 @@ class v2forgetPwdCodeView(TemplateView):
|
|
|
def dispatch(self, *args, **kwargs):
|
|
|
return super(v2forgetPwdCodeView, self).dispatch(*args, **kwargs)
|
|
|
|
|
|
- @ratelimit(key='ip', rate='1/m')
|
|
|
+ @limits(calls=2, period=60)
|
|
|
def get(self, request, *args, **kwargs):
|
|
|
request.encoding = 'utf-8'
|
|
|
request_dict = request.GET
|
|
@@ -1341,7 +1340,7 @@ class v2forgetPwdCodeView(TemplateView):
|
|
|
return response.json(5)
|
|
|
return self.ValidationError(request_dict, response)
|
|
|
|
|
|
- @ratelimit(key='ip', rate='1/m')
|
|
|
+ @limits(calls=2, period=60)
|
|
|
def post(self, request):
|
|
|
request.encoding = 'utf-8'
|
|
|
request_dict = request.POST
|
|
@@ -1840,7 +1839,7 @@ class v2LoginView(TemplateView):
|
|
|
def dispatch(self, *args, **kwargs):
|
|
|
return super(v2LoginView, self).dispatch(*args, **kwargs)
|
|
|
|
|
|
- @ratelimit(key='ip', rate='5/m')
|
|
|
+ @limits(calls=2, period=60)
|
|
|
def post(self, request, *args, **kwargs):
|
|
|
request.encoding = 'utf-8'
|
|
|
request_dict = request.POST
|
|
@@ -1851,7 +1850,6 @@ class v2LoginView(TemplateView):
|
|
|
return response.json(5)
|
|
|
return self.validates(request_dict, response)
|
|
|
|
|
|
- # @ratelimit(key='ip', rate='5/m')
|
|
|
def get(self, request, *args, **kwargs):
|
|
|
print("进来了")
|
|
|
request.encoding = 'utf-8'
|
|
@@ -1940,7 +1938,7 @@ class noPasslogin(TemplateView):
|
|
|
def dispatch(self, *args, **kwargs):
|
|
|
return super(noPasslogin, self).dispatch(*args, **kwargs)
|
|
|
|
|
|
- @ratelimit(key='ip', rate='5/m')
|
|
|
+ @limits(calls=2, period=60)
|
|
|
def post(self, request, *args, **kwargs):
|
|
|
request.encoding = 'utf-8'
|
|
|
request_dict = request.POST
|
|
@@ -1951,7 +1949,6 @@ class noPasslogin(TemplateView):
|
|
|
return response.json(5)
|
|
|
return self.validates(request_dict, response)
|
|
|
|
|
|
- # @ratelimit(key='ip', rate='5/m')
|
|
|
def get(self, request, *args, **kwargs):
|
|
|
print("进来了")
|
|
|
request.encoding = 'utf-8'
|
|
@@ -2031,7 +2028,7 @@ class v3LoginView(TemplateView):
|
|
|
def dispatch(self, *args, **kwargs):
|
|
|
return super(v3LoginView, self).dispatch(*args, **kwargs)
|
|
|
|
|
|
- @ratelimit(key='ip', rate='5/m')
|
|
|
+ @limits(calls=2, period=60)
|
|
|
def post(self, request, *args, **kwargs):
|
|
|
request.encoding = 'utf-8'
|
|
|
request_dict = request.POST
|
|
@@ -2760,7 +2757,7 @@ class OauthAuthCodeView(TemplateView):
|
|
|
def dispatch(self, *args, **kwargs):
|
|
|
return super(OauthAuthCodeView, self).dispatch(*args, **kwargs)
|
|
|
|
|
|
- @ratelimit(key='ip', rate='2/m')
|
|
|
+ @limits(calls=2, period=60)
|
|
|
def post(self, request, *args, **kwargs):
|
|
|
request.encoding = 'utf-8'
|
|
|
lang = request.POST.get('lang', None)
|
|
@@ -2775,7 +2772,7 @@ class OauthAuthCodeView(TemplateView):
|
|
|
return response.json(5)
|
|
|
return self.ValidationError(request_dict, response)
|
|
|
|
|
|
- @ratelimit(key='ip', rate='2/m')
|
|
|
+ @limits(calls=2, period=60)
|
|
|
def get(self, request, *args, **kwargs):
|
|
|
# Device_User.objects.filter(userEmail='chanjunkai@163.com').delete()
|
|
|
request.encoding = 'utf-8'
|
|
@@ -3647,7 +3644,7 @@ class loginCodeView(View):
|
|
|
def dispatch(self, *args, **kwargs):
|
|
|
return super(loginCodeView, self).dispatch(*args, **kwargs)
|
|
|
|
|
|
- @ratelimit(key='ip', rate='2/m')
|
|
|
+ @limits(calls=2, period=60)
|
|
|
def post(self, request, *args, **kwargs):
|
|
|
request.encoding = 'utf-8'
|
|
|
lang = request.POST.get('lang', None)
|
|
@@ -3662,7 +3659,7 @@ class loginCodeView(View):
|
|
|
return response.json(5)
|
|
|
return self.validate(request_dict, response)
|
|
|
|
|
|
- @ratelimit(key='ip', rate='2/m')
|
|
|
+ @limits(calls=2, period=60)
|
|
|
def get(self, request, *args, **kwargs):
|
|
|
request.encoding = 'utf-8'
|
|
|
lang = request.GET.get('lang', None)
|