Author: jkoster
Date: 2009-06-05 11:42:20 +0200 (Fri, 05 Jun 2009)
New Revision: 35750
Modified:
CMSContainer/trunk/CMSContainer_Portlets/portlets-login/src/java/com/finalist/cmsc/portlets/RegisterPortlet.java
Log:
CMSC-1357 - Newsletter: create newsletter-registration portlet; missing code
from b1_5
Modified:
CMSContainer/trunk/CMSContainer_Portlets/portlets-login/src/java/com/finalist/cmsc/portlets/RegisterPortlet.java
===================================================================
---
CMSContainer/trunk/CMSContainer_Portlets/portlets-login/src/java/com/finalist/cmsc/portlets/RegisterPortlet.java
2009-06-05 09:42:18 UTC (rev 35749)
+++
CMSContainer/trunk/CMSContainer_Portlets/portlets-login/src/java/com/finalist/cmsc/portlets/RegisterPortlet.java
2009-06-05 09:42:20 UTC (rev 35750)
@@ -113,6 +113,8 @@
Long authenticationId =
authenticationService.getAuthenticationIdForUserId(emailTo);
if (authenticationId == null) {
+ // TODO check if password is mandatory
+ //if (passwordText == null) passwordText="";
Authentication authentication =
authenticationService.createAuthentication(emailTo, passwordText);
if (authentication.getId() != null) {
authId = authentication.getId();
@@ -151,7 +153,7 @@
errorMessages.put(ACEGI_SECURITY_DEFAULT, "Sending email
failed, from '" + emailFrom + "' to '" + emailTo + "'!");
}
if (errorMessages.isEmpty()) {
- response.setRenderParameter("email", emailTo);
+ response.setRenderParameter(ACEGI_SECURITY_FORM_EMAIL_KEY,
emailTo);
} else {
//Email could not be sent, but the user is created..should
remove user & authentication
personHibernateService.deletePersonByAuthenticationId(authId);
@@ -163,7 +165,13 @@
errorMessages.put(ACEGI_SECURITY_DEFAULT, "adding of
authenticationId in database failed");
}
} else {
- errorMessages.put(ACEGI_SECURITY_DEFAULT, "register.user.exists");
+ if (!isExistingUserAllowed()) {
+ errorMessages.put(ACEGI_SECURITY_DEFAULT,
"register.user.exists");
+ } else {
+ authId = authenticationId;
+ response.setRenderParameter("active", "subscribed");
+ request.getPortletSession().setAttribute("active",
"subscribed");
+ }
}
}
@@ -275,5 +283,12 @@
throw new IllegalArgumentException("Unknown key: " + key);
}
+ /*
+ * For newsletter registration it is okay to have an existing user
+ * for ordinary registration it is not okay.
+ */
+ protected boolean isExistingUserAllowed() {
+ return false;
+ }
}
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs