Skip to content

Commit

Permalink
Merge branch 'develop' into 3379-custom-footer-copyright
Browse files Browse the repository at this point in the history
  • Loading branch information
pdurbin committed Sep 27, 2016
2 parents 51017bd + c6f7344 commit 86195c7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,8 @@ public String save() {
String expTime = confirmEmailUtil.friendlyExpirationTime(systemConfig.getMinutesUntilConfirmEmailTokenExpires());
msg = msg + " Your email address has changed and must be re-verified. Please check your inbox at " + currentUser.getEmail() + " and follow the link we've sent. \n\nAlso, please note that the link will only work for the next " + expTime + " before it has expired.";
boolean sendEmail = true;
// delete unexpired token, if it exists (clean slate)
confirmEmailService.deleteTokenForUser(currentUser);
try {
ConfirmEmailInitResponse confirmEmailInitResponse = confirmEmailService.beginConfirm(currentUser);
} catch (ConfirmEmailException ex) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,19 @@ private long deleteAllExpiredTokens() {
return numDeleted;
}

/**
* @param authenticatedUser
* @return True if token is deleted. False otherwise.
*/
public boolean deleteTokenForUser(AuthenticatedUser authenticatedUser) {
ConfirmEmailData confirmEmailData = findSingleConfirmEmailDataByUser(authenticatedUser);
if (confirmEmailData != null) {
em.remove(confirmEmailData);
return true;
}
return false;
}

public ConfirmEmailData createToken(AuthenticatedUser au) {
ConfirmEmailData confirmEmailData = new ConfirmEmailData(au, systemConfig.getMinutesUntilConfirmEmailTokenExpires());
em.persist(confirmEmailData);
Expand Down

0 comments on commit 86195c7

Please sign in to comment.