diff options
| author | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-07-07 01:43:36 +0000 |
|---|---|---|
| committer | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-07-07 01:43:36 +0000 |
| commit | fbb3b7f05737f9571b04b0a8f4f15c0928de8545 (patch) | |
| tree | 343247117a7587b8ef5c418c9528d1cf2e0b6f1c /app/api/auth/send-sms | |
| parent | 9945ad119686a4c3a66f7b57782750f78a366cfb (diff) | |
(대표님) 변경사항 20250707 10시 43분
Diffstat (limited to 'app/api/auth/send-sms')
| -rw-r--r-- | app/api/auth/send-sms/route.ts | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/app/api/auth/send-sms/route.ts b/app/api/auth/send-sms/route.ts index 3d51d445..6b9eb114 100644 --- a/app/api/auth/send-sms/route.ts +++ b/app/api/auth/send-sms/route.ts @@ -4,7 +4,7 @@ import { NextRequest, NextResponse } from 'next/server'; import { z } from 'zod'; import { getServerSession } from 'next-auth'; import { authOptions } from '@/app/api/auth/[...nextauth]/route'; -import { getUserById } from '@/lib/users/repository'; +import { getUserByEmail, getUserById } from '@/lib/users/repository'; import { generateAndSendSmsToken } from '@/lib/users/auth/passwordUtil'; const sendSmsSchema = z.object({ @@ -13,20 +13,14 @@ const sendSmsSchema = z.object({ export async function POST(request: NextRequest) { try { - // 세션 확인 - const session = await getServerSession(authOptions); - if (!session?.user?.id) { - return NextResponse.json( - { error: '인증이 필요합니다' }, - { status: 401 } - ); - } const body = await request.json(); const { userId } = sendSmsSchema.parse(body); + console.log(userId, "userId") + // 본인 확인 - if (session.user.id !== userId) { + if (!userId) { return NextResponse.json( { error: '권한이 없습니다' }, { status: 403 } @@ -42,8 +36,12 @@ export async function POST(request: NextRequest) { ); } + console.log(user, "user") + + + // SMS 전송 - const result = await generateAndSendSmsToken(parseInt(userId), user.phone); + const result = await generateAndSendSmsToken(Number(userId), user.phone); if (result.success) { return NextResponse.json({ |
