Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
周伟奇
/
bmw-ocr
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
4abddbe8
authored
2022-05-05 20:00:38 +0800
by
周伟奇
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'feature/pentest'
2 parents
e6486884
8900023f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
9 deletions
src/apps/account/consts.py
src/apps/account/views.py
src/apps/doc/views.py
src/settings/__init__.py
src/apps/account/consts.py
View file @
4abddbe
LOGIN_TIMES_LIMIT
=
10
0
LOGIN_TIMES_LIMIT
=
10
LOGIN_TIMES_LIMIT_EXPIRES
=
3600
*
24
...
...
src/apps/account/views.py
View file @
4abddbe
...
...
@@ -27,15 +27,15 @@ class LoginView(ObtainJSONWebToken, GenericView):
def
post
(
self
,
request
,
*
args
,
**
kwargs
):
# 登录次数限制
user_name
=
request
.
data
.
get
(
'username'
,
''
)
#
times = rh.get_login_times(user_name)
#
if isinstance(times, int) and times >= LOGIN_TIMES_LIMIT:
#
raise self.invalid_params(msg="重试次数限制")
times
=
rh
.
get_login_times
(
user_name
)
if
isinstance
(
times
,
int
)
and
times
>=
LOGIN_TIMES_LIMIT
:
raise
self
.
invalid_params
(
msg
=
"重试次数限制"
)
res
=
super
(
LoginView
,
self
)
.
post
(
request
,
*
args
,
**
kwargs
)
self
.
running_log
.
info
(
'[users.login] username: {0}'
.
format
(
user_name
))
if
res
.
status_code
==
status
.
HTTP_400_BAD_REQUEST
:
#
rh.set_login_times(user_name, LOGIN_TIMES_LIMIT_EXPIRES)
rh
.
set_login_times
(
user_name
,
LOGIN_TIMES_LIMIT_EXPIRES
)
raise
self
.
invalid_params
(
msg
=
"用户名或密码错误"
)
serializer
=
self
.
get_serializer
(
data
=
request
.
data
)
serializer
.
is_valid
()
...
...
src/apps/doc/views.py
View file @
4abddbe
...
...
@@ -1390,10 +1390,10 @@ class AutoSettlementView(GenericView):
class
AutoSettlementExcelView
(
GenericView
):
permission_classes
=
[]
authentication_classes
=
[]
#
permission_classes = [IsAuthenticated]
#
authentication_classes = [OAuth2AuthenticationWithUser]
#
permission_classes = []
#
authentication_classes = []
permission_classes
=
[
IsAuthenticated
]
authentication_classes
=
[
OAuth2AuthenticationWithUser
]
# 获取auto settlement excel
@use_args
(
auto_list_args
,
location
=
'querystring'
)
...
...
src/settings/__init__.py
View file @
4abddbe
...
...
@@ -161,6 +161,9 @@ REST_FRAMEWORK = {
'EXCEPTION_HANDLER'
:
'common.exceptions.exception_handler'
}
# session配置
SESSION_COOKIE_AGE
=
1800
# 日志配置
LOGGING_CONFIG
=
None
config
.
fileConfig
(
conf
.
LOGGING_CONFIG_FILE
,
disable_existing_loggers
=
False
)
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment