diff --git a/backend/src/main/java/com/edufocus/edufocus/user/controller/UserController.java b/backend/src/main/java/com/edufocus/edufocus/user/controller/UserController.java index 9e1ebe5..828f717 100644 --- a/backend/src/main/java/com/edufocus/edufocus/user/controller/UserController.java +++ b/backend/src/main/java/com/edufocus/edufocus/user/controller/UserController.java @@ -39,11 +39,11 @@ public class UserController { userService.join(user); return ResponseEntity.ok("User registered successfully"); } - @PostMapping("/findpassword/{user_id}") - public ResponseEntity findpassword(@PathVariable("user_id") Long user_id) throws Exception { - userService.userCheck(user_id); - return ResponseEntity.ok("임시 비밀번호가 이메일로 전송되었습니다."); - } +// @PostMapping("/findpassword/{user_id}") +// public ResponseEntity findpassword(@PathVariable("user_id") Long user_id) throws Exception { +// userService.userCheck(user_id); +// return ResponseEntity.ok("임시 비밀번호가 이메일로 전송되었습니다."); +// } @PutMapping("/updateinfo") public ResponseEntity updateUserInfo( diff --git a/backend/src/main/java/com/edufocus/edufocus/user/model/entity/MailDto.java b/backend/src/main/java/com/edufocus/edufocus/user/model/entity/MailDto.java deleted file mode 100644 index b2e1e51..0000000 --- a/backend/src/main/java/com/edufocus/edufocus/user/model/entity/MailDto.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.edufocus.edufocus.user.model.entity; - -import lombok.Data; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@Getter -@Setter -@NoArgsConstructor -@ToString -@Data -public class MailDto { - - private String address; - private String title; - private String message; - -} \ No newline at end of file diff --git a/backend/src/main/java/com/edufocus/edufocus/user/model/service/UserService.java b/backend/src/main/java/com/edufocus/edufocus/user/model/service/UserService.java index e8ea468..9252869 100644 --- a/backend/src/main/java/com/edufocus/edufocus/user/model/service/UserService.java +++ b/backend/src/main/java/com/edufocus/edufocus/user/model/service/UserService.java @@ -11,9 +11,7 @@ public interface UserService { String getRefreshToken(Long id) throws Exception; void deleteRefreshToken(Long id) throws Exception; User userInfo(Long id) throws Exception; - void sendEamail(User user) throws Exception; - void userCheck(Long id) throws Exception; - String getUserName(Long id) throws Exception; + String getUserName(Long id) throws Exception; void changeUserInfo(InfoDto infoDto,Long id) throws Exception; void changePassword(PasswordDto passwordDto,Long id) throws Exception; diff --git a/backend/src/main/java/com/edufocus/edufocus/user/model/service/UserServiceImpl.java b/backend/src/main/java/com/edufocus/edufocus/user/model/service/UserServiceImpl.java index 6c3feec..c6301c0 100644 --- a/backend/src/main/java/com/edufocus/edufocus/user/model/service/UserServiceImpl.java +++ b/backend/src/main/java/com/edufocus/edufocus/user/model/service/UserServiceImpl.java @@ -23,7 +23,6 @@ public class UserServiceImpl implements UserService { private final UserRepository userRepository; - private final JavaMailSender mailSender;//private final PasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); public void join(User user) @@ -61,56 +60,10 @@ public class UserServiceImpl implements UserService { } - @Override - public void sendEamail(User user) throws Exception { - MailDto mailDto = createMailAndChargePassword(user); - SimpleMailMessage message = new SimpleMailMessage(); - message.setTo(mailDto.getAddress()); - message.setFrom("passfinder111@gmail.com"); - message.setSubject(mailDto.getTitle()); - message.setText(mailDto.getMessage()); - - - mailSender.send(message); - - - } - - public MailDto createMailAndChargePassword(User user) throws SQLException { - String str = getTempPassword(); - MailDto dto = new MailDto(); - dto.setAddress(user.getEmail()); - dto.setTitle(user.getUserId() + "님의 임시비밀번호 안내 이메일 입니다."); - dto.setMessage("안녕하세요. EduFoucs 입니다. " + "\n" + "임시비밀번호 안내 관련 메일 입니다." + "\n[" + user.getName() + "]" + "님의 임시 비밀번호는 " - + str + " 입니다."); - - System.out.println(dto); - - MemberChangeDto memberChangeDto = new MemberChangeDto(user.getId(), str); - userRepository.updatePassword(memberChangeDto.getId(), memberChangeDto.getPassword()); - - return dto; - } - - @Override - public void userCheck(Long id) throws Exception { - - User user = userRepository.findById(id).orElse(null); - - - if (user == null) { - throw new UserException("유효하지 않은 아이디입니다. 다시 입력하세요"); - - } else { - - sendEamail(user); - } - } - @Override public String getUserName(Long id) throws Exception { diff --git a/backend/src/main/resources/application.properties b/backend/src/main/resources/application.properties index 0f03472..4b851bd 100644 --- a/backend/src/main/resources/application.properties +++ b/backend/src/main/resources/application.properties @@ -36,15 +36,6 @@ spring.jpa.show-sql=true management.endpoints.web.exposure.include=health,info management.endpoint.health.show-details=always -spring.mail.host=smtp.gmail.com -spring.mail.port=587 -#spring.mail.username=ssafytestpjt -#spring.mail.password=trpjbxqialufuzih -spring.mail.username=passfinder111@gmail.com -spring.mail.password=mnlyfkiprltjlsmw - -spring.mail.properties.mail.smtp.auth=true -spring.mail.properties.mail.smtp.starttls.enable=true spring.rabbitmq.host=${RABBITMQ_HOST}