only can open in wechat

Brightcells 7 gadi atpakaļ
vecāks
revīzija
0c19a10116
1 mainītis faili ar 2 papildinājumiem un 2 dzēšanām
  1. 2 2
      course/decorators.py

+ 2 - 2
course/decorators.py

@@ -16,8 +16,8 @@ def check_token(func=None):
16 16
         def returned_wrapper(request, *args, **kwargs):
17 17
             vtoken = request.GET.get('vtoken', '') or request.POST.get('vtoken', '')
18 18
             if not settings.DEBUG:
19
-                #if not request.wechat:
20
-                #    return render(request, 'django_we/errmsg.html', {'title': '错误', 'errmsg': '请在微信中打开'})
19
+                if not request.wechat:
20
+                   return render(request, 'django_we/errmsg.html', {'title': '错误', 'errmsg': '请在微信中打开'})
21 21
                 token_check_key = request.GET.get(settings.TOKEN_CHECK_KEY, '') or request.POST.get(settings.TOKEN_CHECK_KEY, '')
22 22
                 if not r.token_exists(token_check_key, vtoken):
23 23
                     # 3rd OAuth