Skip to content

Commit

Permalink
Merge pull request #61 from taking/taking
Browse files Browse the repository at this point in the history
Chore: InviteOrg Update
  • Loading branch information
taking authored Nov 2, 2023
2 parents 3085978 + d42baee commit 9df74c9
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 40 deletions.
4 changes: 1 addition & 3 deletions nw/src/main/java/lab/cherry/nw/controller/OrgController.java
Original file line number Diff line number Diff line change
Expand Up @@ -197,14 +197,12 @@ public ResponseEntity<?> deleteOrganization(@PathVariable("id") String id) {
return new ResponseEntity<>(response, new HttpHeaders(), HttpStatus.OK);
}



@GetMapping("/invite")
@Operation(summary = "사용자(랑부) 초대", description = "이메일로 조직 초대 메일을 발송합니다.")
public ResponseEntity<?> inviteUser(@RequestParam(required = false) String orgid, @RequestParam(required = false) String email) {
log.info("[OrgController] inviteUser...!");

orgService.inviteUser(orgid, email);
orgService.inviteOrgSend(orgid, email);
final ResultResponse response = ResultResponse.of(SuccessCode.EMAIL_INVITE_USER_OK);
return new ResponseEntity<>(response, new HttpHeaders(), HttpStatus.OK);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public enum SuccessCode {
FILE_UPLOAD_SUCCESS(200, "파일 업로드 완료"),
REGISTER_SUCCESS(200, "회원가입 완료"),
USERID_CHECK_OK(200, "사용 가능합니다."),
PASSWORD_RESET_OK(200, "비밀번호 초기화 이메일 발송 완료"),
PASSWORD_RESET_OK(200, "초기화 비밀번호 이메일 발송 완료"),
EMAIL_INVITE_USER_OK(200, "사용자(랑부) 초대 이메일 발송 완료"),
EMAIL_CHECK_OK(200, "이메일 인증 완료"),
EMAIL_RESEND_OK(200, "이메일 인증 메일 재발송 완료");
Expand Down
3 changes: 1 addition & 2 deletions nw/src/main/java/lab/cherry/nw/service/EmailAuthService.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ public interface EmailAuthService {
EmailAuthEntity updateExpired(String email);
Optional<EmailAuthEntity> findValidAuthByEmail(String email, String token);
void ConfirmEmailSend(String email, String token);
// void InviteOrgSend(String orgname, String email, String token);
void InviteOrgSend(String orgid, String orgname, String email);
void ResetPasswordSend(String email, String password);
void InviteUserSend(String orgid, String orgname, String email);

}
Original file line number Diff line number Diff line change
Expand Up @@ -89,36 +89,6 @@ public void ConfirmEmailSend(String email, String token) {

}

// public void InviteOrgSend(String orgname, String email, String token) {

// MimeMessage message = javaMmailSender.createMimeMessage();
// String _link = FRONTEND_ADDR + "/auth/register/confirm?email" + email + "&token=" + token;
// // "/api/auth/register/confirm?email" + email + "&token=" + token;

// try {
// message.addRecipients(MimeMessage.RecipientType.TO, email);
// message.setFrom(EmailAuthServiceImpl.FROM_ADDRESS);
// message.setSubject("[낭만웨딩] " + orgname + " 회원가입 요청 메일입니다."); //제목
// String text="";
// text+= "<div style='margin:100px;'>";
// text+= "<div align='center' style='border:1px solid black; font-family:verdana';>";
// text+= "<h3 style='color:blue;'>다음 링크를 눌러 회원가입을 진행하세요.</h3>";
// text+= "<p>회원이시라면 링크를 누르면 [" + orgname + "]에 소속됩니다.</p>";
// text+= "<div style='font-size:130%'>";
// text+= "LINK : <strong>";
// text+= "<a href=" + "'" + _link + "'>진행하기</a>" + "</strong><div><br/> ";
// text+= "</div>";
// message.setText(text, "utf-8", "html");

// javaMmailSender.send(message);


// } catch (MessagingException e) {
// log.error("email Error {}", e);
// }
// }


public void ResetPasswordSend(String email, String password) {

MimeMessage message = javaMmailSender.createMimeMessage();
Expand Down Expand Up @@ -146,7 +116,7 @@ public void ResetPasswordSend(String email, String password) {
}


public void InviteUserSend(String orgid, String orgname, String email) {
public void InviteOrgSend(String orgid, String orgname, String email) {

MimeMessage message = javaMmailSender.createMimeMessage();
String _link = FRONTEND_ADDR + "/auth/register/org/" + orgid;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,10 @@ public Page<OrgEntity> findPageByName(String name, Pageable pageable) {
return orgRepository.findPageByName(name, pageable);
}

public void inviteUser(String orgid, String email) {
public void inviteOrgSend(String orgid, String email) {

OrgEntity orgEntity = findById(orgid);
emailAuthService.InviteUserSend(orgid, orgEntity.getName(), email);
emailAuthService.InviteOrgSend(orgEntity.getId(), orgEntity.getName(), email);

}
}
2 changes: 1 addition & 1 deletion nw/src/main/java/lab/cherry/nw/service/OrgService.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ public interface OrgService {
OrgEntity findByName(String name);
void deleteById(String id);
Page<OrgEntity> findPageByName(String name, Pageable pageable);
void inviteUser(String orgid, String email);
void inviteOrgSend(String orgid, String email);
List<OrgEntity> getOrganizationList();
}

0 comments on commit 9df74c9

Please sign in to comment.