4abddbe8 by 周伟奇

Merge branch 'feature/pentest'

2 parents e6486884 8900023f
1 LOGIN_TIMES_LIMIT = 100 1 LOGIN_TIMES_LIMIT = 10
2 LOGIN_TIMES_LIMIT_EXPIRES = 3600 * 24 2 LOGIN_TIMES_LIMIT_EXPIRES = 3600 * 24
3 3
......
...@@ -27,15 +27,15 @@ class LoginView(ObtainJSONWebToken, GenericView): ...@@ -27,15 +27,15 @@ class LoginView(ObtainJSONWebToken, GenericView):
27 def post(self, request, *args, **kwargs): 27 def post(self, request, *args, **kwargs):
28 # 登录次数限制 28 # 登录次数限制
29 user_name = request.data.get('username', '') 29 user_name = request.data.get('username', '')
30 # times = rh.get_login_times(user_name) 30 times = rh.get_login_times(user_name)
31 # if isinstance(times, int) and times >= LOGIN_TIMES_LIMIT: 31 if isinstance(times, int) and times >= LOGIN_TIMES_LIMIT:
32 # raise self.invalid_params(msg="重试次数限制") 32 raise self.invalid_params(msg="重试次数限制")
33 33
34 res = super(LoginView, self).post(request, *args, **kwargs) 34 res = super(LoginView, self).post(request, *args, **kwargs)
35 self.running_log.info('[users.login] username: {0}'.format(user_name)) 35 self.running_log.info('[users.login] username: {0}'.format(user_name))
36 36
37 if res.status_code == status.HTTP_400_BAD_REQUEST: 37 if res.status_code == status.HTTP_400_BAD_REQUEST:
38 # rh.set_login_times(user_name, LOGIN_TIMES_LIMIT_EXPIRES) 38 rh.set_login_times(user_name, LOGIN_TIMES_LIMIT_EXPIRES)
39 raise self.invalid_params(msg="用户名或密码错误") 39 raise self.invalid_params(msg="用户名或密码错误")
40 serializer = self.get_serializer(data=request.data) 40 serializer = self.get_serializer(data=request.data)
41 serializer.is_valid() 41 serializer.is_valid()
......
...@@ -1390,10 +1390,10 @@ class AutoSettlementView(GenericView): ...@@ -1390,10 +1390,10 @@ class AutoSettlementView(GenericView):
1390 1390
1391 1391
1392 class AutoSettlementExcelView(GenericView): 1392 class AutoSettlementExcelView(GenericView):
1393 permission_classes = [] 1393 # permission_classes = []
1394 authentication_classes = [] 1394 # authentication_classes = []
1395 # permission_classes = [IsAuthenticated] 1395 permission_classes = [IsAuthenticated]
1396 # authentication_classes = [OAuth2AuthenticationWithUser] 1396 authentication_classes = [OAuth2AuthenticationWithUser]
1397 1397
1398 # 获取auto settlement excel 1398 # 获取auto settlement excel
1399 @use_args(auto_list_args, location='querystring') 1399 @use_args(auto_list_args, location='querystring')
......
...@@ -161,6 +161,9 @@ REST_FRAMEWORK = { ...@@ -161,6 +161,9 @@ REST_FRAMEWORK = {
161 'EXCEPTION_HANDLER': 'common.exceptions.exception_handler' 161 'EXCEPTION_HANDLER': 'common.exceptions.exception_handler'
162 } 162 }
163 163
164 # session配置
165 SESSION_COOKIE_AGE = 1800
166
164 # 日志配置 167 # 日志配置
165 LOGGING_CONFIG = None 168 LOGGING_CONFIG = None
166 config.fileConfig(conf.LOGGING_CONFIG_FILE, disable_existing_loggers=False) 169 config.fileConfig(conf.LOGGING_CONFIG_FILE, disable_existing_loggers=False)
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!