Skip to content

Commit

Permalink
Improved email hiding method
Browse files Browse the repository at this point in the history
  • Loading branch information
hex3l committed Aug 11, 2017
1 parent 67b4efa commit cb60d7b
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ public void runCommand(Player player, List<String> arguments) {

private String emailMask(String email){
String[] frag = email.split("@"); //Split id and domain
int sid = frag[0].length() / 3 + 1; //Define the id view
int sdomain = frag[1].length() / 3 + 1; //Define the domain view
int sid = frag[0].length() / 3 + 1; //Define the id view (must be a value >= 1)
String[] dom = frag[1].split("."); //Domain substrings
int sdomain = dom[0].length() / 3; //Define the domain view (must be a value >= 0)
String id = frag[0].substring(0, sid) + "*****"; //Build the id
String domain = "***" + frag[1].substring(sdomain); //Build the domain
String domain = "***" + dom[0].substring(sdomain) + "." + dom[1]; //Build the domain
return id + "@" + domain;
}
}

0 comments on commit cb60d7b

Please sign in to comment.