Skip to content

Commit

Permalink
Revert "Chore: 로그인 시 user_id도 반환"
Browse files Browse the repository at this point in the history
This reverts commit 6d7c834.
  • Loading branch information
deveroskp committed Jan 23, 2025
1 parent 6d7c834 commit ce8ca51
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
3 changes: 1 addition & 2 deletions watchapedia/app/user/dto/responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@ def from_user(user) -> 'MyProfileResponse':

class UserSigninResponse(BaseModel):
access_token: str
refresh_token: str
user_id: int
refresh_token: str
6 changes: 3 additions & 3 deletions watchapedia/app/user/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ def add_user(self, username: str, login_id: str, login_password: str) -> None:
self.raise_if_user_exists(username, login_id)
self.user_repository.add_user(username=username, login_id=login_id, login_password=login_password)

def signin(self, login_id: str, login_password: str) -> tuple[str, str, int]:
def signin(self, login_id: str, login_password: str) -> tuple[str, str]:
user = self.get_user_by_login_id(login_id)
if user is None or verify_password(login_password, user.hashed_pwd) is False:
raise InvalidCredentialsError()

# access token은 10분, refresh token은 24시간 유효한 토큰 생성
access_token, refresh_token = self.issue_token(login_id)
return access_token, refresh_token, user.id
return self.issue_token(login_id)

def update_user(self, user_id:int, username: str | None, login_password: str | None) -> None:
self.user_repository.update_user(user_id, username, login_password)
Expand Down
4 changes: 2 additions & 2 deletions watchapedia/app/user/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def signin(
signin_request: UserSigninRequest
):
# 토큰 발급
access_token, refresh_token, user_id = user_service.signin(signin_request.login_id, signin_request.login_password)
access_token, refresh_token = user_service.signin(signin_request.login_id, signin_request.login_password)

# refresh_token은 쿠키에 담아서 반환
response.set_cookie(
Expand All @@ -70,7 +70,7 @@ def signin(
samesite="lax",
)

return UserSigninResponse(access_token=access_token, refresh_token=refresh_token, user_id=user_id)
return UserSigninResponse(access_token=access_token, refresh_token=refresh_token)

@user_router.get('/me',
status_code=200,
Expand Down

0 comments on commit ce8ca51

Please sign in to comment.