Skip to content

[Feat]#6

Open
vvzvvv wants to merge 16 commits intomainfrom
feature/#5
Open

[Feat]#6
vvzvvv wants to merge 16 commits intomainfrom
feature/#5

Conversation

@vvzvvv
Copy link
Owner

@vvzvvv vvzvvv commented Oct 11, 2025

📝 PR 요약

  • 회원가입/로그인/비밀번호 변경/찾기 로직에 statusCode 및 responseMessage 상수를 적용하였습니다.

  • 로그인 및 회원가입 페이지의 오류 알림 방식을 alert에서 토스트 메시지로 전환하여 UX를 개선했습니다.

  • 불필요한 파일과 디버깅 코드를 제거하고 모듈 순서를 정리하는 등 전반적인 코드 클린업을 수행했습니다.

  • resolved: [FEATURE] 회원가입/로그인 페이지 - 기존 alert 삭제 및 토스트 메시지 도입 #5


📌 변경 사항 및 주의 사항

기능 및 UX 개선 (feat)

  • 토스트 메시지 도입: 오류 알림 함수(showToast) 및 관련 CSS를 추가하고, 로그인 페이지의 오류 알림 방식alert에서 토스트 메시지로 변경했습니다.
  • 상수 정의 확장: statusCoderesponseMessage 상수를 추가하고, 회원가입 및 프로필 관련 메시지를 추가로 작성했습니다.
  • 파일 업로드 설정: .gitignore에 사용자가 업로드한 이미지 경로를 추가하여, 업로드한 파일이 커밋되지 않게 했습니다.

구조 및 로직 개선 (refactor & cleanup)

  • 인증 로직 상수화: 로그인, 비밀번호 찾기/변경 로직의 응답 상태 코드와 메시지를 상수로 대체하여 하드코딩된 값을 제거했습니다.
  • 코드 클린업: console.log()var 사용을 제거하고, require 모듈의 순서를 표준 컨벤션에 맞게 정리했습니다.

불필요 파일 제거

  • 기존 환자/의사 구분이 없는 join.ejs 파일을 삭제하고, 의사 가입 시 사용되던 인증서 이미지 파일을 삭제했습니다.

vvzvvv added 15 commits October 6, 2025 19:41
- 응답 상태 코드를 하드코딩된 숫자 대신 statusCode 상수로 대체함
- 응답 메시지를 responseMessage 상수로 대체
- console.log()와 var 사용 제거
- 사용자가 서버에 업로드하는 이미지 파일을 Git 추적에서 제외함
- 기존의 가입 페이지 코드 삭제
- 의사 계정 가입 기능을 개발하기 전(환자 계정만 있었을 때), 사용하던 코드였음
- 의사 기능 만들면서 join 을 patientJoin, doctorJoin 으로 재구현함
- 응답 상태 코드 및 메시지를 statusCode 및 responseMessage 상수로 대체함
- 디버깅용 console.log()를 제거하고 require 모듈 순서를 정리하여 코드 클린업을 진행함
- 매직넘버로 되어있던 salt 값을 상수로 변경
- 응답 상태 코드 및 응답 메시지를 statusCode, responseMessage 상수로 대체함
- 불필요한 console.log()를 제거, require 모듈 순서 정리
@vvzvvv vvzvvv self-assigned this Oct 11, 2025
@vvzvvv vvzvvv added the ✨ feature 새로운 기능 label Oct 11, 2025
@gemini-code-assist
Copy link

Summary of Changes

Hello @vvzvvv, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

이 PR은 사용자 인증 및 등록 흐름을 리팩토링하여 응답 메시지와 상태 코드를 전용 상수 파일로 중앙 집중화합니다. 또한, 이메일 확인, 회원가입, 로그인과 같은 사용자 상호작용 시 메시지 표시를 위해 기본 브라우저 alert() 호출을 사용자 정의 토스트 알림 시스템으로 대체하여 사용자 경험을 향상시킵니다. 추가적으로, 스타일시트 이름을 변경하고 일반적인 회원가입 페이지를 제거하여 CSS 구조를 간소화하고 보다 전문화된 등록 프로세스를 제안합니다.

Highlights

  • 응답 메시지 및 상태 코드 중앙화: 하드코딩된 응답 메시지와 HTTP 상태 코드를 constants/responseMessage.jsconstants/statusCode.js 파일의 상수로 대체하여 일관성과 유지보수성을 향상시켰습니다.
  • 사용자 경험 개선 (토스트 알림): 기존의 브라우저 alert() 메시지를 사용자 친화적인 커스텀 토스트 알림 시스템으로 교체하여 이메일 확인, 회원가입, 로그인 등 사용자 상호작용 시 메시지 표시 방식을 개선했습니다.
  • 파일 구조 및 정리: public/stylesheets/users/user.css 파일을 public/stylesheets/user.css로 이름을 변경하고, 일반적인 views/user/join.ejs 파일을 제거하여 파일 구조를 간소화했습니다. 또한, 업로드된 파일을 .gitignore에 추가하여 버전 관리에서 제외했습니다.
  • 회원가입 및 로그인 로직 개선: 의사 및 환자 회원가입 컨트롤러에서 성공적인 리소스 생성에 대한 HTTP 상태 코드를 200 OK에서 201 Created로 변경하고, 로그인 로직의 응답 메시지를 표준화했습니다.
  • 비밀번호 변경 및 초기화 로직 강화: 비밀번호 변경 시 bcrypt.hash의 솔트 라운드를 명시적으로 설정하고, 비밀번호 초기화 링크 전송 및 처리 로직을 개선하여 보안 및 일관성을 높였습니다.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

전반적으로 코드의 일관성과 유지보수성을 높이는 좋은 변경 사항들이 많이 포함되어 있습니다. 특히, 하드코딩된 상태 코드와 응답 메시지를 상수로 대체한 점, console.log를 제거한 점, 그리고 사용자 경험을 개선하기 위해 alert 대신 toast 메시지를 도입한 점이 인상적입니다. 몇 가지 개선할 수 있는 부분을 발견하여 리뷰 코멘트를 남겼습니다. 확인 부탁드립니다.

} catch (err) {
console.error('Error:', err);
alert(`${error.message}`);
showToast(`${error.message}`);

Choose a reason for hiding this comment

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

high

catch 블록에서 error 변수가 정의되지 않았습니다. err 변수를 사용하여 에러 메시지를 표시해야 합니다.

        showToast(err.message);

ALREADY_EMAIL: '이미 사용중인 이메일입니다.',
NON_AVAILABLE_EMAIL: '이미 사용중인 이메일입니다.',
AVAILABLE_EMAIL: '사용 가능한 이메일입니다.',
DIFFRERENT_PASSWORD: '비밀번호와 비밀번호 확인이 일치하지 않습니다',

Choose a reason for hiding this comment

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

medium

DIFFRERENT_PASSWORD에 오타가 있습니다. DIFFERENT_PASSWORD로 수정하는 것이 좋겠습니다.

Suggested change
DIFFRERENT_PASSWORD: '비밀번호와 비밀번호 확인이 일치하지 않습니다',
DIFFERENT_PASSWORD: '비밀번호와 비밀번호 확인이 일치하지 않습니다',

return res.status(200).send({ message: "회원가입 되었습니다.\n로그인 해주세요."});

return res.status(statusCode.OK).send({ message: responseMessage.CREATED_USER });

Choose a reason for hiding this comment

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

medium

새로운 환자 리소스가 생성되었으므로, HTTP 상태 코드로 200 OK 대신 201 Created를 반환하는 것이 RESTful API 설계 원칙에 더 부합합니다. joinDoctorPOST.js에서도 201 Created를 사용하고 있으므로 일관성을 위해 수정하는 것을 권장합니다.

Suggested change
return res.status(statusCode.OK).send({ message: responseMessage.CREATED_USER });
return res.status(statusCode.CREATED).send({ message: responseMessage.CREATED_USER });

// 비밀번호 더블체크 로직
if (newPassword !== doubleCheckNewPassword) {
return res.status(400).send('비밀번호 불일치');
return res.status(statusCode.BAD_REQUEST).send(responseMessage.DIFFRERENT_PASSWORD);

Choose a reason for hiding this comment

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

medium

다른 API 응답과 일관성을 유지하기 위해, 문자열 대신 JSON 객체 형태로 응답을 보내는 것이 좋습니다.

Suggested change
return res.status(statusCode.BAD_REQUEST).send(responseMessage.DIFFRERENT_PASSWORD);
return res.status(statusCode.BAD_REQUEST).send({ message: responseMessage.DIFFRERENT_PASSWORD });

});
} catch (error) {
res.status(500).send({ message: "비밀번호 변경이 실패하였습니다.\n나중에 다시 시도해주세요."});
res.status(500).send({ message: responseMessage.FAIL_UPDATE_PASSWORD });

Choose a reason for hiding this comment

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

medium

catch 블록에서 하드코딩된 상태 코드 500을 사용하고 있습니다. 일관성을 위해 statusCode.INTERNAL_SERVER_ERROR 상수를 사용하도록 수정하는 것이 좋습니다.

Suggested change
res.status(500).send({ message: responseMessage.FAIL_UPDATE_PASSWORD });
res.status(statusCode.INTERNAL_SERVER_ERROR).send({ message: responseMessage.FAIL_UPDATE_PASSWORD });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨ feature 새로운 기능

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] 회원가입/로그인 페이지 - 기존 alert 삭제 및 토스트 메시지 도입

1 participant