mirror of
https://github.com/TencentCloud/Octop.git
synced 2026-10-02 07:34:38 +08:00
fix(auth): tell locked-out users how to reset a password (#869)
Merged from #880.
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
- 对话中可隐藏不常用的共享专家(浏览器本地偏好)(#589)
|
||||
|
||||
### 修复
|
||||
- 登录页补充忘记密码说明:本机执行 `octop user passwd <用户名>`,或请管理员重置(#869)
|
||||
- iOS PWA 状态栏不再虚化遮挡内容:顶栏改为不透明、去掉 backdrop-filter;登录页与设置向导补 `safe-area-inset` 内边距(#874)
|
||||
- 知识库纯文本/Markdown/CSV 在 UTF-8 失败时回退 GB18030,避免 Windows GBK 文档被替换成乱码后入库
|
||||
- Dashboard 保存 Agent 运行参数后立即刷新当前 Agent 上下文,避免重置按钮和聊天页继续使用旧值
|
||||
|
||||
@@ -4626,6 +4626,7 @@
|
||||
"username": "Username or email",
|
||||
"password": "Password",
|
||||
"submit": "Sign in",
|
||||
"forgotPasswordHint": "Forgot the password? On the Octop host run octop user passwd <username>, or ask an administrator to reset it.",
|
||||
"failed": "Login failed",
|
||||
"slideHint": "Slide to the end to verify",
|
||||
"slideVerified": "Verified",
|
||||
|
||||
@@ -4765,6 +4765,7 @@
|
||||
"username": "用户名或邮箱",
|
||||
"password": "密码",
|
||||
"submit": "登录",
|
||||
"forgotPasswordHint": "忘记密码?在 Octop 主机执行 octop user passwd <用户名>,或请管理员在用户页重置。",
|
||||
"failed": "登录失败",
|
||||
"slideHint": "拖动滑块到最右侧完成验证",
|
||||
"slideVerified": "验证通过",
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
import { render, screen } from "@testing-library/react";
|
||||
import { MemoryRouter } from "react-router-dom";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
|
||||
vi.mock("../../context/ThemeContext", () => ({
|
||||
useTheme: () => ({ isDark: false }),
|
||||
}));
|
||||
|
||||
vi.mock("../../api/modules/auth", () => ({
|
||||
authApi: {
|
||||
getAuthStatus: () => Promise.resolve({ setup_required: false }),
|
||||
getOauthStatus: () => Promise.resolve({ providers: [] }),
|
||||
getCaptcha: () => Promise.resolve({ provider: "none" }),
|
||||
},
|
||||
}));
|
||||
|
||||
vi.mock("../../utils/locale", () => ({
|
||||
applyGuestLocale: () => Promise.resolve(),
|
||||
applyUserLocale: () => Promise.resolve(),
|
||||
}));
|
||||
|
||||
vi.mock("./CaptchaField", () => ({
|
||||
default: () => null,
|
||||
}));
|
||||
|
||||
import LoginPage from "./index";
|
||||
|
||||
describe("Login forgot-password hint", () => {
|
||||
it("tells locked-out operators how to reset via CLI", () => {
|
||||
render(
|
||||
<MemoryRouter>
|
||||
<LoginPage />
|
||||
</MemoryRouter>,
|
||||
);
|
||||
const hint = screen.getByTestId("login-forgot-password");
|
||||
expect(hint.textContent).toMatch(/octop user passwd/);
|
||||
});
|
||||
});
|
||||
@@ -317,6 +317,23 @@ export default function LoginPage() {
|
||||
{t("login.submit")}
|
||||
</Button>
|
||||
|
||||
<p
|
||||
data-testid="login-forgot-password"
|
||||
style={{
|
||||
margin: 0,
|
||||
fontSize: 13,
|
||||
lineHeight: 1.6,
|
||||
color: "var(--fn-text-tertiary)",
|
||||
textAlign: "center",
|
||||
width: "100%",
|
||||
}}
|
||||
>
|
||||
{t(
|
||||
"login.forgotPasswordHint",
|
||||
"Forgot the password? On the Octop host run octop user passwd <username>, or ask an administrator to reset it.",
|
||||
)}
|
||||
</p>
|
||||
|
||||
{providers.length > 0 && (
|
||||
<>
|
||||
<div
|
||||
|
||||
Reference in New Issue
Block a user