@@ -109,26 +109,6 @@ public class RegRequestValidator implements Validator {
|
|||||||
errors.rejectValue("email", "email.invalid", "Invalid email address");
|
errors.rejectValue("email", "email.invalid", "Invalid email address");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String[] parts = trimmedEmail.split("@");
|
|
||||||
if (parts.length == 2) {
|
|
||||||
String domain = parts[1];
|
|
||||||
DomainValidator domainValidator = DomainValidator.getInstance();
|
|
||||||
|
|
||||||
if (!checkDomainExists(domain)) {
|
|
||||||
errors.rejectValue("email", "email.domain.not.found",
|
|
||||||
"Domain does not exist");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean checkDomainExists(String domain) {
|
|
||||||
try {
|
|
||||||
InetAddress.getByName(domain);
|
|
||||||
return true;
|
|
||||||
} catch (UnknownHostException e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user