|
@ -1,5 +1,7 @@ |
|
|
package hs.fulda.de.ci.exam.project; |
|
|
package hs.fulda.de.ci.exam.project; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.regex.Pattern; |
|
|
|
|
|
|
|
|
public class EmailNotification extends Notification { |
|
|
public class EmailNotification extends Notification { |
|
|
String email; |
|
|
String email; |
|
|
String content; |
|
|
String content; |
|
@ -19,6 +21,14 @@ public class EmailNotification extends Notification { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private boolean isValidEmail(String email) { |
|
|
private boolean isValidEmail(String email) { |
|
|
return true; |
|
|
|
|
|
|
|
|
String regexPattern = "^(?=.{1,64}@)[A-Za-z0-9_-]+(\\.[A-Za-z0-9_-]+)*@" |
|
|
|
|
|
+ "[^-][A-Za-z0-9-]+(\\.[A-Za-z0-9-]+)*(\\.[A-Za-z]{2,})$"; |
|
|
|
|
|
return patternMatches(email, regexPattern); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static boolean patternMatches(String emailAddress, String regexPattern) { |
|
|
|
|
|
return Pattern.compile(regexPattern) |
|
|
|
|
|
.matcher(emailAddress) |
|
|
|
|
|
.matches(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |