hotfix.修复无法用密码访问的bug

This commit is contained in:
tangly1024.com
2023-07-06 10:35:24 +08:00
parent cef2230615
commit 780bb26e5e
2 changed files with 2 additions and 1 deletions

View File

@@ -90,7 +90,6 @@ export default async function getPageProperties(id, block, schema, authToken, ta
properties.pageCover = mapImgUrl(block[id].value?.format?.page_cover, block[id].value) ?? ''
properties.pageCoverThumbnail = mapImgUrl(block[id].value?.format?.page_cover, block[id].value, 'block', 'pageCoverThumbnail') ?? ''
properties.content = value.content ?? []
properties.password = properties.password ? md5(properties.slug + properties.password) : ''
properties.tagItems = properties?.tags?.map(tag => {
return { name: tag, color: tagOptions?.find(t => t.value === tag)?.color || 'gray' }
}) || []
@@ -106,6 +105,7 @@ export default async function getPageProperties(id, block, schema, authToken, ta
properties.to = properties.slug ?? null
properties.name = properties.title ?? ''
}
properties.password = properties.password ? md5(properties.slug + properties.password) : ''
return properties
}

View File

@@ -28,6 +28,7 @@ const Slug = props => {
*/
const validPassword = passInput => {
const encrypt = md5(post.slug + passInput)
console.log('passInput', passInput, post.slug)
if (passInput && encrypt === post.password) {
setLock(false)
return true