This repository has been archived by the owner on Jan 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
694602a
commit a5d6223
Showing
5 changed files
with
20 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -106,8 +106,10 @@ public User registerNewUserAccount(CreateUserDTO dto, HttpServletRequest request | |
log.info("RegisterNewAccountRAN!"); | ||
|
||
//Send Verification Email To that user | ||
String siteURL = Utility.getSiteURL(request); //get site for verification email | ||
//String siteURL = Utility.getSiteURL(request); //get site for verification email | ||
//createVerificationToken(u, UUID.randomUUID().toString()); | ||
//TODO CHANGE BEFORE GOING LIVE | ||
String siteURL="https://fridger.recipes"; | ||
sendVerificationEmail(u,siteURL); | ||
log.info("Sent email to "+u.getEmail()); | ||
|
||
|
@@ -117,7 +119,6 @@ public User registerNewUserAccount(CreateUserDTO dto, HttpServletRequest request | |
|
||
public void sendVerificationEmail(User user, String siteURL) | ||
throws MessagingException, UnsupportedEncodingException { | ||
SimpleMailMessage email = new SimpleMailMessage(); | ||
|
||
String subject = "Fridger: Email Verification"; | ||
String senderName = "Fridger team"; | ||
|
@@ -126,10 +127,10 @@ public void sendVerificationEmail(User user, String siteURL) | |
"for signing up with us! But before you can do that, we need you to " + | ||
"confirm your email for us! Go ahead and click the link below!"; | ||
|
||
String verifyURL = siteURL + "/verify?token=" + user.getVerificationCode(); //pass verification token for user | ||
String verifyURL = siteURL + "/verify?code=" + user.getVerificationCode(); //pass verification token for user | ||
|
||
mailContent += "<h3><a href=\"" + verifyURL + "\">VERIFY</a></h3>"; | ||
mailContent += "<p>Thank you<br>The Fridger Team</p>"; | ||
mailContent += "<p>Thank you,<br>The Fridger Team</p>"; | ||
|
||
MimeMessage message = mailSender.createMimeMessage(); | ||
MimeMessageHelper helper = new MimeMessageHelper(message); | ||
|
@@ -158,6 +159,14 @@ public boolean verify(String verificationCode) { | |
|
||
} | ||
|
||
//This method will see if the user is enabled yet | ||
public boolean isEnabled(String email) { | ||
Optional<User> u = users.findByEmail(email); | ||
if(!u.isPresent()) | ||
return false; | ||
return u.get().isEnabled(); | ||
} | ||
|
||
public void testSendEmail(CreateUserDTO dto) { | ||
SimpleMailMessage email = new SimpleMailMessage(); | ||
email.setFrom("[email protected]"); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters