-
Notifications
You must be signed in to change notification settings - Fork 2
[ feat ] : 이메일 인증 #432
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The head ref may contain hidden characters: "front/refact/#421-\uBC1C\uD45C-\uC804-\uCD5C\uC885-\uC218\uC815"
[ feat ] : 이메일 인증 #432
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,8 @@ | |
| import com.example.booktree.category.entity.Category; | ||
| import com.example.booktree.category.repository.CategoryRepository; | ||
| import com.example.booktree.comment.repository.CommentRepository; | ||
| import com.example.booktree.email.entity.EmailMessage; | ||
| import com.example.booktree.email.service.EmailService; | ||
| import com.example.booktree.exception.BusinessLogicException; | ||
| import com.example.booktree.exception.ExceptionCode; | ||
| import com.example.booktree.follow.repository.FollowRepository; | ||
|
|
@@ -60,6 +62,7 @@ public class UserService { | |
|
|
||
|
|
||
| private final PasswordEncoder passwordEncoder; | ||
| private final EmailService emailService; | ||
| private final TokenService tokenService; | ||
| private final ImageService imageService; | ||
| private static final String USER_IMAGE= DEFAULT_USER_IMAGE; | ||
|
|
@@ -139,16 +142,19 @@ public User findUserByEmail(String email){ | |
|
|
||
| } | ||
|
|
||
| //임시 비밀번호 발급 - 이메일로 비밀번호 | ||
| public String findPasswordByEmail(String email){ | ||
|
|
||
| public void findPasswordByEmail(String email){ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 임시 비밀번호 생성 로직( |
||
| EmailMessage emailMessage = EmailMessage.builder() | ||
| .to(email) | ||
| .subject("[BookTree] 임시 비밀번호 발급") | ||
| .build(); | ||
| User user = findUserByEmail(email); | ||
| String randomPassword = CreateRandomNumber.randomNumber(); | ||
| user.setPassword(passwordEncoder.encode(randomPassword)); | ||
| userRepository.save(user); | ||
| return randomPassword; | ||
| } | ||
|
|
||
| emailService.sendMail(emailMessage, "password",randomPassword); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 이메일 전송에 사용되는 |
||
|
|
||
| } | ||
| //임시 비밀번호 발급 - 이메일, 핸드폰으로 비밀번호 | ||
| public String findPasswordByEmailAndPhone(UserPasswordRequestDto.FindPwByEmailAndPhone findPwByEmailAndPhone){ | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -334,10 +334,35 @@ export function CommentsSection({ postId }: { postId: number }) { | |
| }, [activeCommentId, activeReplyPopoverId]) | ||
|
|
||
| // ─── 프로필 이미지 불러오기 ──────────────────────────────────── | ||
| // useEffect(() => { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 주석 처리된 코드는 필요없는 코드인가요? 필요하다면 주석을 제거하고, 코드 스타일과 가독성을 개선하여 |
||
| // if (!comments.length) return | ||
| // const ids = Array.from( | ||
| // new Set([...comments.map((c) => c.userId), ...comments.flatMap((c) => c.replies.map((r) => r.userId))]), | ||
| // ) | ||
| // async function fetchUserImages() { | ||
| // const map: Record<number, string> = {} | ||
| // await Promise.all( | ||
| // ids.map(async (id) => { | ||
| // try { | ||
| // const res = await fetch(`${API}/api/v1/users/get/profile/${id}`) | ||
| // if (!res.ok) return | ||
| // const { imageUrl } = await res.json() | ||
| // map[id] = imageUrl | ||
| // } catch {} | ||
| // }), | ||
| // ) | ||
| // setUserImages(map) | ||
| // } | ||
| // fetchUserImages() | ||
| // }, [comments]) | ||
|
|
||
| useEffect(() => { | ||
| if (!comments.length) return | ||
| if (!rawComments.length) return | ||
| const ids = Array.from( | ||
| new Set([...comments.map((c) => c.userId), ...comments.flatMap((c) => c.replies.map((r) => r.userId))]), | ||
| new Set([ | ||
| ...rawComments.map((c) => c.userId), | ||
| ...rawComments.flatMap((c) => c.replies.map((r) => r.userId)), | ||
| ]), | ||
| ) | ||
| async function fetchUserImages() { | ||
| const map: Record<number, string> = {} | ||
|
|
@@ -354,7 +379,7 @@ export function CommentsSection({ postId }: { postId: number }) { | |
| setUserImages(map) | ||
| } | ||
| fetchUserImages() | ||
| }, [comments]) | ||
| }, [rawComments]) | ||
|
|
||
| // ─── 렌더링 ──────────────────────────────────────────────────── | ||
| return ( | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EmailService 의존성 주입이 잘 되었는지 확인해야 합니다.
@Autowired어노테이션을 사용했는지,@Service로 선언된 EmailService Bean이 제대로 등록되었는지 확인해주세요.