Commit 246ee80f by dong

fix20230106

parent 4e7b6c28
...@@ -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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment