v1.3.1: 어나운스 바·가입 금지 닉네임·설정 UI 개선
공개 상단 어나운스 바와 관리자 맞춤 설정을 추가하고, 스팸 필터에서 가입 금지 닉네임을 관리·검증한다. POST 설정 읽기 모드 비활성 토글과 설정 내비 아이콘 틀을 반영한다. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,4 +1,9 @@
|
||||
<script setup>
|
||||
import {
|
||||
formatSignupBlockedUsernameMessage,
|
||||
getSignupBlockedUsernameMatch
|
||||
} from '~/lib/signup-blocked-usernames.js'
|
||||
|
||||
definePageMeta({
|
||||
layout: 'page'
|
||||
})
|
||||
@@ -12,7 +17,8 @@ const submitErrorMessage = ref('')
|
||||
const { data: siteSettings } = await useFetch('/api/site-settings', {
|
||||
default: () => ({
|
||||
title: 'AFFiNE',
|
||||
description: 'Configure your Self Host AFFiNE with a few simple settings.'
|
||||
description: 'Configure your Self Host AFFiNE with a few simple settings.',
|
||||
signupBlockedUsernames: []
|
||||
})
|
||||
})
|
||||
const { data: bootstrapStatus } = await useFetch('/api/auth/bootstrap-status', {
|
||||
@@ -78,6 +84,15 @@ const validateStepTwo = () => {
|
||||
if (!form.username.trim()) {
|
||||
errors.username = '사용자명을 입력해 주세요.'
|
||||
valid = false
|
||||
} else {
|
||||
const blockedMatch = getSignupBlockedUsernameMatch(
|
||||
form.username,
|
||||
siteSettings.value?.signupBlockedUsernames || []
|
||||
)
|
||||
if (blockedMatch) {
|
||||
errors.username = formatSignupBlockedUsernameMessage(blockedMatch)
|
||||
valid = false
|
||||
}
|
||||
}
|
||||
|
||||
if (!form.email.trim()) {
|
||||
@@ -205,7 +220,11 @@ const goNextStep = async () => {
|
||||
: '회원가입이 완료되었습니다. 잠시 후 홈으로 이동합니다.'
|
||||
await navigateTo(createdAdmin.value ? '/admin' : '/')
|
||||
} catch (error) {
|
||||
submitErrorMessage.value = error?.data?.message || '회원가입에 실패했습니다.'
|
||||
const message = error?.data?.message || '회원가입에 실패했습니다.'
|
||||
submitErrorMessage.value = message
|
||||
if (message.includes('사용할 수 없는 단어')) {
|
||||
errors.username = message
|
||||
}
|
||||
} finally {
|
||||
isSubmitting.value = false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user