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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user