From c86b517063f15f97ee9751ed77942f6a8d197514 Mon Sep 17 00:00:00 2001 From: Nelson <1475262689@qq.com> Date: Thu, 9 Jul 2026 11:02:26 +0800 Subject: [PATCH] Add Aliyun SMS settings and refresh admin login --- .../apps/admin-web/src/App.vue | 96 ++++++++-- .../apps/admin-web/src/styles.css | 160 ++++++++++++++-- .../apps/backend/.env.example | 6 + .../apps/backend/app/core/config.py | 6 + .../apps/backend/app/services/auth_service.py | 4 +- .../backend/app/services/sms_code_service.py | 172 +++++++++++++++++- .../apps/backend/requirements.txt | 1 + 7 files changed, 410 insertions(+), 35 deletions(-) diff --git a/ai_knowledge_base_v2/apps/admin-web/src/App.vue b/ai_knowledge_base_v2/apps/admin-web/src/App.vue index 6196709..d924e77 100644 --- a/ai_knowledge_base_v2/apps/admin-web/src/App.vue +++ b/ai_knowledge_base_v2/apps/admin-web/src/App.vue @@ -233,6 +233,54 @@ const systemSettingSections: SystemSettingSection[] = [ placeholder: "例如 123456", description: "mock 短信开启时使用的固定验证码。", }, + { + key: "aliyun_sms_access_key_id", + label: "阿里云 AccessKey ID", + type: "password", + defaultValue: "", + placeholder: "请输入 RAM 用户 AccessKey ID", + description: "关闭 mock 短信后用于调用阿里云短信服务。", + }, + { + key: "aliyun_sms_access_key_secret", + label: "阿里云 AccessKey Secret", + type: "password", + defaultValue: "", + placeholder: "请输入 RAM 用户 AccessKey Secret", + description: "敏感配置,建议使用最小权限 RAM 用户。", + }, + { + key: "aliyun_sms_sign_name", + label: "阿里云短信签名", + type: "text", + defaultValue: "", + placeholder: "例如 某某课堂", + description: "需与阿里云短信控制台审核通过的签名一致。", + }, + { + key: "aliyun_sms_template_code", + label: "阿里云模板 Code", + type: "text", + defaultValue: "", + placeholder: "例如 SMS_123456789", + description: "验证码短信模板 Code。", + }, + { + key: "aliyun_sms_template_param_key", + label: "验证码变量名", + type: "text", + defaultValue: "code", + placeholder: "默认 code", + description: "模板中验证码变量名,例如模板变量为 ${code} 时填写 code。", + }, + { + key: "aliyun_sms_endpoint", + label: "阿里云短信 Endpoint", + type: "text", + defaultValue: "dysmsapi.aliyuncs.com", + placeholder: "dysmsapi.aliyuncs.com", + description: "一般保持默认值即可。", + }, { key: "default_user_name_prefix", label: "默认用户名前缀", @@ -984,19 +1032,41 @@ function buildChatQuery() {