Skip to content

Commit

Permalink
Encrypted facts will not be emailed.
Browse files Browse the repository at this point in the history
  • Loading branch information
oglimmer committed Mar 7, 2016
1 parent 0f00d77 commit 4dc362b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main/java/de/oglimmer/web/beans/SaveEntryPortal.java
Expand Up @@ -45,11 +45,15 @@ public String save() {
smartAssEntry.setCreatorId(loginData.getUser().getId());
}

String factInEmail;
if (crypted) {
String cryptedFact = Crypto.INSTANCE.cryptFact(smartAssEntry.getFact(), loginData.getPassword(),
loginData.getUser().getFactPassword(), loginData.getUser().getInitVector());
smartAssEntry.setFact(cryptedFact);
smartAssEntry.setEncrypted(true);
factInEmail = "***ENCRYPTED***";
} else {
factInEmail = smartAssEntry.getFact();
}

dao.add(smartAssEntry);
Expand All @@ -59,7 +63,7 @@ public String save() {

if (smartAssEntry.getEmail() != null && !smartAssEntry.getEmail().isEmpty()) {
EmailService.INSTANCE.createAndSendMailFile(smartAssEntry.getEmail(), "anditoldyou.so record",
"/creationEmail.txt", smartAssEntry.getFact(), LinkGenerator.INSTANCE.make(smartAssEntry.getId()));
"/creationEmail.txt", factInEmail, LinkGenerator.INSTANCE.make(smartAssEntry.getId()));
message = "Wisdom saved. We've sent you an email. Here's the link as well: " + link;
} else {
message = "Wisdom saved. Here's the link for future references: " + link + ". Keep it safe!";
Expand Down

0 comments on commit 4dc362b

Please sign in to comment.