페이지 형식 선택과 접속 IP 기록 수정 v1.5.7
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { randomBytes } from 'node:crypto'
|
||||
import { z } from 'zod'
|
||||
import { createError, getRequestIP, readBody } from 'h3'
|
||||
import { createError, readBody } from 'h3'
|
||||
import { getPostgresClient } from '../../../repositories/postgres-client'
|
||||
import { getMemberBootstrapState, getUserByEmail } from '../../../repositories/member-repository'
|
||||
import {
|
||||
@@ -14,6 +14,7 @@ import {
|
||||
import { generateSixDigitOtp, hashOtpCode, normalizeOtpEmail } from '../../../utils/email-otp'
|
||||
import { isResendConfigured, sendResendEmail } from '../../../utils/resend-mail'
|
||||
import { getRuntimeEnvValue } from '../../../utils/runtime-env'
|
||||
import { getClientIp } from '../../../utils/request-ip'
|
||||
|
||||
const bodySchema = z.object({
|
||||
email: z.string().trim().email(),
|
||||
@@ -113,7 +114,7 @@ export default defineEventHandler(async (event) => {
|
||||
if (!user) {
|
||||
const dummyHash = randomBytes(32).toString('hex')
|
||||
const expiresAt = new Date(Date.now() + OTP_TTL_MS)
|
||||
const createdIp = String(getRequestIP(event) || '')
|
||||
const createdIp = getClientIp(event)
|
||||
await invalidatePendingOtpChallenges(sql, email, purpose)
|
||||
await insertOtpChallenge(sql, {
|
||||
email,
|
||||
@@ -130,7 +131,7 @@ export default defineEventHandler(async (event) => {
|
||||
const code = generateSixDigitOtp()
|
||||
const codeHash = hashOtpCode({ pepper, email, purpose, code })
|
||||
const expiresAt = new Date(Date.now() + OTP_TTL_MS)
|
||||
const createdIp = String(getRequestIP(event) || '')
|
||||
const createdIp = getClientIp(event)
|
||||
|
||||
const challengeId = await insertOtpChallenge(sql, {
|
||||
email,
|
||||
|
||||
Reference in New Issue
Block a user