fix(mindspace): lower page access password minimum to 6 characters

Align publication validation, portal gate HTML, H5 publish UI, MCP docs,
and page-data skill guidance so passwords like 888888 are accepted while
3-character values such as 888 remain rejected.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-08-27 09:54:46 +08:00
parent a15c4177de
commit 884e819f70
9 changed files with 31 additions and 19 deletions
+14 -3
View File
@@ -78,11 +78,20 @@ function normalizeAccessMode(value) {
return mode;
}
export const PAGE_ACCESS_PASSWORD_MIN_LENGTH = 6;
export const PAGE_ACCESS_PASSWORD_MAX_LENGTH = 128;
function normalizePassword(value, required) {
const password = String(value ?? '');
if (!required && !password) return null;
if (password.length < 8 || password.length > 128) {
throw publicationError('访问密码长度必须为 8 到 128 个字符', 'invalid_publish_input');
if (
password.length < PAGE_ACCESS_PASSWORD_MIN_LENGTH
|| password.length > PAGE_ACCESS_PASSWORD_MAX_LENGTH
) {
throw publicationError(
`访问密码长度必须为 ${PAGE_ACCESS_PASSWORD_MIN_LENGTH}${PAGE_ACCESS_PASSWORD_MAX_LENGTH} 个字符`,
'invalid_publish_input',
);
}
return password;
}
@@ -1083,7 +1092,7 @@ export function createPublicationService(pool, options = {}) {
} else if (publication.password_hash) {
passwordHash = publication.password_hash;
} else {
throw publicationError('访问密码长度必须为 8 到 128 个字符', 'invalid_publish_input');
throw publicationError('口令访问模式必须提供访问密码', 'invalid_publish_input');
}
}
const now = Date.now();
@@ -1498,6 +1507,8 @@ async function registerPublicationArtifactForConversation({
}
export const publicationInternals = {
PAGE_ACCESS_PASSWORD_MIN_LENGTH,
PAGE_ACCESS_PASSWORD_MAX_LENGTH,
normalizeSlug,
normalizeAccessMode,
normalizePassword,