use of com.liferay.portal.ReservedUserEmailAddressException in project liferay-ide by liferay.
the class UserLocalServiceImpl method validateEmailAddress.
protected void validateEmailAddress(long companyId, String emailAddress) throws PortalException, SystemException {
if (Validator.isNull(emailAddress) && !PropsValues.USERS_EMAIL_ADDRESS_REQUIRED) {
return;
}
EmailAddressValidator emailAddressValidator = EmailAddressValidatorFactory.getInstance();
if (!emailAddressValidator.validate(companyId, emailAddress)) {
throw new UserEmailAddressException();
}
String pop3User = PrefsPropsUtil.getString(PropsKeys.MAIL_SESSION_MAIL_POP3_USER, PropsValues.MAIL_SESSION_MAIL_POP3_USER);
if (StringUtil.equalsIgnoreCase(emailAddress, pop3User)) {
throw new ReservedUserEmailAddressException();
}
String[] reservedEmailAddresses = PrefsPropsUtil.getStringArray(companyId, PropsKeys.ADMIN_RESERVED_EMAIL_ADDRESSES, StringPool.NEW_LINE, PropsValues.ADMIN_RESERVED_EMAIL_ADDRESSES);
for (String reservedEmailAddress : reservedEmailAddresses) {
if (StringUtil.equalsIgnoreCase(emailAddress, reservedEmailAddress)) {
throw new ReservedUserEmailAddressException();
}
}
}
Aggregations