- 新增 /api/admin/songs/batch-reject.post 批量驳回接口(事务清排期/投票/扣接纳数/黑名单去重/异步通知) - requireSongAdmin 三角色校验 + createApiError 统一错误包装 - scheduleDaysBefore/After 四字段排期可见范围限制(开放 API 与公开排期接口三处缓存路径 + DB 条件过滤) - submissionNoteAutoModeration 基于黑名单 KEYWORD/LANGUAGE/GENRE 自动判定留言 publicStatus,命中自动关闭 submissionNotePublic - 更新 songs/request.post 与 songs/[id]/update.put 接入自动审查逻辑
34 lines
865 B
TypeScript
34 lines
865 B
TypeScript
interface InitialPasswordUserState {
|
|
requirePasswordChange?: boolean | null
|
|
}
|
|
|
|
interface StoredPasswordState {
|
|
password?: string | null
|
|
passwordChangedAt?: Date | string | null
|
|
}
|
|
|
|
export interface PasswordSetupState {
|
|
hasSetPassword: boolean
|
|
needsInitialPasswordSetup: boolean
|
|
}
|
|
|
|
export function getPasswordSetupState(
|
|
storedPassword: StoredPasswordState,
|
|
requirePasswordChange: boolean
|
|
): PasswordSetupState {
|
|
const hasSetPassword = !!storedPassword.password
|
|
return {
|
|
hasSetPassword,
|
|
needsInitialPasswordSetup:
|
|
!storedPassword.passwordChangedAt && (requirePasswordChange || !hasSetPassword)
|
|
}
|
|
}
|
|
|
|
export function canSetInitialPassword(
|
|
user: InitialPasswordUserState,
|
|
storedPassword: StoredPasswordState
|
|
): boolean {
|
|
return getPasswordSetupState(storedPassword, !!user.requirePasswordChange)
|
|
.needsInitialPasswordSetup
|
|
}
|