Skip to content

Conversation

@minjee2758
Copy link
Collaborator

@minjee2758 minjee2758 commented Jul 6, 2025

image

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

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

Summary by CodeRabbit

  • 신규 기능

    • 리뷰 토큰을 별도로 조회하여 화면에 표시하는 기능이 추가되었습니다.
    • 이메일 인증 요청 버튼이 추가되어, 클릭 시 인증 메일을 발송할 수 있습니다.
  • 버그 수정

    • 문제 해결 수 표시가 기존보다 정확한 값으로 업데이트되었습니다.
  • 스타일

    • 프로필 및 정보 영역의 레이아웃과 배경색이 개선되었습니다.
    • 버튼 및 이메일 인증 UI가 이미지와 함께 더욱 직관적으로 변경되었습니다.
    • 소셜 버튼에 아이콘이 추가되고, 정렬이 개선되었습니다.
  • 문서

    • HTML 구조가 더 명확하게 그룹화되고, 일부 값이 플레이스홀더로 대체되었습니다.

@minjee2758 minjee2758 added the enhancement New feature or request label Jul 6, 2025
@coderabbitai
Copy link

coderabbitai bot commented Jul 6, 2025

Walkthrough

이 변경사항은 마이페이지의 CSS, JS, HTML 구조를 전반적으로 개선합니다. CSS는 레이아웃과 버튼, 이메일 인증 UI를 재구성하고, JS는 리뷰 토큰 조회, 이메일 인증 요청 기능을 추가 및 개선합니다. HTML은 프로필, 정보, 소셜 버튼 배치를 재구성합니다.

Changes

파일(들) 변경 요약
.../static/css/test-mypage.css .user-infos 등 레이아웃 구조 및 버튼, 이메일 인증 UI 스타일 재정비, 불필요한 색상/테두리 제거, 새로운 소셜/이메일 관련 클래스 추가
.../static/js/test-mypage.js 리뷰 토큰 별도 fetch 추가, 문제 수 필드명 변경, 이메일 인증 UI/로직 개선, 이메일 인증 요청 함수 신설 및 이벤트 바인딩
.../templates/test-mypage.html 프로필/정보/소셜 버튼 구조 세분화, 닉네임 등 값 placeholder 처리, 버튼에 이미지 아이콘 추가, 이메일 인증 라벨 구조 변경

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Browser
    participant Backend

    User->>Browser: 페이지 접속
    Browser->>Backend: GET /api/users/review-token (with token)
    Backend-->>Browser: reviewToken 반환
    Browser->>DOM: aiReview 영역에 reviewToken 표시

    Browser->>Backend: GET /api/users/me (with token)
    Backend-->>Browser: 사용자 정보 반환
    Browser->>DOM: 정보 표시

    User->>Browser: 이메일 인증 버튼 클릭
    Browser->>Backend: POST /api/email/send (with token, redirectUrl)
    Backend-->>Browser: 성공/실패 응답
    Browser->>User: 알림창(alert) 표시
Loading

Possibly related PRs

Suggested labels

documentation

Suggested reviewers

  • pokerbearkr
  • NCookies

Poem

🐰
초록빛 배경에 버튼이 춤추고
이메일 인증, 이제 한 번에 뚝딱!
리뷰 토큰도 살짝쿵 보여주니
깔끔한 마이페이지, 토끼도 신나네
코드를 만지는 손끝에
새로움이 톡톡,
오늘도 변화는 기분 좋은 점프!

✨ 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: 1

🧹 Nitpick comments (6)
src/main/resources/templates/test-mypage.html (2)

32-40: 정보 행 구조화가 잘 되었으나 플레이스홀더 값 개선이 필요합니다.

정보를 두 개의 행으로 나누어 구조화한 것은 좋으나, 하드코딩된 플레이스홀더 값들("7th", "문제", "-")을 더 명확하게 개선할 수 있습니다.

다음과 같이 더 명확한 플레이스홀더를 사용하는 것을 제안합니다:

-                        <div class="info-value" id="ranking">7th</div>
+                        <div class="info-value" id="ranking">-</div>
-                        <div class="info-value" id="solvedCount">문제</div>
+                        <div class="info-value" id="solvedCount">0</div>

41-57: info-row-2 구조는 좋으나 접근성 개선이 필요합니다.

inner 컨테이너를 활용한 구조화는 좋지만, 이메일 인증 부분에서 접근성을 개선할 수 있습니다.

이메일 인증 버튼에 접근성을 위한 속성을 추가하는 것을 제안합니다:

                            <div class="info-label email-verify">
-                                <span id="emailVerify" class="verify-text">이메일 인증</span>
+                                <span id="emailVerify" class="verify-text" role="button" tabindex="0" aria-label="이메일 인증하기">이메일 인증</span>
                            </div>
src/main/resources/static/css/test-mypage.css (3)

131-138: info-row-2 레이아웃 개선이 좋습니다.

컬럼 레이아웃으로 변경하고 inner 컨테이너를 추가한 것이 HTML 구조와 잘 맞습니다. 다만 줄 바꿈 없이 한 줄로 작성된 부분이 있습니다.

가독성을 위해 스타일을 분리하는 것을 제안합니다:

-.info-row-2-inner {
-    display: flex;align-items: center;
-}
+.info-row-2-inner {
+    display: flex;
+    align-items: center;
+}

163-176: 버튼 스타일 개선이 좋으나 순서 정리가 필요합니다.

GitHub과 블로그 버튼의 스타일을 flex 컨테이너로 변경한 것은 좋은 개선이지만, 스타일 속성 순서를 정리하면 더 좋겠습니다.

CSS 속성 순서를 논리적으로 정리하는 것을 제안합니다:

 .github-btn, .blog-btn {
+    display: flex;
+    flex-direction: column;
+    align-items: center;
+    justify-content: center;
     background: transparent;
     border: none;
     border-radius: 10px;
     padding: 8px 20px;
     font-size: 12px;
     font-weight: 800;
+    color: white;
     cursor: pointer;
     transition: background 0.2s;
-    flex-direction: column;
-    align-items: center;
-    justify-content: center;
-    display: flex;
-    color: white;
 }

194-224: 이메일 인증 UI 스타일이 잘 구현되었으나 접근성 개선이 필요합니다.

호버 효과와 인증 상태별 스타일 분리가 잘 되어 있습니다. 다만 키보드 접근성을 위한 포커스 스타일이 누락되었습니다.

키보드 접근성을 위한 포커스 스타일을 추가하는 것을 제안합니다:

 .email-verify .email-verify:hover {
     box-shadow: 0 0 8px rgba(0, 123, 255, 0.7);
 }
+
+.email-verify .email-verify:focus {
+    outline: 2px solid #007bff;
+    outline-offset: 2px;
+}
src/main/resources/static/js/test-mypage.js (1)

90-108: 이메일 인증 UI 처리 로직 개선이 좋습니다.

이미지 엘리먼트를 활용한 UI 개선과 동적 이벤트 바인딩이 잘 구현되어 있습니다. 다만 접근성 개선이 필요합니다.

키보드 접근성을 위한 속성을 추가하는 것을 제안합니다:

         emailVerify.innerHTML = `
             <img src="/images/email-verify.png" 
                  alt="이메일 인증하기" 
                  class="email-verify clickable" 
-                 id="emailVerifyButton" />
+                 id="emailVerifyButton" 
+                 tabindex="0" 
+                 role="button" />
         `;
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 0f0fa26 and 754d6a0.

⛔ Files ignored due to path filters (2)
  • src/main/resources/static/images/check.png is excluded by !**/*.png
  • src/main/resources/static/images/email-verify.png is excluded by !**/*.png
📒 Files selected for processing (3)
  • src/main/resources/static/css/test-mypage.css (3 hunks)
  • src/main/resources/static/js/test-mypage.js (3 hunks)
  • src/main/resources/templates/test-mypage.html (1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 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: thezz9
PR: ezcode-my/backend#73
File: src/main/resources/templates/submit-test.html:135-135
Timestamp: 2025-06-18T11:41:58.457Z
Learning: src/main/resources/templates/submit-test.html 파일은 테스트용 파일로, isCorrect 값의 하드코딩은 의도적이며 사용자가 UI 요소를 통해 정답/오답 상태를 선택할 수 있도록 개선 예정입니다.
src/main/resources/static/js/test-mypage.js (1)
Learnt from: thezz9
PR: ezcode-my/backend#75
File: src/main/java/org/ezcode/codetest/application/submission/service/SubmissionService.java:142-147
Timestamp: 2025-06-19T07:00:53.895Z
Learning: SubmissionService.getCodeReview() 메서드에서 토큰 차감을 리뷰 요청 전에 수행하는 이유: OpenAI 서버 장애보다 유저 토큰 부족 상황이 더 빈번하므로, 확률이 높은 실패 케이스를 먼저 체크하여 불필요한 처리를 방지함. OpenAI 서버 장애 시에는 OpenAIClient에서 트랜잭션 롤백으로 토큰 복원이 처리됨.
src/main/resources/templates/test-mypage.html (1)
Learnt from: thezz9
PR: ezcode-my/backend#73
File: src/main/resources/templates/submit-test.html:135-135
Timestamp: 2025-06-18T11:41:58.457Z
Learning: src/main/resources/templates/submit-test.html 파일은 테스트용 파일로, isCorrect 값의 하드코딩은 의도적이며 사용자가 UI 요소를 통해 정답/오답 상태를 선택할 수 있도록 개선 예정입니다.
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build
🔇 Additional comments (6)
src/main/resources/templates/test-mypage.html (2)

25-31: 프로필 섹션 구조 개선이 잘 되었습니다.

프로필 이미지와 닉네임을 별도 섹션으로 분리한 것은 레이아웃 관리 측면에서 좋은 개선입니다. 하드코딩된 "ezcode"를 "닉네임"으로 변경한 것도 적절합니다.


60-69: 소셜 버튼 컨테이너 추가가 좋습니다.

GitHub 아이콘과 블로그 버튼을 별도 컨테이너로 분리한 것은 레이아웃 관리에 도움이 됩니다. GitHub 아이콘 이미지 추가도 UX 개선에 기여합니다.

src/main/resources/static/css/test-mypage.css (2)

71-71: 배경색 변경이 적절합니다.

user-infos 섹션의 배경색을 #0B1C17로 변경한 것이 전체 디자인과 잘 어울립니다.


178-181: GitHub 아이콘 스타일이 적절합니다.

GitHub 버튼용 아이콘 이미지 크기 설정이 적절합니다.

src/main/resources/static/js/test-mypage.js (2)

18-40: 리뷰 토큰 조회 기능 추가가 좋습니다.

별도의 API 호출로 리뷰 토큰을 가져오는 구조가 좋습니다. 에러 처리도 적절하게 되어 있습니다.


64-64: totalSolvedCount 사용으로 변경이 적절합니다.

기존 solvedCount에서 totalSolvedCount로 변경한 것이 더 명확한 네이밍입니다.

Comment on lines +111 to 143
async function sendEmailVerification() {
const accessToken = sessionStorage.getItem('accessToken');

if (!accessToken) {
alert('로그인이 필요합니다.');
return;
}

try {
const response = await fetch('/api/email/send', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': accessToken
},
body: JSON.stringify({
redirectUrl: 'http://localhost:8080'
})
});

if (response.ok) {
const result = await response.json();
alert('인증 메일이 발송되었습니다.');
console.log(result);
} else {
const error = await response.json();
alert(`오류: ${error.message || '인증 요청 실패'}`);
}
} catch (err) {
console.error('이메일 인증 오류:', err);
alert('서버 오류가 발생했습니다.');
}
}
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

이메일 인증 전송 기능이 잘 구현되었으나 보안 및 설정 개선이 필요합니다.

API 호출 로직과 에러 처리가 적절하게 구현되어 있습니다. 다만 하드코딩된 URL과 보안 관련 개선이 필요합니다.

다음 개선사항들을 제안합니다:

+// 환경별 설정을 위한 상수
+const CONFIG = {
+    redirectUrl: window.location.origin
+};
+
 async function sendEmailVerification() {
     const accessToken = sessionStorage.getItem('accessToken');
 
     if (!accessToken) {
         alert('로그인이 필요합니다.');
         return;
     }
 
     try {
         const response = await fetch('/api/email/send', {
             method: 'POST',
             headers: {
                 'Content-Type': 'application/json',
                 'Authorization': accessToken
             },
             body: JSON.stringify({
-                redirectUrl: 'http://localhost:8080'
+                redirectUrl: CONFIG.redirectUrl
             })
         });

또한 CSRF 보안을 위한 토큰 검증을 고려해보세요.

CSRF 보안 설정이 적절히 되어 있는지 확인하기 위해 다음 스크립트를 실행해보세요:


🏁 Script executed:

#!/bin/bash
# CSRF 보안 설정 확인
rg -A 10 -B 5 "csrf" --type java

Length of output: 1925


CSRF 전역 비활성화 확인 및 redirectUrl 하드코딩 제거 필요

이메일 인증 전송 기능은 정상 동작하나, 현 코드에서는 하드코딩된 redirectUrl과 전역 CSRF 비활성화로 인한 보안 취약점이 발견되었습니다.

  • 적용 위치

    • src/main/resources/static/js/test-mypage.js (약 111–143행)
    • src/main/java/org/ezcode/codetest/common/security/config/SecurityConfig.java
  • 개선 사항

    1. redirectUrl 환경 설정화
      하드코딩된 URL 대신 런타임 호스트를 참조하도록 변경합니다.
      +// 환경별 설정을 위한 상수
      +const CONFIG = {
      +    redirectUrl: window.location.origin
      +};
       
       async function sendEmailVerification() {
           …
           const response = await fetch('/api/email/send', {
               …
               body: JSON.stringify({
      -            redirectUrl: 'http://localhost:8080'
      +            redirectUrl: CONFIG.redirectUrl
               })
           });
           …
       }
    2. CSRF 설정 재검토
      현재 SecurityConfig.java에서 .csrf(AbstractHttpConfigurer::disable())로 전역 비활성화되어 있습니다.
      • 특정 엔드포인트에만 CSRF를 비활성화하거나
      • CSRF 토큰 검증을 유지한 채 JWT 인증을 도입하거나
      • SameSite 쿠키 설정 등 추가 방어책을 적용하십시오.

위 두 가지를 반영해 보안 및 설정 유연성을 강화해주세요.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
async function sendEmailVerification() {
const accessToken = sessionStorage.getItem('accessToken');
if (!accessToken) {
alert('로그인이 필요합니다.');
return;
}
try {
const response = await fetch('/api/email/send', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': accessToken
},
body: JSON.stringify({
redirectUrl: 'http://localhost:8080'
})
});
if (response.ok) {
const result = await response.json();
alert('인증 메일이 발송되었습니다.');
console.log(result);
} else {
const error = await response.json();
alert(`오류: ${error.message || '인증 요청 실패'}`);
}
} catch (err) {
console.error('이메일 인증 오류:', err);
alert('서버 오류가 발생했습니다.');
}
}
// 환경별 설정을 위한 상수
const CONFIG = {
redirectUrl: window.location.origin
};
async function sendEmailVerification() {
const accessToken = sessionStorage.getItem('accessToken');
if (!accessToken) {
alert('로그인이 필요합니다.');
return;
}
try {
const response = await fetch('/api/email/send', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': accessToken
},
body: JSON.stringify({
redirectUrl: CONFIG.redirectUrl
})
});
if (response.ok) {
const result = await response.json();
alert('인증 메일이 발송되었습니다.');
console.log(result);
} else {
const error = await response.json();
alert(`오류: ${error.message || '인증 요청 실패'}`);
}
} catch (err) {
console.error('이메일 인증 오류:', err);
alert('서버 오류가 발생했습니다.');
}
}
🤖 Prompt for AI Agents
In src/main/resources/static/js/test-mypage.js around lines 111 to 143, replace
the hardcoded redirectUrl with a dynamic value derived from the current runtime
host, such as using window.location.origin, to avoid fixed URLs. Additionally,
in src/main/java/org/ezcode/codetest/common/security/config/SecurityConfig.java,
revise the global CSRF disablement by either enabling CSRF protection globally
and selectively disabling it only for specific endpoints like the email API, or
implement JWT authentication with CSRF tokens maintained, or apply other
mitigations like SameSite cookie attributes to enhance security while preserving
necessary CSRF defenses.

@thezz9 thezz9 merged commit a15e29a into dev Jul 6, 2025
2 checks passed
@thezz9 thezz9 deleted the feature/mypage branch July 6, 2025 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants