Email Service edited
This commit is contained in:
parent
64c6252145
commit
e7808ec736
|
@ -132,6 +132,34 @@ public class EmailAuthService {
|
|||
return this.emailAuthDAO.save(emailAuth);
|
||||
}
|
||||
|
||||
public EmailAuth sendEmailResetPassword(Member member) throws UnsupportedEncodingException, MailException {
|
||||
EmailAuth auth = new EmailAuth();
|
||||
auth.setMember(member);
|
||||
// Todo AuthKey Generation
|
||||
|
||||
String en = emailSender.encrypt(member.getEmail());
|
||||
auth.setEmailAuthKey(en);
|
||||
|
||||
String encode = URLEncoder.encode(en, "UTF-8");
|
||||
|
||||
// System.out.println("encode = [" + encode + "]");
|
||||
Mail mail = new Mail();
|
||||
mail.setMailTo(member.getEmail());
|
||||
mail.setMailSubject("Reset Password Email");
|
||||
mail.setMailContent("http://127.0.0.1:9091/#/account/reset_password?key="+ encode +"\r\nConfirm Email");
|
||||
Map<String, Object> model = new HashMap<>();
|
||||
model.put("firstName", auth.getMember().getName());
|
||||
model.put("lastName", auth.getMember().getCompanyName());
|
||||
model.put("location", "Seoul");
|
||||
model.put("signature", "www.loafle.com");
|
||||
|
||||
mail.setModel(model);
|
||||
emailSender.sendSimpleEmail(mail);
|
||||
|
||||
this.emailAuthDAO.save(auth);
|
||||
|
||||
return auth;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -122,11 +122,9 @@ public class MemberService {
|
|||
if (null == member) {
|
||||
throw new SignInIdNotExistException();
|
||||
}
|
||||
String en = this.emailSender.encrypt(email);
|
||||
String encode = URLEncoder.encode(en, "UTF-8");
|
||||
|
||||
try {
|
||||
this.emailSender.sendSimpleEmail(email,"Password Reset Email", "http://127.0.0.1:9091/#/account/reset_password?key="+ encode +"\r\nConfirm Email");
|
||||
this.emailAuthService.sendEmailResetPassword(member);
|
||||
} catch (MailException e) {
|
||||
// Todo ReSend Mail
|
||||
e.printStackTrace();
|
||||
|
|
Loading…
Reference in New Issue
Block a user