공개 상단 어나운스 바와 관리자 맞춤 설정을 추가하고, 스팸 필터에서 가입 금지 닉네임을 관리·검증한다. POST 설정 읽기 모드 비활성 토글과 설정 내비 아이콘 틀을 반영한다. Co-authored-by: Cursor <cursoragent@cursor.com>
24 lines
736 B
JavaScript
24 lines
736 B
JavaScript
import { createError } from 'h3'
|
|
import {
|
|
formatSignupBlockedUsernameMessage,
|
|
getSignupBlockedUsernameMatch
|
|
} from '../../lib/signup-blocked-usernames.js'
|
|
import { getSiteSettings } from '../repositories/content-repository.js'
|
|
|
|
/**
|
|
* 가입·프로필 변경 시 닉네임이 금지 목록에 해당하는지 검사한다.
|
|
* @param {string} username - 닉네임
|
|
* @returns {Promise<void>}
|
|
*/
|
|
export const assertSignupUsernameAllowed = async (username) => {
|
|
const settings = await getSiteSettings()
|
|
const match = getSignupBlockedUsernameMatch(username, settings.signupBlockedUsernames || [])
|
|
|
|
if (match) {
|
|
throw createError({
|
|
statusCode: 400,
|
|
message: formatSignupBlockedUsernameMessage(match)
|
|
})
|
|
}
|
|
}
|