Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mancheng
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
mancheng
Commits
246ee80f
Commit
246ee80f
authored
Jan 06, 2023
by
dong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix20230106
parent
4e7b6c28
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
15 deletions
+11
-15
apps/view_user/view.py
+11
-15
No files found.
apps/view_user/view.py
View file @
246ee80f
...
@@ -101,7 +101,7 @@ def back_login():
...
@@ -101,7 +101,7 @@ def back_login():
user_ip
=
request
.
remote_addr
user_ip
=
request
.
remote_addr
# print("IP地址:", user_ip)
# print("IP地址:", user_ip)
try
:
try
:
access_nums
=
redis_store
.
get
(
'access_nums_{}'
.
format
(
user_ip
))
access_nums
=
redis_store
.
get
(
'
jincheng_
access_nums_{}'
.
format
(
user_ip
))
except
Exception
as
e
:
except
Exception
as
e
:
current_app
.
logger
.
error
(
e
)
current_app
.
logger
.
error
(
e
)
else
:
else
:
...
@@ -251,10 +251,10 @@ def login_bypwd():
...
@@ -251,10 +251,10 @@ def login_bypwd():
# 获取ip的锁定时间
# 获取ip的锁定时间
try
:
try
:
access_nums
=
redis_store
.
get
(
'access_nums_{}'
.
format
(
user_ip
))
access_nums
=
redis_store
.
get
(
'
jincheng_
access_nums_{}'
.
format
(
user_ip
))
if
access_nums
:
if
access_nums
:
if
int
(
access_nums
.
decode
())
>=
constants
.
LOGIN_ERROR_TIMES
:
if
int
(
access_nums
.
decode
())
>=
constants
.
LOGIN_ERROR_TIMES
:
lock_time
=
redis_store
.
ttl
(
'access_nums_{}'
.
format
(
user_ip
))
lock_time
=
redis_store
.
ttl
(
'
jincheng_
access_nums_{}'
.
format
(
user_ip
))
return
jsonify
(
code
=
RET
.
LOCKTIME
,
msg
=
"ip锁定倒计时中....."
,
lock_time
=
lock_time
)
return
jsonify
(
code
=
RET
.
LOCKTIME
,
msg
=
"ip锁定倒计时中....."
,
lock_time
=
lock_time
)
except
Exception
as
e
:
except
Exception
as
e
:
current_app
.
logger
.
error
(
e
)
current_app
.
logger
.
error
(
e
)
...
@@ -262,7 +262,7 @@ def login_bypwd():
...
@@ -262,7 +262,7 @@ def login_bypwd():
pass
pass
try
:
try
:
access_nums
=
redis_store
.
get
(
'access_nums_{}'
.
format
(
user_ip
))
access_nums
=
redis_store
.
get
(
'
jincheng_
access_nums_{}'
.
format
(
user_ip
))
# access_nums = "123456"
# access_nums = "123456"
except
Exception
as
e
:
except
Exception
as
e
:
current_app
.
logger
.
error
(
e
)
current_app
.
logger
.
error
(
e
)
...
@@ -283,19 +283,19 @@ def login_bypwd():
...
@@ -283,19 +283,19 @@ def login_bypwd():
# 将用户名与密码验证放置在一处,若失败返回提示信息并记录次数
# 将用户名与密码验证放置在一处,若失败返回提示信息并记录次数
if
not
user
.
check_password
(
password
):
if
not
user
.
check_password
(
password
):
try
:
try
:
redis_store
.
incr
(
'access_nums_{}'
.
format
(
user_ip
))
redis_store
.
incr
(
'
jincheng_
access_nums_{}'
.
format
(
user_ip
))
redis_store
.
expire
(
'access_nums_{}'
.
format
(
user_ip
),
constants
.
LOGIN_ERROR_FORBID_TIME
)
redis_store
.
expire
(
'
jincheng_
access_nums_{}'
.
format
(
user_ip
),
constants
.
LOGIN_ERROR_FORBID_TIME
)
except
Exception
as
e
:
except
Exception
as
e
:
current_app
.
logger
.
error
(
e
)
current_app
.
logger
.
error
(
e
)
return
jsonify
(
code
=
RET
.
DATAERR
,
msg
=
"密码错误"
)
return
jsonify
(
code
=
RET
.
DATAERR
,
msg
=
"密码错误"
)
if
user
.
status
==
0
:
# 被禁止
if
user
.
status
==
0
:
# 被禁止
return
jsonify
(
code
=
RET
.
ROLEERR
,
msg
=
"账号被禁止,请联系管理员进行处理!"
)
return
jsonify
(
code
=
RET
.
ROLEERR
,
msg
=
"账号被禁止,请联系管理员进行处理!"
)
#
if user.status == 2: # 审核
if
user
.
status
==
2
:
# 审核
#
return jsonify(code=RET.ROLEERR, msg="审核暂未通过,请以外部访客身份登陆")
return
jsonify
(
code
=
RET
.
ROLEERR
,
msg
=
"审核暂未通过,请以外部访客身份登陆"
)
#
#
if user.status == 3: # 驳回
if
user
.
status
==
3
:
# 驳回
#
return jsonify(code=RET.ROLEERR, msg="您的审核未通过,请联系工作人员")
return
jsonify
(
code
=
RET
.
ROLEERR
,
msg
=
"您的审核未通过,请联系工作人员"
)
session
.
permanent
=
True
# 设置session在设定时间内有效 注意这个要设置在request里边 即请求内部
session
.
permanent
=
True
# 设置session在设定时间内有效 注意这个要设置在request里边 即请求内部
# 若成功保存登录状态
# 若成功保存登录状态
...
@@ -312,10 +312,6 @@ def login_bypwd():
...
@@ -312,10 +312,6 @@ def login_bypwd():
time
=
datetime
.
now
()
time
=
datetime
.
now
()
current_app
.
logger
.
error
(
current_app
.
logger
.
error
(
'++++++++++++++++++++++++++++登录日志>>>{}:{}通过使用手机-密码登录成功了!+++++++++++++++++++++++=++'
.
format
(
time
,
mobile
))
'++++++++++++++++++++++++++++登录日志>>>{}:{}通过使用手机-密码登录成功了!+++++++++++++++++++++++=++'
.
format
(
time
,
mobile
))
# return jsonify(code=RET.OK, msg="登录成功", token=token, flag=user.flag,
# page_permission_list=page_permission_list,
# fun_permission_list=fun_permission_list)
return
jsonify
(
code
=
RET
.
OK
,
return
jsonify
(
code
=
RET
.
OK
,
data
=
{
"msg"
:
"登录成功"
,
data
=
{
"msg"
:
"登录成功"
,
"token"
:
token
,
"token"
:
token
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment