From 9af116561b9f158fd334fc6b22d6e86286cc7787 Mon Sep 17 00:00:00 2001 From: rhaag <none@none> Date: Fri, 1 Apr 2011 11:59:53 +0200 Subject: [PATCH] OLAT-6270 use same mail-validator as everywhere --HG-- branch : uzhFixes711 --- .../shibboleth/ShibbolethRegistrationWithEmailForm.java | 8 ++------ .../org/olat/shibboleth/_i18n/LocalStrings_de.properties | 1 - .../org/olat/shibboleth/_i18n/LocalStrings_en.properties | 1 - 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/olat3/webapp/WEB-INF/src/org/olat/shibboleth/ShibbolethRegistrationWithEmailForm.java b/olat3/webapp/WEB-INF/src/org/olat/shibboleth/ShibbolethRegistrationWithEmailForm.java index 380dc09ff6d..176beee0e96 100644 --- a/olat3/webapp/WEB-INF/src/org/olat/shibboleth/ShibbolethRegistrationWithEmailForm.java +++ b/olat3/webapp/WEB-INF/src/org/olat/shibboleth/ShibbolethRegistrationWithEmailForm.java @@ -30,6 +30,7 @@ import org.olat.core.gui.control.Controller; import org.olat.core.gui.control.Event; import org.olat.core.gui.control.WindowControl; import org.olat.core.id.Identity; +import org.olat.core.util.mail.MailHelper; import org.olat.user.UserManager; /** @@ -65,16 +66,11 @@ public class ShibbolethRegistrationWithEmailForm extends FormBasicController { return false; } - if (!eMail.getValue().matches(".+@.+\\..+")) { + if (!MailHelper.isValidEmailAddress(getEmail())){ eMail.setErrorKey("srf.error.email.valid", null); return false; } - if (eMail.getValue().matches("^[^<>\"' \t\n\r]*$")) { - eMail.setErrorKey("srf.error.email.badcharacters", null); - return false; - } - // check if email is already used by another useraccount Identity foundIdentity = UserManager.getInstance().findIdentityByEmail(eMail.getValue()); if (foundIdentity != null) { diff --git a/olat3/webapp/WEB-INF/src/org/olat/shibboleth/_i18n/LocalStrings_de.properties b/olat3/webapp/WEB-INF/src/org/olat/shibboleth/_i18n/LocalStrings_de.properties index 5e981266ea0..6cfcc87ebfe 100644 --- a/olat3/webapp/WEB-INF/src/org/olat/shibboleth/_i18n/LocalStrings_de.properties +++ b/olat3/webapp/WEB-INF/src/org/olat/shibboleth/_i18n/LocalStrings_de.properties @@ -50,7 +50,6 @@ sr.login.meantimetaken=Der gew\u00E4hlte Benutzername ist bereits registriert. B sr.select_language=W\u00E4hlen Sie die Sprache f\u00FCr die OLAT Registrierung und Ihr Benutzerkonto. Sie k\u00F6nnen die Sprache sp\u00E4ter in Ihrem Benutzerprofil jederzeit anpassen. Anschliessend werden Sie durch den Registrationprozess gef\u00FChrt. srf.email=E-Mail-Adresse srf.error.blacklist=Der gew\u00E4hlte Benutzername wurde nicht akzeptiert. -srf.error.email.badcharacters=Die E-Mail-Adresse darf keine Zeichen wie <,>,",', Leerschl\u00E4ge oder Tabulatoren enthalten srf.error.email.empty=Die E-Mail-Adresse darf nicht leer sein srf.error.email.usedByOtherUser=Diese E-Mail-Adresse wird bereits von einem anderen Benutzer verwendet srf.error.email.valid=Bitte geben Sie eine g\u00FCltige E-Mail-Adresse ein diff --git a/olat3/webapp/WEB-INF/src/org/olat/shibboleth/_i18n/LocalStrings_en.properties b/olat3/webapp/WEB-INF/src/org/olat/shibboleth/_i18n/LocalStrings_en.properties index 9c97d9c8b3d..43bc57d444d 100644 --- a/olat3/webapp/WEB-INF/src/org/olat/shibboleth/_i18n/LocalStrings_en.properties +++ b/olat3/webapp/WEB-INF/src/org/olat/shibboleth/_i18n/LocalStrings_en.properties @@ -50,7 +50,6 @@ sr.login.meantimetaken=This user name is already in use. Please choose another o sr.select_language=Please select a language for your OLAT registration and user account. Later you can still adapt your language in your user profile. You will then be guided through the registration process. srf.email=E-mail address srf.error.blacklist=The selected user name has not been accepted. -srf.error.email.badcharacters=Your e-mail address must not contain characters such as <,>,",', blanks or tabs. srf.error.email.empty=You have to fill in your e-mail address. srf.error.email.usedByOtherUser=This e-mail address is already used by someone else. srf.error.email.valid=Please indicate a valid e-mail address. -- GitLab