|
|
|
@ -9,6 +9,7 @@ from sqlalchemy import text
|
|
|
|
|
|
|
|
|
|
from website import db_mysql
|
|
|
|
|
from website import errors
|
|
|
|
|
from website import consts
|
|
|
|
|
from website import settings
|
|
|
|
|
from website.handler import APIHandler, authenticated
|
|
|
|
|
from website.util import aes
|
|
|
|
@ -44,6 +45,23 @@ class LogoutHandler(APIHandler):
|
|
|
|
|
# self.current_user.name, self.request.remote_ip, "平台管理中心", "账号管理", "登出", "系统登出", "系统登出"
|
|
|
|
|
# )
|
|
|
|
|
|
|
|
|
|
with self.app_mysql.connect() as conn:
|
|
|
|
|
conn.execute(text(
|
|
|
|
|
"insert into sys_log(user, ip, primary_menu, sub_menu, op_type, content, comment) "
|
|
|
|
|
"values(:user, :ip, :primary_menu, :sub_menu, :op_type, :content, :comment)"
|
|
|
|
|
),
|
|
|
|
|
{"user": self.current_user.name,
|
|
|
|
|
"ip": self.request.headers[
|
|
|
|
|
"X-Forwarded-For"] if "X-Forwarded-For" in self.request.headers else self.request.remote_ip,
|
|
|
|
|
"primary_menu": "系统操作",
|
|
|
|
|
"sub_menu": "登录/登出",
|
|
|
|
|
"op_type": consts.op_type_login_logout_str,
|
|
|
|
|
"content": "退出登录",
|
|
|
|
|
"comment": ""
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
conn.commit()
|
|
|
|
|
|
|
|
|
|
self.r_app.delete(settings.session_key_prefix % self.current_user.uuid)
|
|
|
|
|
self.finish()
|
|
|
|
|
|
|
|
|
@ -162,6 +180,23 @@ class LoginHandler(APIHandler):
|
|
|
|
|
# "system_status": system_status, # 9000/未激活, 9001/已激活, 9002/过期可查看, 9003/完全过期
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
with self.app_mysql.connect() as conn:
|
|
|
|
|
conn.execute(text(
|
|
|
|
|
"insert into sys_log(user, ip, primary_menu, sub_menu, op_type, content, comment) "
|
|
|
|
|
"values(:user, :ip, :primary_menu, :sub_menu, :op_type, :content, :comment)"
|
|
|
|
|
),
|
|
|
|
|
{"user": username,
|
|
|
|
|
"ip": self.request.headers[
|
|
|
|
|
"X-Forwarded-For"] if "X-Forwarded-For" in self.request.headers else self.request.remote_ip,
|
|
|
|
|
"primary_menu": "系统操作",
|
|
|
|
|
"sub_menu": "登录/登出",
|
|
|
|
|
"op_type": consts.op_type_login_logout_str,
|
|
|
|
|
"content": "登录成功",
|
|
|
|
|
"comment": ""
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
conn.commit()
|
|
|
|
|
|
|
|
|
|
self.finish(render_data)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|