diff --git a/modules/i18n_messages/api_auth.py b/modules/i18n_messages/api_auth.py index c73c259a..3eef9728 100644 --- a/modules/i18n_messages/api_auth.py +++ b/modules/i18n_messages/api_auth.py @@ -37,6 +37,10 @@ MESSAGES = { "zh-CN": "未登录", "en-US": "Not logged in", }, + "auth.session_expired": { + "zh-CN": "登录状态已过期,请重新登录", + "en-US": "Your login session has expired. Please log in again.", + }, "auth.host_mode_tutorial_not_applicable": { "zh-CN": "宿主机模式无需设置新手教程状态", "en-US": "Tutorial status does not apply in host mode", diff --git a/server/app_legacy.py b/server/app_legacy.py index eb71229e..5ff5bdf1 100644 --- a/server/app_legacy.py +++ b/server/app_legacy.py @@ -821,7 +821,7 @@ def api_login_required(view_func): @wraps(view_func) def wrapped(*args, **kwargs): if not is_logged_in(): - return jsonify({"error": "Unauthorized"}), 401 + return jsonify({"error": tr("auth.session_expired")}), 401 return view_func(*args, **kwargs) return wrapped diff --git a/server/auth_helpers.py b/server/auth_helpers.py index acb5b5d7..2daddbf0 100644 --- a/server/auth_helpers.py +++ b/server/auth_helpers.py @@ -34,7 +34,7 @@ def api_login_required(view_func): @wraps(view_func) def wrapped(*args, **kwargs): if not is_logged_in(): - return jsonify({"error": "Unauthorized"}), 401 + return jsonify({"error": tr("auth.session_expired")}), 401 return view_func(*args, **kwargs) return wrapped