관리자 부트스트랩 복구 보강
This commit is contained in:
@@ -2,7 +2,7 @@ import { z } from 'zod'
|
||||
import { createError, getRequestIP, readBody } from 'h3'
|
||||
import bcrypt from 'bcrypt'
|
||||
import { safeCompare, setAdminSession } from '../../../../utils/admin-auth'
|
||||
import { createUser, getAdminUserByEmail, getMemberBootstrapState, touchUserActivity } from '../../../../repositories/member-repository'
|
||||
import { getAdminUserByEmail, getMemberBootstrapState, touchUserActivity, upsertBootstrapOwner } from '../../../../repositories/member-repository'
|
||||
import { setMemberSession } from '../../../../utils/member-auth'
|
||||
|
||||
const loginSchema = z.object({
|
||||
@@ -40,16 +40,11 @@ const createBootstrapAdminUser = async (credentials) => {
|
||||
}
|
||||
|
||||
const passwordHash = await bcrypt.hash(credentials.password, 12)
|
||||
const created = await createUser({
|
||||
return upsertBootstrapOwner({
|
||||
username: createBootstrapUsername(adminEmail),
|
||||
email: adminEmail,
|
||||
passwordHash
|
||||
})
|
||||
|
||||
return {
|
||||
...created,
|
||||
passwordHash
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user