Skip to content
Snippets Groups Projects
Commit 5e1a7390 authored by Raman Arora's avatar Raman Arora
Browse files

Validate email address before creating accounts from Web form data.

parent 5b0c3efe
Branches
Tags
No related merge requests found
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.BlackboardArtifact;
import org.sleuthkit.datamodel.BlackboardAttribute; import org.sleuthkit.datamodel.BlackboardAttribute;
import org.sleuthkit.datamodel.CommunicationsManager; import org.sleuthkit.datamodel.CommunicationsManager;
import org.sleuthkit.datamodel.CommunicationsUtils;
import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.Content;
import org.sleuthkit.datamodel.SleuthkitCase; import org.sleuthkit.datamodel.SleuthkitCase;
import org.sleuthkit.datamodel.TskCoreException; import org.sleuthkit.datamodel.TskCoreException;
...@@ -299,11 +300,11 @@ public BlackboardArtifact addWebFormAddress(String personName, String email, ...@@ -299,11 +300,11 @@ public BlackboardArtifact addWebFormAddress(String personName, String email,
Collection<BlackboardAttribute> attributes = new ArrayList<>(); Collection<BlackboardAttribute> attributes = new ArrayList<>();
CommunicationsManager commManager = this.getSleuthkitCase().getCommunicationsManager(); CommunicationsManager commManager = this.getSleuthkitCase().getCommunicationsManager();
if(StringUtils.isNotBlank(email)) { if (CommunicationsUtils.isValidEmailAddress(email)) {
commManager.createAccountFileInstance(Account.Type.EMAIL, email, this.getModuleName(), this.getContent()); commManager.createAccountFileInstance(Account.Type.EMAIL, email, this.getModuleName(), this.getContent());
} }
if(StringUtils.isNotBlank(phoneNumber)) { if(CommunicationsUtils.isValidPhoneNumber(phoneNumber)) {
commManager.createAccountFileInstance(Account.Type.PHONE, phoneNumber, this.getModuleName(), this.getContent()); commManager.createAccountFileInstance(Account.Type.PHONE, phoneNumber, this.getModuleName(), this.getContent());
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment