Skip to content

Conversation

@minjee2758
Copy link
Collaborator

@minjee2758 minjee2758 commented Jun 30, 2025

작업 내용

(1) 깃허브 자동 Push 기능 on/off API 추가
(2) 비밀번호 찾기(리셋) 이메일 발송 및 변경 API 리팩토링&추가
(3) 유저 정보 조회에 verified 필드 추가
(4) 이메일 발송 관련 API 컨트롤러 분리
(5) 일반 회원가입에도 랜덤 닉네임 부여


변경 사항

1. 깃허브 자동 Push 기능 on/off API 추가

깃허브 레포지토리를 선택하면 자동으로 on으로 설정됨(자동 push 허용)
-> changeAutoPushSetting 컨트롤러를 통해 원할 때 on/off 로 설정 가능함

2. 비밀번호 찾기(리셋) 이메일 발송 및 변경 API 리팩토링&추가

  • 비밀번호 찾기 요청 시
    • 해당 이메일로 인증 메일 전송(/auth/find-password)
      image

    • 메일에서 '비밀번호 찾기 인증' 버튼 클릭 시, 인증 성공과 동시에 유저의 email과 id가 담긴 토큰 발급(/auth/find-password-verify)
      image

    • 토큰을 활용해 비밀번호 변경 가능(/auth/reset-password)

      • 이 토큰(tempResetToken)은 10분 간 유효함
      image

3. 유저 정보 조회시 verified 여부도 확인할 수 있게 추가함


참고 사항

  • 유저 구현 사항 중 남은 것
    • oauth Redirect 형식 변경
    • github 정보 추가 시 인증 방식 추가(회원가입 말고)

코드 리뷰 전 확인 체크리스트

  • 불필요한 콘솔 로그, 주석 제거
  • 커밋 메시지 컨벤션 준수 (type : )
  • 기능 정상 동작 확인

Summary by CodeRabbit

  • 신규 기능

    • 이메일 인증 및 비밀번호 찾기/재설정 전용 컨트롤러가 추가되어 관련 API 엔드포인트가 분리되었습니다.
    • 사용자가 GitHub 자동 푸시 기능을 직접 켜거나 끌 수 있는 API가 추가되었습니다.
    • 비밀번호 재설정 시 임시 토큰 기반 2단계 인증 절차가 도입되었습니다.
    • 사용자 정보 조회 시 이메일 인증 여부(verified)가 추가로 제공됩니다.
  • 기능 개선

    • 이메일 인증 및 비밀번호 찾기/재설정 응답에 성공 여부 및 안내 메시지가 명확히 포함됩니다.
    • GitHub 자동 푸시 상태 변경 시 결과 메시지와 상태를 응답으로 확인할 수 있습니다.
  • 버그 수정

    • 일부 내부 메서드 호출 방식이 일관성 있게 개선되었습니다.
  • 기타

    • API 문서화가 강화되어 예시 및 설명이 추가되었습니다.
    • 이메일 내 비밀번호 변경 링크가 새로운 경로로 변경되었습니다.
    • 회원가입 시 닉네임 필드가 제거되어 닉네임 생성 방식이 변경되었습니다.

@coderabbitai
Copy link

coderabbitai bot commented Jun 30, 2025

"""

Walkthrough

이 변경사항은 이메일 인증 및 비밀번호 재설정 플로우를 리팩토링하고 확장합니다. 기존 인증 컨트롤러에서 관련 엔드포인트를 분리하여 새로운 컨트롤러를 도입하고, DTO와 서비스 계층을 재구성하여 비밀번호 재설정 과정을 2단계(인증 코드 검증 후 토큰 발급, 토큰 기반 비밀번호 변경)로 분리하였습니다. 깃허브 자동 푸시 설정을 토글하는 기능도 추가되었습니다.

Changes

파일/경로 요약 변경 요약
.../application/submission/model/SubmissionContext.java, .../domain/user/model/entity/User.java gitPushStatus 접근자 메서드 변경 및 추가(getter/setter)
.../application/usermanagement/auth/dto/request/ResetPasswordRequest.java 기존 비밀번호 재설정 요청 DTO 삭제
.../application/usermanagement/auth/dto/response/VerifyEmailCodeResponse.java result 불리언 필드 및 관련 생성자/팩토리 메서드 추가
.../application/usermanagement/auth/service/AuthService.java 비밀번호 재설정 로직 2단계로 분리, 관련 메서드 및 반환 DTO 추가/변경, 이메일 인증 응답 확장
.../application/usermanagement/user/dto/request/ResetPasswordRequest.java 새로운 비밀번호 재설정 요청 레코드 추가(토큰, 비밀번호, 비밀번호 확인 포함)
.../application/usermanagement/user/dto/response/UserGitubAutoPushResponse.java 깃허브 자동 푸시 상태 응답 DTO 신설
.../application/usermanagement/user/dto/response/UserInfoResponse.java, .../application/usermanagement/user/service/UserService.java 사용자 인증 여부(verified) 필드 및 응답에 반영
.../application/usermanagement/user/dto/response/VerifyFindPasswordResponse.java 비밀번호 찾기 인증 응답 레코드 신설(메시지, 임시 토큰 포함)
.../common/security/util/JwtUtil.java 이메일 기반 임시 토큰 발급 메서드 추가
.../domain/user/service/MailService.java 비밀번호 재설정 이메일 링크 URL 변경
.../domain/user/service/UserDomainService.java 불필요한 UserGithubInfoRepository 필드 제거
.../domain/user/service/UserGithubService.java 깃허브 자동 푸시 토글 메서드 및 관련 로직 추가, 레포 선택 시 자동 푸시 활성화
.../presentation/usermanagement/AuthController.java 이메일 인증/비밀번호 찾기 관련 엔드포인트 및 import 삭제
.../presentation/usermanagement/UserGithubController.java 깃허브 자동 푸시 설정 토글 API 엔드포인트 추가
.../presentation/usermanagement/UserVerifyController.java 이메일 인증 및 비밀번호 찾기/재설정 전용 REST 컨트롤러 신설 및 관련 엔드포인트 구현

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant UserVerifyController
    participant AuthService
    participant JwtUtil

    User->>UserVerifyController: POST /api/auth/find-password (이메일 입력)
    UserVerifyController->>AuthService: findPassword(email)
    AuthService-->>User: 인증 코드 이메일 발송

    User->>UserVerifyController: GET /api/auth/find-password-verify?email&key
    UserVerifyController->>AuthService: verifyFindPassword(email, key)
    AuthService->>JwtUtil: createEmailToken(userId, email)
    JwtUtil-->>AuthService: 임시 토큰 반환
    AuthService-->>UserVerifyController: VerifyFindPasswordResponse(임시토큰)
    UserVerifyController-->>User: 임시토큰 전달

    User->>UserVerifyController: POST /api/auth/reset-password (임시토큰, 새 비밀번호)
    UserVerifyController->>AuthService: resetPassword(request)
    AuthService-->>User: 비밀번호 변경 결과 응답
Loading
sequenceDiagram
    participant User
    participant UserGithubController
    participant UserGithubService

    User->>UserGithubController: PUT /api/users/github
    UserGithubController->>UserGithubService: changeAutoPushSetting(authUser)
    UserGithubService-->>UserGithubController: UserGitubAutoPushResponse
    UserGithubController-->>User: 결과 반환
Loading

Possibly related PRs

Suggested labels

enhancement, documentation

Suggested reviewers

  • Kimminu7
  • NCookies
  • pokerbearkr
  • chat26666
  • thezz9

Poem

🐇
새벽에 토끼가 코드를 짰네,
이메일 인증, 비번도 척척!
임시 토큰 건네주며
깃허브 푸시도 토글토글
컨트롤러는 더 깔끔하게
사용자는 더 안전하게
오늘도 토끼는 행복하네!
🌱
"""


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 312085f and de3782e.

📒 Files selected for processing (2)
  • src/main/java/org/ezcode/codetest/application/usermanagement/auth/dto/request/SignupRequest.java (0 hunks)
  • src/main/java/org/ezcode/codetest/application/usermanagement/auth/service/AuthService.java (4 hunks)
💤 Files with no reviewable changes (1)
  • src/main/java/org/ezcode/codetest/application/usermanagement/auth/dto/request/SignupRequest.java
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/java/org/ezcode/codetest/application/usermanagement/auth/service/AuthService.java
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

🔭 Outside diff range comments (2)
src/main/java/org/ezcode/codetest/application/usermanagement/user/service/UserService.java (1)

71-82: 일관성 문제: modifyUserInfo 메서드에서 verified 필드 누락

getUserInfo 메서드와 달리 modifyUserInfo 메서드의 응답 빌더에서 verified 필드가 누락되어 있습니다. 일관성을 위해 추가해야 합니다.

다음 수정사항을 적용하세요:

		return UserInfoResponse.builder()
			.username(user.getUsername())
			.age(user.getAge())
			.email(user.getEmail())
			.profileImageUrl(user.getProfileImageUrl())
			.blogUrl(user.getBlogUrl())
			.introduction(user.getIntroduction())
			.nickname(user.getNickname())
			.githubUrl(user.getGithubUrl())
			.userRole(user.getRole())
			.tier(user.getTier())
+			.verified(user.isVerified())
			.build();
src/main/java/org/ezcode/codetest/application/usermanagement/user/dto/response/UserInfoResponse.java (1)

63-76: 중요 이슈: fromEntity 메서드에서 verified 필드 누락

fromEntity 메서드에서 verified 필드가 누락되어 있어 일관성 문제가 있습니다. 이 메서드를 사용하는 경우 verified 값이 기본값(false)으로 설정될 수 있습니다.

다음 수정사항을 적용하세요:

	public static UserInfoResponse fromEntity(User user) {
		return UserInfoResponse.builder()
			.username(user.getUsername())
			.age(user.getAge())
			.email(user.getEmail())
			.profileImageUrl(user.getProfileImageUrl())
			.blogUrl(user.getBlogUrl())
			.introduction(user.getIntroduction())
			.nickname(user.getNickname())
			.githubUrl(user.getGithubUrl())
			.userRole(user.getRole())
			.tier(user.getTier())
+			.verified(user.isVerified())
			.build();
	}
♻️ Duplicate comments (1)
src/main/java/org/ezcode/codetest/presentation/usermanagement/UserVerifyController.java (1)

66-73: GET 메서드로 상태 변경 작업 수행 (중복)

verifyEmailCode와 동일한 문제입니다. 상태 변경 작업에는 POST 메서드 사용을 권장합니다.

🧹 Nitpick comments (7)
src/main/java/org/ezcode/codetest/presentation/usermanagement/UserGithubController.java (1)

7-7: 클래스명 오타 수정 필요

클래스명에 오타가 있습니다: UserGitubAutoPushResponseUserGithubAutoPushResponse (누락된 'h' 추가)

-import org.ezcode.codetest.application.usermanagement.user.dto.response.UserGitubAutoPushResponse;
+import org.ezcode.codetest.application.usermanagement.user.dto.response.UserGithubAutoPushResponse;
src/main/java/org/ezcode/codetest/domain/user/service/UserGithubService.java (2)

9-9: 클래스명 오타 수정 필요

앞서 지적한 것과 동일한 오타입니다: UserGitubAutoPushResponseUserGithubAutoPushResponse


25-28: 중복된 @slf4j 어노테이션 제거 필요

@slf4j 어노테이션이 중복으로 선언되어 있습니다.

-@Slf4j
 @Service
 @RequiredArgsConstructor
-@Slf4j
+@Slf4j
 public class UserGithubService {
src/main/java/org/ezcode/codetest/application/usermanagement/user/dto/response/UserGitubAutoPushResponse.java (1)

10-10: 클래스명 오타 수정 필요

파일명과 클래스명에 오타가 있습니다: UserGitubAutoPushResponseUserGithubAutoPushResponse (누락된 'h' 추가)

파일명도 함께 변경이 필요합니다.

src/main/java/org/ezcode/codetest/common/security/util/JwtUtil.java (1)

158-158: 하드코딩된 만료 시간을 상수로 추출하는 것을 고려하세요

만료 시간이 하드코딩되어 있습니다. 다른 토큰들과 일관성을 위해 클래스 상수로 추출하는 것을 고려해보세요.

private static final long TOKEN_EXPIRATION_TIME = 60 * 60 * 24 * 7;
private static final long GAME_TOKEN_EXPIRATION_TIME = 60;
+ private static final long EMAIL_TOKEN_EXPIRATION_TIME = 600 * 1000; // 10분

...

- long EXPIRATION_TIME = 600 * 1000; // 10분
+ long EXPIRATION_TIME = EMAIL_TOKEN_EXPIRATION_TIME;
src/main/java/org/ezcode/codetest/presentation/usermanagement/UserVerifyController.java (2)

37-44: HTTP 상태 코드 개선 제안

이메일 전송은 새로운 리소스 생성보다는 액션 수행에 가까우므로 HttpStatus.OK (200)가 더 적절할 수 있습니다.

-        return ResponseEntity.status(HttpStatus.CREATED).body(authService.sendEmailCode(authUser.getId(), authUser.getEmail(), request.getRedirectUrl()));
+        return ResponseEntity.status(HttpStatus.OK).body(authService.sendEmailCode(authUser.getId(), authUser.getEmail(), request.getRedirectUrl()));

46-54: GET 메서드로 상태 변경 작업 수행

이메일 인증은 사용자의 verified 상태를 변경하는 작업입니다. REST 원칙상 상태 변경은 POST 메서드가 더 적절합니다. 이메일 링크 클릭 시에도 자동으로 POST 요청을 보내도록 구현하는 것을 고려해보세요.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f78c761 and 312085f.

📒 Files selected for processing (17)
  • src/main/java/org/ezcode/codetest/application/submission/model/SubmissionContext.java (1 hunks)
  • src/main/java/org/ezcode/codetest/application/usermanagement/auth/dto/request/ResetPasswordRequest.java (0 hunks)
  • src/main/java/org/ezcode/codetest/application/usermanagement/auth/dto/response/VerifyEmailCodeResponse.java (1 hunks)
  • src/main/java/org/ezcode/codetest/application/usermanagement/auth/service/AuthService.java (3 hunks)
  • src/main/java/org/ezcode/codetest/application/usermanagement/user/dto/request/ResetPasswordRequest.java (1 hunks)
  • src/main/java/org/ezcode/codetest/application/usermanagement/user/dto/response/UserGitubAutoPushResponse.java (1 hunks)
  • src/main/java/org/ezcode/codetest/application/usermanagement/user/dto/response/UserInfoResponse.java (2 hunks)
  • src/main/java/org/ezcode/codetest/application/usermanagement/user/dto/response/VerifyFindPasswordResponse.java (1 hunks)
  • src/main/java/org/ezcode/codetest/application/usermanagement/user/service/UserService.java (1 hunks)
  • src/main/java/org/ezcode/codetest/common/security/util/JwtUtil.java (1 hunks)
  • src/main/java/org/ezcode/codetest/domain/user/model/entity/User.java (1 hunks)
  • src/main/java/org/ezcode/codetest/domain/user/service/MailService.java (1 hunks)
  • src/main/java/org/ezcode/codetest/domain/user/service/UserDomainService.java (0 hunks)
  • src/main/java/org/ezcode/codetest/domain/user/service/UserGithubService.java (3 hunks)
  • src/main/java/org/ezcode/codetest/presentation/usermanagement/AuthController.java (0 hunks)
  • src/main/java/org/ezcode/codetest/presentation/usermanagement/UserGithubController.java (2 hunks)
  • src/main/java/org/ezcode/codetest/presentation/usermanagement/UserVerifyController.java (1 hunks)
💤 Files with no reviewable changes (3)
  • src/main/java/org/ezcode/codetest/application/usermanagement/auth/dto/request/ResetPasswordRequest.java
  • src/main/java/org/ezcode/codetest/domain/user/service/UserDomainService.java
  • src/main/java/org/ezcode/codetest/presentation/usermanagement/AuthController.java
🧰 Additional context used
🧠 Learnings (8)
📓 Common learnings
Learnt from: chat26666
PR: ezcode-my/backend#37
File: src/main/java/org/ezcode/codetest/infrastructure/elasticsearch/repository/ProblemElasticsearchRepositoryDsl.java:10-10
Timestamp: 2025-06-06T19:56:27.759Z
Learning: When user chat26666 mentions that code was implemented in a previous PR but explanation was missing, they may submit a follow-up PR just to add documentation/explanation without the actual implementation code.
Learnt from: minjee2758
PR: ezcode-my/backend#9
File: src/main/java/org/ezcode/codetest/domain/user/service/UserDomainService.java:32-39
Timestamp: 2025-05-31T11:26:06.360Z
Learning: AuthService.signin() 메서드에서 userPasswordCheck 호출 시 signinRequest.getPassword() (원본 비밀번호)를 전달해야 하는데, loginUser.getPassword() (해시된 비밀번호)를 전달하는 버그가 있었음.
src/main/java/org/ezcode/codetest/domain/user/service/MailService.java (1)
Learnt from: minjee2758
PR: ezcode-my/backend#9
File: src/main/java/org/ezcode/codetest/domain/user/service/UserDomainService.java:32-39
Timestamp: 2025-05-31T11:26:06.360Z
Learning: AuthService.signin() 메서드에서 userPasswordCheck 호출 시 signinRequest.getPassword() (원본 비밀번호)를 전달해야 하는데, loginUser.getPassword() (해시된 비밀번호)를 전달하는 버그가 있었음.
src/main/java/org/ezcode/codetest/application/usermanagement/user/dto/request/ResetPasswordRequest.java (1)
Learnt from: minjee2758
PR: ezcode-my/backend#9
File: src/main/java/org/ezcode/codetest/domain/user/service/UserDomainService.java:32-39
Timestamp: 2025-05-31T11:26:06.360Z
Learning: AuthService.signin() 메서드에서 userPasswordCheck 호출 시 signinRequest.getPassword() (원본 비밀번호)를 전달해야 하는데, loginUser.getPassword() (해시된 비밀번호)를 전달하는 버그가 있었음.
src/main/java/org/ezcode/codetest/domain/user/service/UserGithubService.java (4)
Learnt from: minjee2758
PR: ezcode-my/backend#110
File: src/main/java/org/ezcode/codetest/domain/user/service/CustomOAuth2UserService.java:102-112
Timestamp: 2025-06-27T06:03:05.687Z
Learning: `CustomOAuth2UserService`의 `updateGithubUrl` 메서드는 새로운 유저 생성 시나 기존 유저가 새로운 AuthType을 추가할 때만 호출되므로, `UserGithubInfo` 중복 생성 가능성이 없다. 별도의 중복 체크 로직이 불필요하다.
Learnt from: NCookies
PR: ezcode-my/backend#65
File: src/main/java/org/ezcode/codetest/application/community/service/BaseVoteService.java:28-39
Timestamp: 2025-06-16T06:11:45.234Z
Learning: BaseVoteService 클래스에서는 기본 클래스의 toggleVote 메서드에 @Transactional을 추가하지 않고, 대신 서브클래스에서 이 메서드를 호출할 때 트랜잭션을 사용하는 방식을 선호한다.
Learnt from: minjee2758
PR: ezcode-my/backend#105
File: src/main/resources/application.properties:127-127
Timestamp: 2025-06-26T09:43:03.896Z
Learning: GitHub OAuth에서 자동 커밋 기능 구현을 위해서는 `repo` scope가 필요하며, 이는 저장소에 대한 읽기/쓰기 권한을 제공한다. `user` scope는 커밋 작성자 정보 설정을 위해 필요하다.
Learnt from: minjee2758
PR: ezcode-my/backend#105
File: src/main/resources/application.properties:127-127
Timestamp: 2025-06-26T09:43:03.896Z
Learning: GitHub OAuth에서 자동 커밋 기능을 구현하려면 `repo` scope가 필수적이며, 이는 public/private 저장소 모두에 대한 전체 접근 권한을 제공한다. 공개 저장소만 대상으로 한다면 `public_repo` scope 사용 가능하다. 더 세밀한 권한 제어가 필요하다면 OAuth App 대신 GitHub App 사용을 권장한다.
src/main/java/org/ezcode/codetest/application/usermanagement/user/dto/response/UserGitubAutoPushResponse.java (1)
Learnt from: minjee2758
PR: ezcode-my/backend#110
File: src/main/java/org/ezcode/codetest/domain/user/service/CustomOAuth2UserService.java:102-112
Timestamp: 2025-06-27T06:03:05.687Z
Learning: `CustomOAuth2UserService`의 `updateGithubUrl` 메서드는 새로운 유저 생성 시나 기존 유저가 새로운 AuthType을 추가할 때만 호출되므로, `UserGithubInfo` 중복 생성 가능성이 없다. 별도의 중복 체크 로직이 불필요하다.
src/main/java/org/ezcode/codetest/presentation/usermanagement/UserGithubController.java (1)
Learnt from: minjee2758
PR: ezcode-my/backend#110
File: src/main/java/org/ezcode/codetest/domain/user/service/CustomOAuth2UserService.java:102-112
Timestamp: 2025-06-27T06:03:05.687Z
Learning: `CustomOAuth2UserService`의 `updateGithubUrl` 메서드는 새로운 유저 생성 시나 기존 유저가 새로운 AuthType을 추가할 때만 호출되므로, `UserGithubInfo` 중복 생성 가능성이 없다. 별도의 중복 체크 로직이 불필요하다.
src/main/java/org/ezcode/codetest/presentation/usermanagement/UserVerifyController.java (3)
Learnt from: minjee2758
PR: ezcode-my/backend#43
File: src/main/java/org/ezcode/codetest/domain/user/model/entity/User.java:77-89
Timestamp: 2025-06-10T02:13:33.890Z
Learning: 이 프로젝트에서는 입력 검증을 DTO 레벨에서 수행하고 있으며, User 엔티티의 팩토리 메서드에서는 별도의 입력 검증을 하지 않는다.
Learnt from: NCookies
PR: ezcode-my/backend#17
File: src/main/java/org/ezcode/codetest/presentation/problemmanagement/ProblemAdminController.java:25-25
Timestamp: 2025-06-02T06:57:37.929Z
Learning: 이 프로젝트에서는 아직 Spring Security가 적용되지 않아서 @PreAuthorize 어노테이션이 주석 처리되어 있음. Spring Security 도입 전까지는 권한 검증 어노테이션들이 비활성화 상태임.
Learnt from: minjee2758
PR: ezcode-my/backend#9
File: src/main/java/org/ezcode/codetest/domain/user/service/UserDomainService.java:32-39
Timestamp: 2025-05-31T11:26:06.360Z
Learning: AuthService.signin() 메서드에서 userPasswordCheck 호출 시 signinRequest.getPassword() (원본 비밀번호)를 전달해야 하는데, loginUser.getPassword() (해시된 비밀번호)를 전달하는 버그가 있었음.
src/main/java/org/ezcode/codetest/application/usermanagement/auth/service/AuthService.java (2)
Learnt from: minjee2758
PR: ezcode-my/backend#9
File: src/main/java/org/ezcode/codetest/domain/user/service/UserDomainService.java:32-39
Timestamp: 2025-05-31T11:26:06.360Z
Learning: AuthService.signin() 메서드에서 userPasswordCheck 호출 시 signinRequest.getPassword() (원본 비밀번호)를 전달해야 하는데, loginUser.getPassword() (해시된 비밀번호)를 전달하는 버그가 있었음.
Learnt from: minjee2758
PR: ezcode-my/backend#43
File: src/main/java/org/ezcode/codetest/domain/user/model/entity/User.java:77-89
Timestamp: 2025-06-10T02:13:33.890Z
Learning: 이 프로젝트에서는 입력 검증을 DTO 레벨에서 수행하고 있으며, User 엔티티의 팩토리 메서드에서는 별도의 입력 검증을 하지 않는다.
🪛 GitHub Actions: CI
src/main/java/org/ezcode/codetest/application/usermanagement/auth/service/AuthService.java

[error] 264-264: Compilation error: cannot find symbol 'user' in variable 'jwtUtil' of type JwtUtil.

🔇 Additional comments (17)
src/main/java/org/ezcode/codetest/application/usermanagement/user/service/UserService.java (1)

55-55: LGTM! 사용자 인증 상태 정보 추가

사용자 정보 응답에 verified 필드를 추가한 것은 적절한 개선사항입니다.

src/main/java/org/ezcode/codetest/application/usermanagement/user/dto/response/UserInfoResponse.java (3)

44-45: LGTM! Swagger 문서화와 함께 verified 필드 추가

적절한 Swagger 어노테이션과 함께 verified 필드가 추가되었습니다.


49-49: LGTM! 생성자 파라미터 업데이트

verified 필드를 포함하도록 생성자가 올바르게 업데이트되었습니다.


60-60: LGTM! 필드 초기화 추가

verified 필드 초기화가 올바르게 추가되었습니다.

src/main/java/org/ezcode/codetest/application/submission/model/SubmissionContext.java (1)

142-142: 메서드명 변경 승인

User 엔티티의 새로운 getter 메서드에 맞춘 일관성 있는 변경입니다.

src/main/java/org/ezcode/codetest/domain/user/model/entity/User.java (1)

192-198: gitPushStatus 필드 접근자 메서드 추가 확인

GitHub auto-push 기능을 위한 필요한 getter/setter 메서드가 올바르게 추가되었습니다.

src/main/java/org/ezcode/codetest/presentation/usermanagement/UserGithubController.java (1)

50-56: 새로운 API 엔드포인트 구현 확인

GitHub auto-push 설정 토글을 위한 PUT 엔드포인트가 REST 규칙에 맞게 잘 구현되었습니다.

src/main/java/org/ezcode/codetest/domain/user/service/UserGithubService.java (1)

110-112: 레포지토리 선택 시 auto-push 자동 활성화 로직 확인

레포지토리를 선택하면 자동으로 gitPushStatus를 true로 설정하는 비즈니스 로직이 합리적입니다.

src/main/java/org/ezcode/codetest/application/usermanagement/user/dto/response/UserGitubAutoPushResponse.java (1)

1-15: DTO 구조 및 Swagger 문서화 확인

GitHub auto-push 설정 변경 응답을 위한 DTO가 적절하게 구현되었고, Swagger 문서화도 잘 되어 있습니다.

src/main/java/org/ezcode/codetest/domain/user/service/MailService.java (1)

84-84: URL 경로 변경이 새로운 비밀번호 재설정 플로우와 일치함

비밀번호 재설정 이메일의 URL이 새로운 2단계 인증 플로우에 맞게 올바르게 업데이트되었습니다.

src/main/java/org/ezcode/codetest/application/usermanagement/user/dto/response/VerifyFindPasswordResponse.java (1)

6-16: 비밀번호 찾기 응답 DTO가 잘 구성됨

레코드 클래스의 구조가 명확하고 Swagger 문서화도 적절히 되어 있습니다. 팩토리 메서드도 간단하고 효과적입니다.

src/main/java/org/ezcode/codetest/application/usermanagement/auth/dto/response/VerifyEmailCodeResponse.java (1)

8-15: 인증 결과를 명확히 표현하는 좋은 개선사항

boolean result 필드를 추가하여 이메일 인증 성공 여부를 명시적으로 나타내는 것은 API 응답을 더 명확하게 만드는 좋은 개선사항입니다.

src/main/java/org/ezcode/codetest/presentation/usermanagement/UserVerifyController.java (2)

57-64: 적절한 구현입니다!

비밀번호 찾기 요청 처리가 잘 구현되었습니다.


75-81: 잘 구현되었습니다!

비밀번호 재설정 엔드포인트가 적절히 구현되었습니다. @Valid 어노테이션을 통한 요청 검증도 좋습니다.

src/main/java/org/ezcode/codetest/application/usermanagement/auth/service/AuthService.java (3)

111-122: 응답 구조 개선이 잘 되었습니다!

VerifyEmailCodeResponse에 성공 여부를 나타내는 boolean 필드를 추가한 것은 API 응답의 명확성을 높이는 좋은 개선입니다.


236-250: verified 플래그 설정 확인 필요

비밀번호 재설정 검증 시 user.setVerified()를 호출하는데, 이것이 의도된 동작인지 확인이 필요합니다. 비밀번호 재설정과 이메일 인증은 별개의 프로세스일 수 있습니다.


252-256: resetPassword의 토큰 검증 로직은 불필요합니다

AuthService.resetPassword()에서 호출하는 jwtUtil.getUserId(request.tempResetToken())는 내부적으로

Jwts.parserBuilder()
    .setSigningKey(key)
    .build()
    .parseClaimsJws(token)

을 통해 만료된 토큰에 대해 ExpiredJwtException(JwtException의 서브클래스)을 던지며 유효성(만료 포함) 검증을 수행합니다.
따라서 별도의 만료 검증 메서드 호출이나 로직 추가는 필요하지 않습니다.

Likely an incorrect or invalid review comment.

@minjee2758 minjee2758 merged commit 7ba9ee0 into dev Jun 30, 2025
2 checks passed
@minjee2758 minjee2758 deleted the feature/userPlus branch June 30, 2025 05:57
NCookies pushed a commit that referenced this pull request Jun 30, 2025
… 필드 추가, 이메일 발송 컨트롤러 분리 (#118)

* refactor: 유저 정보 가져오는 api에 verified 여부 추가

* feature : 깃허브 자동 push 여부 선택 api 추가

* refactor : 이메일 발송 관련 api controller 분리

* refactor : 비밀번호 찾기 기능 - 이메일 인증 과정

* feature : 비밀번호 리셋 기능 추가

* 비밀번호 변경 시 예외 상황 추가

* 일반 회원가입도 랜덤 닉네임 부여
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants