Remove setup code from first-run initialization

This commit is contained in:
eezd committed 2026-10-21 14:19:11 +08:00
1 parent 8b54258df5
commit 8b54ccba18
10 files changed
+125 -88

No files matched your search

+2 -7
View File
@@ -5,7 +5,6 @@ import { api, ApiError } from './api'
const props = defineProps<{ mode: 'setup' | 'login' }>()
const emit = defineEmits<{ done: [] }>()
const code = ref('')
const password = ref('')
const confirm = ref('')
const error = ref('')
@@ -20,7 +19,7 @@ async function submit() {
}
busy.value = true
try {
if (isSetup.value) await api.setup(code.value, password.value)
if (isSetup.value) await api.setup(password.value)
else await api.login(password.value)
emit('done')
} catch (err) {
@@ -36,12 +35,8 @@ async function submit() {
<form class="rm-auth-card" @submit.prevent="submit">
<h1>RawMark</h1>
<p v-if="isSetup" class="rm-auth-hint">
首次使用,请设置登录密码。启动码位于服务器数据目录的 <code>setup-code.txt</code> 中。
首次使用,请设置登录密码。
</p>
<label v-if="isSetup">
<span>启动码</span>
<input v-model="code" autocomplete="one-time-code" autocapitalize="characters" placeholder="XXXX-XXXX" required />
</label>
<label>
<span>密码</span>
<input
+1 -1
View File
@@ -112,7 +112,7 @@ const json = async <T>(p: Promise<Response>): Promise<T> => (await p).json()
export const api = {
authState: () => json<{ setUp: boolean; authenticated: boolean }>(request('GET', '/api/v1/auth/state')),
setup: (code: string, password: string) => request('POST', '/api/v1/auth/setup', { json: { code, password } }),
setup: (password: string) => request('POST', '/api/v1/auth/setup', { json: { password } }),
login: (password: string) => request('POST', '/api/v1/auth/login', { json: { password } }),
logout: () => request('POST', '/api/v1/auth/logout'),