Added SSO Login field

git-svn-id: https://svn.libreccm.org/ccm/trunk@6199 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2019-09-12 18:26:32 +00:00
parent 042e4006e2
commit 843f888d66
2 changed files with 150 additions and 147 deletions

View File

@ -19,98 +19,94 @@
package com.arsdigita.ui.login; package com.arsdigita.ui.login;
import com.arsdigita.globalization.GlobalizedMessage; import com.arsdigita.globalization.GlobalizedMessage;
import com.arsdigita.bebop.Label;
/** /**
* Constants used by Login UI. * Constants used by Login UI.
**/ *
public interface LoginConstants */
{ public interface LoginConstants {
public final static GlobalizedMessage SUBMIT =
LoginHelper.getMessage("login.submit");
public final static GlobalizedMessage LOGIN =
LoginHelper.getMessage("login.login");
public final static GlobalizedMessage PRIMARY_EMAIL =
LoginHelper.getMessage("login.primaryEmail");
public final static GlobalizedMessage ADDITIONAL_EMAIL =
LoginHelper.getMessage("login.additionalEmail");
public final static GlobalizedMessage SCREEN_NAME =
LoginHelper.getMessage("login.screenName");
public final static GlobalizedMessage FIRST_NAME =
LoginHelper.getMessage("login.firstName");
public final static GlobalizedMessage LAST_NAME =
LoginHelper.getMessage("login.lastName");
public final static GlobalizedMessage PASSWORD =
LoginHelper.getMessage("login.password", new Object[] {
new Integer(PasswordValidationListener.MIN_LENGTH) });
public final static GlobalizedMessage PASSWORD_CONFIRMATION =
LoginHelper.getMessage("login.passwordConfirm");
public final static GlobalizedMessage PASSWORD_QUESTION =
LoginHelper.getMessage("login.passwordQuestion");
public final static GlobalizedMessage PASSWORD_ANSWER =
LoginHelper.getMessage("login.passwordAnswer");
public final static GlobalizedMessage URL =
LoginHelper.getMessage("login.url");
public final static GlobalizedMessage BIO =
LoginHelper.getMessage("login.bio");
public final static GlobalizedMessage ERROR_DUPLICATE_SN = public final static GlobalizedMessage SUBMIT = LoginHelper.getMessage(
LoginHelper.getMessage("login.error.duplicateScreenName"); "login.submit");
public final static GlobalizedMessage ERROR_DUPLICATE_EMAIL = public final static GlobalizedMessage LOGIN = LoginHelper.getMessage(
LoginHelper.getMessage("login.error.duplicateEmail"); "login.login");
public final static GlobalizedMessage ERROR_MISMATCH_PASSWORD = public final static GlobalizedMessage PRIMARY_EMAIL = LoginHelper
LoginHelper.getMessage("login.error.mismatchPassword"); .getMessage("login.primaryEmail");
public final static GlobalizedMessage ERROR_BAD_PASSWORD = public final static GlobalizedMessage ADDITIONAL_EMAIL = LoginHelper
LoginHelper.getMessage("login.error.badPassword"); .getMessage("login.additionalEmail");
public final static GlobalizedMessage SCREEN_NAME = LoginHelper.getMessage(
"login.screenName");
public final static GlobalizedMessage FIRST_NAME = LoginHelper.getMessage(
"login.firstName");
public final static GlobalizedMessage LAST_NAME = LoginHelper.getMessage(
"login.lastName");
public final static GlobalizedMessage PASSWORD = LoginHelper.getMessage(
"login.password", new Object[]{
new Integer(PasswordValidationListener.MIN_LENGTH)});
public final static GlobalizedMessage PASSWORD_CONFIRMATION = LoginHelper
.getMessage("login.passwordConfirm");
public final static GlobalizedMessage PASSWORD_QUESTION = LoginHelper
.getMessage("login.passwordQuestion");
public final static GlobalizedMessage PASSWORD_ANSWER = LoginHelper
.getMessage("login.passwordAnswer");
public final static GlobalizedMessage URL = LoginHelper.getMessage(
"login.url");
public final static GlobalizedMessage BIO = LoginHelper.getMessage(
"login.bio");
public final static GlobalizedMessage ERROR_LOGIN_FAIL = public final static GlobalizedMessage ERROR_DUPLICATE_SN = LoginHelper
LoginHelper.getMessage("login.error.loginFail"); .getMessage("login.error.duplicateScreenName");
public final static GlobalizedMessage ERROR_DUPLICATE_EMAIL = LoginHelper
.getMessage("login.error.duplicateEmail");
public final static GlobalizedMessage ERROR_MISMATCH_PASSWORD = LoginHelper
.getMessage("login.error.mismatchPassword");
public final static GlobalizedMessage ERROR_BAD_PASSWORD = LoginHelper
.getMessage("login.error.badPassword");
public final static GlobalizedMessage ERROR_BAD_ANSWER = public final static GlobalizedMessage ERROR_LOGIN_FAIL = LoginHelper
LoginHelper.getMessage("login.error.badAnswer"); .getMessage("login.error.loginFail");
public final static GlobalizedMessage ERROR_BAD_EMAIL =
LoginHelper.getMessage("login.error.badEmail");
public final static GlobalizedMessage ERROR_BANNED_EMAIL =
LoginHelper.getMessage("login.error.bannedEmail");
public final static GlobalizedMessage ERROR_NO_EMAIL =
LoginHelper.getMessage("login.error.noEmail");
public final static String FORM_EMAIL = public final static GlobalizedMessage ERROR_BAD_ANSWER = LoginHelper
"emailAddress"; .getMessage("login.error.badAnswer");
public final static String FORM_SCREEN_NAME = public final static GlobalizedMessage ERROR_BAD_EMAIL = LoginHelper
"screenName"; .getMessage("login.error.badEmail");
public final static GlobalizedMessage ERROR_BANNED_EMAIL = LoginHelper
.getMessage("login.error.bannedEmail");
public final static GlobalizedMessage ERROR_NO_EMAIL = LoginHelper
.getMessage("login.error.noEmail");
public final static Label USER_FORM_LABEL_SSO = new Label(
new GlobalizedMessage(
"ui.admin.user.addeditform.ssologinname",
"com.arsdigita.ui.admin.AdminResources"));
public final static String FORM_EMAIL = "emailAddress";
public final static String FORM_SCREEN_NAME = "screenName";
// Should not really be named email. Kept this way due to external tests // Should not really be named email. Kept this way due to external tests
// depending on this value. // depending on this value.
public final static String FORM_LOGIN = public final static String FORM_LOGIN = "email";
"email";
public final static String FORM_ADDITIONAL_EMAIL = public final static String FORM_ADDITIONAL_EMAIL = "additional_email";
"additional_email"; public final static String FORM_FIRST_NAME = "firstname";
public final static String FORM_FIRST_NAME = public final static String FORM_LAST_NAME = "lastname";
"firstname"; public final static String FORM_PASSWORD = "password";
public final static String FORM_LAST_NAME = public final static String FORM_PASSWORD_CONFIRMATION
"lastname"; = "password_confirmation";
public final static String FORM_PASSWORD = public final static String FORM_PASSWORD_QUESTION = "question";
"password"; public final static String FORM_PASSWORD_ANSWER = "answer";
public final static String FORM_PASSWORD_CONFIRMATION = public final static String FORM_URL = "url";
"password_confirmation"; public final static String FORM_URL_DEFAULT = "http://";
public final static String FORM_PASSWORD_QUESTION = public final static String FORM_BIO = "biography";
"question"; public final static String FORM_TIMESTAMP = "timestamp";
public final static String FORM_PASSWORD_ANSWER = public final static String FORM_PERSISTENT_LOGIN_P = "persistentCookieP";
"answer"; public final static String FORM_PERSISTENT_LOGIN_P_DEFAULT = "1";
public final static String FORM_URL =
"url"; public final static String USER_FORM_INPUT_SSO = "sso_login";
public final static String FORM_URL_DEFAULT =
"http://";
public final static String FORM_BIO =
"biography";
public final static String FORM_TIMESTAMP =
"timestamp";
public final static String FORM_PERSISTENT_LOGIN_P =
"persistentCookieP";
public final static String FORM_PERSISTENT_LOGIN_P_DEFAULT =
"1";
public final static int TIMESTAMP_LIFETIME_SECS = 300; public final static int TIMESTAMP_LIFETIME_SECS = 300;
public static final int MAX_NAME_LEN = 60; public static final int MAX_NAME_LEN = 60;
} }

View File

@ -18,7 +18,6 @@
*/ */
package com.arsdigita.ui.login; package com.arsdigita.ui.login;
import com.arsdigita.bebop.ColumnPanel; import com.arsdigita.bebop.ColumnPanel;
import com.arsdigita.bebop.Container; import com.arsdigita.bebop.Container;
import com.arsdigita.bebop.Form; import com.arsdigita.bebop.Form;
@ -55,13 +54,13 @@ import org.apache.log4j.Logger;
* *
* @author Admin UI Team * @author Admin UI Team
* @version $Id: UserForm.java 1506 2007-03-21 19:05:47Z sskracic $ * @version $Id: UserForm.java 1506 2007-03-21 19:05:47Z sskracic $
**/ *
*/
public abstract class UserForm extends Form public abstract class UserForm extends Form
implements LoginConstants, FormInitListener, FormValidationListener implements LoginConstants, FormInitListener, FormValidationListener {
{
private static final Logger s_log = private static final Logger s_log = Logger.getLogger(UserForm.class
Logger.getLogger(UserForm.class.getName()); .getName());
private boolean m_newUser; private boolean m_newUser;
@ -78,19 +77,21 @@ public abstract class UserForm extends Form
protected TextField m_ssoLogin; protected TextField m_ssoLogin;
protected Label m_securitySectionHeader = new Label(LoginHelper protected Label m_securitySectionHeader = new Label(LoginHelper
.getMessage("login.userNewForm.securitySectionHeader"), false); .getMessage("login.userNewForm.securitySectionHeader"), false);
protected Label m_securityBlurb = new Label(LoginHelper protected Label m_securityBlurb = new Label(LoginHelper
.getMessage("login.userNewForm.securityBlurb")); .getMessage("login.userNewForm.securityBlurb"));
protected Label m_passwordBlurb = new Label(LoginHelper protected Label m_passwordBlurb = new Label(LoginHelper
.getMessage("login.userNewForm.passwordBlurb")); .getMessage("login.userNewForm.passwordBlurb"));
protected Label m_passwordLabel = new Label(PASSWORD); protected Label m_passwordLabel = new Label(PASSWORD);
protected Label m_confirmationLabel = new Label(PASSWORD_CONFIRMATION); protected Label m_confirmationLabel = new Label(PASSWORD_CONFIRMATION);
protected Label m_questionBlurb = new Label(LoginHelper protected Label m_questionBlurb = new Label(LoginHelper
.getMessage("login.userNewForm.questionBlurb")); .getMessage("login.userNewForm.questionBlurb"));
protected Label m_questionLabel = new Label(PASSWORD_QUESTION); protected Label m_questionLabel = new Label(PASSWORD_QUESTION);
protected Label m_answerLabel = new Label(PASSWORD_ANSWER); protected Label m_answerLabel = new Label(PASSWORD_ANSWER);
protected PasswordValidationListener m_passwordValidationListener = new PasswordValidationListener(); protected PasswordValidationListener m_passwordValidationListener
protected NotEmptyValidationListener m_confirmationNotEmptyValidationListener = new NotEmptyValidationListener(); = new PasswordValidationListener();
protected NotEmptyValidationListener m_confirmationNotEmptyValidationListener
= new NotEmptyValidationListener();
protected Submit m_submit = new Submit(SUBMIT); protected Submit m_submit = new Submit(SUBMIT);
protected Label m_firstNameLabel = new Label(FIRST_NAME); protected Label m_firstNameLabel = new Label(FIRST_NAME);
protected Label m_lastNameLabel = new Label(LAST_NAME); protected Label m_lastNameLabel = new Label(LAST_NAME);
@ -104,7 +105,8 @@ public abstract class UserForm extends Form
/** /**
* Create a UserForm with the given name and panel. * Create a UserForm with the given name and panel.
**/ *
*/
public UserForm(String name, Container panel, boolean newUser) { public UserForm(String name, Container panel, boolean newUser) {
super(name, panel); super(name, panel);
@ -116,20 +118,19 @@ public abstract class UserForm extends Form
if (m_newUser) { if (m_newUser) {
m_profilePart.add(new Label(LoginHelper m_profilePart.add(new Label(LoginHelper
.getMessage("login.userNewForm.aboutYouSectionHeader"), .getMessage("login.userNewForm.aboutYouSectionHeader"),
false), ColumnPanel.FULL_WIDTH); false), ColumnPanel.FULL_WIDTH);
} }
// SDM #163373: add length checking for first/last names. We do // SDM #163373: add length checking for first/last names. We do
// this with both maximum length parameters in the user/add form and // this with both maximum length parameters in the user/add form and
// with validation of the value that come in for processing. // with validation of the value that come in for processing.
m_firstName = new TextField(new StringParameter(FORM_FIRST_NAME)); m_firstName = new TextField(new StringParameter(FORM_FIRST_NAME));
m_firstName.setMaxLength(MAX_NAME_LEN); m_firstName.setMaxLength(MAX_NAME_LEN);
m_firstName.setSize(20); m_firstName.setSize(20);
m_firstName.addValidationListener(new NotEmptyValidationListener()); m_firstName.addValidationListener(new NotEmptyValidationListener());
m_firstName.addValidationListener(new StringLengthValidationListener m_firstName.addValidationListener(new StringLengthValidationListener(
(MAX_NAME_LEN)); MAX_NAME_LEN));
m_profilePart.add(m_firstNameLabel); m_profilePart.add(m_firstNameLabel);
m_profilePart.add(m_firstName); m_profilePart.add(m_firstName);
@ -138,8 +139,8 @@ public abstract class UserForm extends Form
m_lastName.setMaxLength(MAX_NAME_LEN); m_lastName.setMaxLength(MAX_NAME_LEN);
m_lastName.setSize(25); m_lastName.setSize(25);
m_lastName.addValidationListener(new NotEmptyValidationListener()); m_lastName.addValidationListener(new NotEmptyValidationListener());
m_lastName.addValidationListener(new StringLengthValidationListener m_lastName.addValidationListener(new StringLengthValidationListener(
(MAX_NAME_LEN)); MAX_NAME_LEN));
m_profilePart.add(m_lastNameLabel); m_profilePart.add(m_lastNameLabel);
m_profilePart.add(m_lastName); m_profilePart.add(m_lastName);
@ -162,7 +163,6 @@ public abstract class UserForm extends Form
// (FORM_ADDITIONAL_EMAIL)); // (FORM_ADDITIONAL_EMAIL));
//add(new Label(ADDITIONAL_EMAIL)); //add(new Label(ADDITIONAL_EMAIL));
//add(m_additional); //add(m_additional);
// URL // URL
m_url = new TextField(new URLParameter(FORM_URL)); m_url = new TextField(new URLParameter(FORM_URL));
m_url.setSize(50); m_url.setSize(50);
@ -175,26 +175,24 @@ public abstract class UserForm extends Form
// SDM #162740: disable user bio for now, as there // SDM #162740: disable user bio for now, as there
// is no support for User Bio in the kernel level. // is no support for User Bio in the kernel level.
// add(new Label(BIO)); // add(new Label(BIO));
// TextArea bioText = new TextArea(new StringParameter(FORM_BIO)); // TextArea bioText = new TextArea(new StringParameter(FORM_BIO));
// bioText.setCols(50); // bioText.setCols(50);
// bioText.setRows(10); // bioText.setRows(10);
// add(bioText); // add(bioText);
// add(new Label("")); // add(new Label(""));
if (m_newUser) { if (m_newUser) {
m_securityPart.add(new Label(LoginHelper m_securityPart.add(new Label(LoginHelper
.getMessage("login.userNewForm.securitySectionHeader"), .getMessage("login.userNewForm.securitySectionHeader"),
false), ColumnPanel.FULL_WIDTH); false), ColumnPanel.FULL_WIDTH);
m_securityPart.add(new Label(LoginHelper m_securityPart.add(new Label(LoginHelper
.getMessage("login.userNewForm.securityBlurb")), .getMessage("login.userNewForm.securityBlurb")),
ColumnPanel.FULL_WIDTH); ColumnPanel.FULL_WIDTH);
m_securityPart.add(new Label(LoginHelper m_securityPart.add(new Label(LoginHelper
.getMessage("login.userNewForm.passwordBlurb")), .getMessage("login.userNewForm.passwordBlurb")),
ColumnPanel.FULL_WIDTH); ColumnPanel.FULL_WIDTH);
// Password // Password
m_password = new Password(new StringParameter(FORM_PASSWORD)); m_password = new Password(new StringParameter(FORM_PASSWORD));
@ -205,19 +203,19 @@ public abstract class UserForm extends Form
// Password confirmation // Password confirmation
m_confirm = new Password(new StringParameter( m_confirm = new Password(new StringParameter(
FORM_PASSWORD_CONFIRMATION)); FORM_PASSWORD_CONFIRMATION));
m_confirm.addValidationListener(new NotEmptyValidationListener()); m_confirm.addValidationListener(new NotEmptyValidationListener());
m_securityPart.add(m_confirmationLabel); m_securityPart.add(m_confirmationLabel);
m_securityPart.add(m_confirm); m_securityPart.add(m_confirm);
m_securityPart.add(new Label(LoginHelper m_securityPart.add(new Label(LoginHelper
.getMessage("login.userNewForm.questionBlurb")), .getMessage("login.userNewForm.questionBlurb")),
ColumnPanel.FULL_WIDTH); ColumnPanel.FULL_WIDTH);
// Password question // Password question
m_question = new TextField(new StringParameter m_question = new TextField(new StringParameter(
(FORM_PASSWORD_QUESTION)); FORM_PASSWORD_QUESTION));
m_question.setSize(30); m_question.setSize(30);
m_question.addValidationListener(new NotEmptyValidationListener()); m_question.addValidationListener(new NotEmptyValidationListener());
@ -225,13 +223,17 @@ public abstract class UserForm extends Form
m_securityPart.add(m_question); m_securityPart.add(m_question);
// Password answer // Password answer
m_answer = new TextField(new StringParameter m_answer = new TextField(new StringParameter(FORM_PASSWORD_ANSWER));
(FORM_PASSWORD_ANSWER));
m_answer.setSize(30); m_answer.setSize(30);
m_answer.addValidationListener(new NotEmptyValidationListener()); m_answer.addValidationListener(new NotEmptyValidationListener());
m_securityPart.add(m_answerLabel); m_securityPart.add(m_answerLabel);
m_securityPart.add(m_answer); m_securityPart.add(m_answer);
m_ssoLogin = new TextField(new StringParameter(USER_FORM_INPUT_SSO));
m_ssoLogin.setSize(50);
add(USER_FORM_LABEL_SSO);
add(m_ssoLogin);
} }
// Submit // Submit
@ -244,9 +246,10 @@ public abstract class UserForm extends Form
/** /**
* Initializes this form with data from the user. * Initializes this form with data from the user.
**/ *
*/
public void init(FormSectionEvent event) public void init(FormSectionEvent event)
throws FormProcessException { throws FormProcessException {
PageState state = event.getPageState(); PageState state = event.getPageState();
User user = null; User user = null;
@ -255,7 +258,7 @@ public abstract class UserForm extends Form
user = getUser(state); user = getUser(state);
} catch (DataObjectNotFoundException e) { } catch (DataObjectNotFoundException e) {
throw new FormProcessException(LoginGlobalizationUtil.globalize( throw new FormProcessException(LoginGlobalizationUtil.globalize(
"login.userForm.couldnt_load_user")); "login.userForm.couldnt_load_user"));
} }
if (user == null) { if (user == null) {
@ -270,12 +273,12 @@ public abstract class UserForm extends Form
InternetAddress address; InternetAddress address;
try { try {
address = new InternetAddress(user.getPrimaryEmail().toString()); address = new InternetAddress(user.getPrimaryEmail().toString());
} catch(AddressException e) { } catch (AddressException e) {
String[] errorMsg = new String[1]; String[] errorMsg = new String[1];
errorMsg[0] = user.getPrimaryEmail().toString(); errorMsg[0] = user.getPrimaryEmail().toString();
throw new FormProcessException( throw new FormProcessException(
"Email address is bad: " + user.getPrimaryEmail(), "Email address is bad: " + user.getPrimaryEmail(),
LoginHelper.getMessage("login.error.badEmail",errorMsg) LoginHelper.getMessage("login.error.badEmail", errorMsg)
); );
} }
@ -296,44 +299,46 @@ public abstract class UserForm extends Form
* @return null if the form should not be initialized with user data. * @return null if the form should not be initialized with user data.
* *
* @throws DataObjectNotFoundException if the user is not found. * @throws DataObjectNotFoundException if the user is not found.
**/ *
*/
protected abstract User getUser(PageState state) protected abstract User getUser(PageState state)
throws DataObjectNotFoundException; throws DataObjectNotFoundException;
/** /**
* Validates this form. Verifies that the password and password-confirm * Validates this form. Verifies that the password and password-confirm
* fields match. If not it adds an error to the password-confirm field. * fields match. If not it adds an error to the password-confirm field. Also
* Also verifies that primary email address and screen name are unique * verifies that primary email address and screen name are unique among all
* among all users. * users.
**/ *
public void validate (FormSectionEvent event) */
throws FormProcessException { public void validate(FormSectionEvent event)
throws FormProcessException {
PageState state = event.getPageState(); PageState state = event.getPageState();
FormData data = event.getFormData(); FormData data = event.getFormData();
try { try {
if (m_newUser) { if (m_newUser) {
// Verify that password and confirmation match // Verify that password and confirmation match
String password = (String) m_password.getValue(state); String password = (String) m_password.getValue(state);
String confirm = (String) m_confirm.getValue(state); String confirm = (String) m_confirm.getValue(state);
if ((password != null) && (confirm != null) if ((password != null) && (confirm != null)
&& !password.equals(confirm)) { && !password.equals(confirm)) {
data.addError(FORM_PASSWORD_CONFIRMATION, data.addError(FORM_PASSWORD_CONFIRMATION,
(String)ERROR_MISMATCH_PASSWORD (String) ERROR_MISMATCH_PASSWORD
.localize(state.getRequest())); .localize(state.getRequest()));
} }
} }
// Verify that primary email and screen name are unique // Verify that primary email and screen name are unique
DataQuery query = SessionManager.getSession().retrieveQuery DataQuery query = SessionManager.getSession().retrieveQuery(
("com.arsdigita.kernel.UserPrimaryEmail"); "com.arsdigita.kernel.UserPrimaryEmail");
//query.setParameter("excludeGroupId", null); //query.setParameter("excludeGroupId", null);
String email = null; String email = null;
String lowerEmail = null; String lowerEmail = null;
if (m_email.getValue(state) != null) { if (m_email.getValue(state) != null) {
InternetAddress address = (InternetAddress) m_email InternetAddress address = (InternetAddress) m_email
.getValue(state); .getValue(state);
email = address.getAddress(); email = address.getAddress();
lowerEmail = email.toLowerCase(); lowerEmail = email.toLowerCase();
} }
@ -361,16 +366,16 @@ public abstract class UserForm extends Form
// If this query returns with any rows we have a duplicate // If this query returns with any rows we have a duplicate
// screen name, email address, or both. Check the results and // screen name, email address, or both. Check the results and
// produce appropriate error messages. // produce appropriate error messages.
boolean checkPrimaryEmail = Kernel.getConfig().emailIsPrimaryIdentifier(); boolean checkPrimaryEmail = Kernel.getConfig()
.emailIsPrimaryIdentifier();
Filter filter = null; Filter filter = null;
if (checkPrimaryEmail) { if (checkPrimaryEmail) {
filter = query.addFilter filter = query.addFilter(
("lowerPrimaryEmailAddress = :email or lowerScreenName = :sn"); "lowerPrimaryEmailAddress = :email or lowerScreenName = :sn");
filter.set("email", lowerEmail); filter.set("email", lowerEmail);
} else { } else {
filter = query.addFilter filter = query.addFilter("lowerScreenName = :sn");
("lowerScreenName = :sn");
} }
filter.set("sn", lowerScreenName); filter.set("sn", lowerScreenName);
@ -378,14 +383,15 @@ public abstract class UserForm extends Form
if ((lowerScreenName != null) if ((lowerScreenName != null)
&& !lowerScreenName.equals(oldScreenName) && !lowerScreenName.equals(oldScreenName)
&& lowerScreenName.equals(query.get("lowerScreenName"))) { && lowerScreenName.equals(query.get("lowerScreenName"))) {
data.addError(FORM_SCREEN_NAME, (String)ERROR_DUPLICATE_SN data.addError(FORM_SCREEN_NAME, (String) ERROR_DUPLICATE_SN
.localize(state.getRequest())); .localize(state.getRequest()));
} }
if ((email != null) && checkPrimaryEmail if ((email != null) && checkPrimaryEmail
&& !email.equals(oldEmail) && !email.equals(oldEmail)
&& lowerEmail.equals(query.get("lowerPrimaryEmailAddress"))) { && lowerEmail.equals(query.get(
data.addError(FORM_EMAIL, (String)ERROR_DUPLICATE_EMAIL "lowerPrimaryEmailAddress"))) {
.localize(state.getRequest())); data.addError(FORM_EMAIL, (String) ERROR_DUPLICATE_EMAIL
.localize(state.getRequest()));
} }
} }
query.close(); query.close();
@ -398,4 +404,5 @@ public abstract class UserForm extends Form
} }
} }
} }
} }