Update of 
/var/cvs/contributions/CMSContainer_Portlets/portlets-login/src/java/com/finalist/cmsc/portlets
In directory 
james.mmbase.org:/tmp/cvs-serv24454/portlets-login/src/java/com/finalist/cmsc/portlets

Modified Files:
      Tag: b1_5
        AbstractLoginPortlet.java 
Log Message:
CMSC-1357: made some code overrideable for usage by customer specific portlets


See also: 
http://cvs.mmbase.org/viewcvs/contributions/CMSContainer_Portlets/portlets-login/src/java/com/finalist/cmsc/portlets
See also: http://www.mmbase.org/jira/browse/CMSC-1357


Index: AbstractLoginPortlet.java
===================================================================
RCS file: 
/var/cvs/contributions/CMSContainer_Portlets/portlets-login/src/java/com/finalist/cmsc/portlets/AbstractLoginPortlet.java,v
retrieving revision 1.1.2.6
retrieving revision 1.1.2.7
diff -u -b -r1.1.2.6 -r1.1.2.7
--- AbstractLoginPortlet.java   2 Apr 2009 09:22:39 -0000       1.1.2.6
+++ AbstractLoginPortlet.java   6 Apr 2009 13:07:26 -0000       1.1.2.7
@@ -37,7 +37,7 @@
 
 public abstract class AbstractLoginPortlet extends CmscPortlet{
    
-   protected String DEFAULT_EMAIL_CONFIRM_TEMPLATE_DIR = 
"../templates/view/login/confirmation.txt";
+   protected String DEFAULT_EMAIL_CONFIRM_TEMPLATE = 
"../templates/view/login/confirmation.txt";
    protected static final String EMAIL_SUBJECT = "emailSubject";
    protected static final String EMAIL_TEXT = "emailText";
    protected static final String EMAIL_FROMEMAIL = "emailFromEmail";
@@ -106,12 +106,16 @@
          String confirmUrl = HttpUtil.getWebappUri((HttpServletRequest) 
request)
                + "login/confirm.do?s=" + authentication.getId() + url;
          
+         return formatConfirmationText(emailText, authentication, person, 
confirmUrl);
+      }
+      return null;
+   }
+
+   protected String formatConfirmationText(String emailText, Authentication 
authentication, Person person, String confirmUrl) {
          return String.format(emailText == 
null?getConfirmationTemplate():emailText, authentication
                .getUserId(), authentication.getPassword(), 
person.getFirstName(),
                person.getInfix(), person.getLastName(), confirmUrl);
       }
-      return null;
-   }
    
    protected Cloud getCloudForAnonymousUpdate(boolean isRemote) {
       Cloud cloud = CloudProviderFactory.getCloudProvider().getCloud();
@@ -163,7 +167,7 @@
    
    protected String getConfirmationTemplate() {
       InputStream is = Thread.currentThread().getContextClassLoader()
-            .getResourceAsStream(DEFAULT_EMAIL_CONFIRM_TEMPLATE_DIR);
+            .getResourceAsStream(getEmailConfirmTemplate());
 
       if (is == null) {
          throw new NullPointerException(
@@ -186,6 +190,10 @@
       return sb.toString();
    }
    
+   protected String getEmailConfirmTemplate() {
+      return DEFAULT_EMAIL_CONFIRM_TEMPLATE;
+   }
+   
    protected boolean isEmailAddress(String emailAddress) {
       if (emailAddress == null) {
          return false;
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to