modify url parameter
This commit is contained in:
1 parent
f362effe7a
commit
56069a04a1
17 files changed
+68
-492
No files matched your search
@@ -4,12 +4,15 @@
|
||||
카카오 로그인, JWT 토큰 관리, 사용자 인증 관련 비즈니스 로직을 처리합니다.
|
||||
"""
|
||||
|
||||
import logging
|
||||
from datetime import datetime, timezone
|
||||
from typing import Optional
|
||||
|
||||
from sqlalchemy import select, update
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
from app.user.exceptions import (
|
||||
InvalidTokenError,
|
||||
TokenExpiredError,
|
||||
@@ -221,14 +224,19 @@ class AuthService:
|
||||
kakao_account = kakao_user_info.kakao_account
|
||||
profile = kakao_account.profile if kakao_account else None
|
||||
|
||||
logger.info(f"[AUTH] 사용자 조회 시작 - kakao_id: {kakao_id}")
|
||||
|
||||
# 기존 사용자 조회
|
||||
result = await session.execute(
|
||||
select(User).where(User.kakao_id == kakao_id)
|
||||
)
|
||||
user = result.scalar_one_or_none()
|
||||
|
||||
logger.info(f"[AUTH] DB 조회 결과 - user_exists: {user is not None}, user_id: {user.id if user else None}")
|
||||
|
||||
if user is not None:
|
||||
# 기존 사용자: 프로필 정보 업데이트
|
||||
logger.info(f"[AUTH] 기존 사용자 발견 - user_id: {user.id}, is_new_user: False")
|
||||
if profile:
|
||||
user.nickname = profile.nickname
|
||||
user.profile_image_url = profile.profile_image_url
|
||||
@@ -239,6 +247,7 @@ class AuthService:
|
||||
return user, False
|
||||
|
||||
# 신규 사용자 생성
|
||||
logger.info(f"[AUTH] 신규 사용자 생성 시작 - kakao_id: {kakao_id}")
|
||||
new_user = User(
|
||||
kakao_id=kakao_id,
|
||||
email=kakao_account.email if kakao_account else None,
|
||||
@@ -249,6 +258,7 @@ class AuthService:
|
||||
session.add(new_user)
|
||||
await session.flush()
|
||||
await session.refresh(new_user)
|
||||
logger.info(f"[AUTH] 신규 사용자 생성 완료 - user_id: {new_user.id}, is_new_user: True")
|
||||
return new_user, True
|
||||
|
||||
async def _save_refresh_token(
|
||||
|
||||
Reference in new issue
Block a user