ate         2004/10/17 18:42:08

  Modified:    applications/security/src/webapp/WEB-INF
                        jetspeed-portlet.xml portlet.xml web.xml
               
applications/security/src/java/org/apache/jetspeed/portlets/security/resources
                        LoginResources.properties
                        LoginResources_en.properties
               applications/security/src/webapp/WEB-INF/security/login
                        login.jsp
               applications/security project.xml
  Added:       
applications/security/src/java/org/apache/jetspeed/portlets/security/resources
                        ChgPwdResources_en.properties
                        ChgPwdResources_nl.properties
                        ChgPwdResources.properties
               applications/security/src/webapp/WEB-INF/security/chgpwd
                        change-password.jsp
               portal/src/webapp/WEB-INF/pages/Administrative
                        change-password.psml
               applications/security/src/java/org/apache/jetspeed/portlets/security
                        ChangePasswordPortlet.java
  Removed:     applications/security/src/webapp/WEB-INF portlet.tld
  Log:
  security:ChangePasswordPortlet added
  security:LoginPortlet cleaned up
  
  Revision  Changes    Path
  1.2       +4 -0      
jakarta-jetspeed-2/applications/security/src/webapp/WEB-INF/jetspeed-portlet.xml
  
  Index: jetspeed-portlet.xml
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/applications/security/src/webapp/WEB-INF/jetspeed-portlet.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- jetspeed-portlet.xml      1 May 2004 17:01:03 -0000       1.1
  +++ jetspeed-portlet.xml      18 Oct 2004 01:42:07 -0000      1.2
  @@ -29,4 +29,8 @@
           <dc:creator>J2 Team</dc:creator>
       </portlet>
   
  +  <js:services>
  +    <js:service name='UserManager'/>
  +  </js:services>
  +
   </portlet-app>
  
  
  
  1.6       +26 -2     
jakarta-jetspeed-2/applications/security/src/webapp/WEB-INF/portlet.xml
  
  Index: portlet.xml
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/applications/security/src/webapp/WEB-INF/portlet.xml,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- portlet.xml       6 Oct 2004 23:45:05 -0000       1.5
  +++ portlet.xml       18 Oct 2004 01:42:07 -0000      1.6
  @@ -28,8 +28,8 @@
              <mime-type>text/html</mime-type>
          <portlet-mode>VIEW</portlet-mode>
        </supports>
  -        <supported-locale>en</supported-locale>
  -        <supported-locale>ja</supported-locale>
  +      <supported-locale>en</supported-locale>
  +      <supported-locale>ja</supported-locale>
            
<resource-bundle>org.apache.jetspeed.portlets.security.resources.LoginResources</resource-bundle>
                <portlet-info>
                        <title>Login Portlet</title>
  @@ -58,6 +58,30 @@
                        <short-title>Add User Portlet</short-title>
        </portlet-info>
        </portlet>
  +    <portlet id="ChangePasswordPortlet">
  +      <init-param>
  +        <description>This parameter sets the template used in view 
mode.</description>
  +        <name>ViewPage</name>
  +        <value>/WEB-INF/security/chgpwd/change-password.jsp</value>
  +      </init-param>   
  +      <portlet-name>ChangePasswordPortlet</portlet-name>
  +      <display-name>Change Password</display-name>
  +      <description>Change current logged on user its password.</description>
  +      
<portlet-class>org.apache.jetspeed.portlets.security.ChangePasswordPortlet</portlet-class>
  +      <expiration-cache>-1</expiration-cache>
  +      <supports>
  +        <mime-type>text/html</mime-type>
  +        <portlet-mode>VIEW</portlet-mode>
  +      </supports>
  +      <supported-locale>en</supported-locale>
  +      <supported-locale>nl</supported-locale>
  +      
<resource-bundle>org.apache.jetspeed.portlets.security.resources.ChgPwdResources</resource-bundle>
  +      <portlet-info>
  +        <title>Change Password</title>
  +        <short-title>Change Password</short-title>
  +        <keywords>security,user,password</keywords>
  +      </portlet-info>
  +    </portlet>
   
   </portlet-app>
   
  
  
  
  1.7       +0 -3      
jakarta-jetspeed-2/applications/security/src/webapp/WEB-INF/web.xml
  
  Index: web.xml
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/applications/security/src/webapp/WEB-INF/web.xml,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- web.xml   29 Jul 2004 22:24:19 -0000      1.6
  +++ web.xml   18 Oct 2004 01:42:07 -0000      1.7
  @@ -32,9 +32,6 @@
     <servlet-name>action</servlet-name>
     <url-pattern>*.do</url-pattern>
    </servlet-mapping>
  - <welcome-file-list>
  -  <welcome-file>security/user-mgt/addUser.jsp</welcome-file>
  - </welcome-file-list>
    <taglib>
     <taglib-uri>c.tld</taglib-uri>
     <taglib-location>/WEB-INF/c.tld</taglib-location>
  
  
  
  1.2       +2 -2      
jakarta-jetspeed-2/applications/security/src/java/org/apache/jetspeed/portlets/security/resources/LoginResources.properties
  
  Index: LoginResources.properties
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/applications/security/src/java/org/apache/jetspeed/portlets/security/resources/LoginResources.properties,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- LoginResources.properties 17 Sep 2004 22:43:31 -0000      1.1
  +++ LoginResources.properties 18 Oct 2004 01:42:07 -0000      1.2
  @@ -22,4 +22,4 @@
   login.label.InvalidUsernameOrPassword=Invalid username or password ({0})
   login.label.Username=Username
   login.label.Password=Password
  -
  +login.label.ChangePassword=Change Password
  
  
  
  1.2       +2 -1      
jakarta-jetspeed-2/applications/security/src/java/org/apache/jetspeed/portlets/security/resources/LoginResources_en.properties
  
  Index: LoginResources_en.properties
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/applications/security/src/java/org/apache/jetspeed/portlets/security/resources/LoginResources_en.properties,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- LoginResources_en.properties      17 Sep 2004 22:43:31 -0000      1.1
  +++ LoginResources_en.properties      18 Oct 2004 01:42:07 -0000      1.2
  @@ -26,4 +26,5 @@
   login.label.InvalidUsernameOrPassword=Invalid username or password ({0})
   login.label.Username=Username
   login.label.Password=Password
  +login.label.ChangePassword=Change Password
   
  
  
  
  1.1                  
jakarta-jetspeed-2/applications/security/src/java/org/apache/jetspeed/portlets/security/resources/ChgPwdResources_en.properties
  
  Index: ChgPwdResources_en.properties
  ===================================================================
  # Copyright 2004 The Apache Software Foundation
  #
  # Licensed under the Apache License, Version 2.0 (the "License");
  # you may not use this file except in compliance with the License.
  # You may obtain a copy of the License at
  #
  #     http://www.apache.org/licenses/LICENSE-2.0
  #
  # Unless required by applicable law or agreed to in writing, software
  # distributed under the License is distributed on an "AS IS" BASIS,
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  # See the License for the specific language governing permissions and
  # limitations under the License.
  #
  # $Id: ChgPwdResources_en.properties,v 1.1 2004/10/18 01:42:07 ate Exp $
  #
  
  # portlet info
  javax.portlet.title=Change Password
  javax.portlet.short-title=Change Password
  
  ## change password
  chgpwd.label.currentPassword=Current Password
  chgpwd.label.newPassword=New Password
  chgpwd.label.newPasswordAgain=New Password (again)
  chgpwd.label.save=Save
  chgpwd.message.passwordChanged=Password changed
  chgpwd.error.notLoggedOn=Not logged on
  chgpwd.error.currentPasswordNull=Current password is required
  chgpwd.error.newPasswordNull=New password is required
  chgpwd.error.newPasswordsDoNotMatch=Passwords do not match
  
  
  
  1.1                  
jakarta-jetspeed-2/applications/security/src/java/org/apache/jetspeed/portlets/security/resources/ChgPwdResources_nl.properties
  
  Index: ChgPwdResources_nl.properties
  ===================================================================
  # Copyright 2004 The Apache Software Foundation
  #
  # Licensed under the Apache License, Version 2.0 (the "License");
  # you may not use this file except in compliance with the License.
  # You may obtain a copy of the License at
  #
  #     http://www.apache.org/licenses/LICENSE-2.0
  #
  # Unless required by applicable law or agreed to in writing, software
  # distributed under the License is distributed on an "AS IS" BASIS,
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  # See the License for the specific language governing permissions and
  # limitations under the License.
  #
  # $Id: ChgPwdResources_nl.properties,v 1.1 2004/10/18 01:42:07 ate Exp $
  #
  
  # portlet info
  javax.portlet.title=Wijzigen Wachtwoord
  javax.portlet.short-title=Wijzigen Wachtwoord
  
  ## change password
  chgpwd.label.currentPassword=Huidige Wachtwoord
  chgpwd.label.newPassword=Nieuw Wachtwoord
  chgpwd.label.newPasswordAgain=Nieuw Wachtwoord (nogmaals)
  chgpwd.label.save=Opslaan
  chgpwd.message.passwordChanged=Wachtwoord gewijzigd
  chgpwd.error.notLoggedOn=Niet aangelogd
  chgpwd.error.currentPasswordNull=Huidige Wachtwoord is verplicht
  chgpwd.error.newPasswordNull=Nieuw Wachtwoord is verplicht
  chgpwd.error.newPasswordsDoNotMatch=Wachtwoorden komen niet overeen
  
  
  
  1.1                  
jakarta-jetspeed-2/applications/security/src/java/org/apache/jetspeed/portlets/security/resources/ChgPwdResources.properties
  
  Index: ChgPwdResources.properties
  ===================================================================
  # Copyright 2004 The Apache Software Foundation
  #
  # Licensed under the Apache License, Version 2.0 (the "License");
  # you may not use this file except in compliance with the License.
  # You may obtain a copy of the License at
  #
  #     http://www.apache.org/licenses/LICENSE-2.0
  #
  # Unless required by applicable law or agreed to in writing, software
  # distributed under the License is distributed on an "AS IS" BASIS,
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  # See the License for the specific language governing permissions and
  # limitations under the License.
  #
  # $Id: ChgPwdResources.properties,v 1.1 2004/10/18 01:42:07 ate Exp $
  #
  
  # portlet info
  javax.portlet.title=Change Password
  javax.portlet.short-title=Change Password
  
  ## change password
  chgpwd.label.currentPassword=Current Password
  chgpwd.label.newPassword=New Password
  chgpwd.label.newPasswordAgain=New Password (again)
  chgpwd.label.save=Save
  chgpwd.message.passwordChanged=Password changed
  chgpwd.error.notLoggedOn=Not logged on
  chgpwd.error.currentPasswordNull=Current password is required
  chgpwd.error.newPasswordNull=New password is required
  chgpwd.error.newPasswordsDoNotMatch=Passwords do not match
  
  
  
  1.1                  
jakarta-jetspeed-2/applications/security/src/webapp/WEB-INF/security/chgpwd/change-password.jsp
  
  Index: change-password.jsp
  ===================================================================
  <%--
  Copyright 2004 The Apache Software Foundation
  
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at
  
      http://www.apache.org/licenses/LICENSE-2.0
  
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
  --%>
  <[EMAIL PROTECTED] 
import="org.apache.jetspeed.portlets.security.ChangePasswordPortlet"%>
  <%@ taglib uri="http://java.sun.com/portlet"; prefix="portlet"%>
  <[EMAIL PROTECTED] uri="http://java.sun.com/jstl/core"; prefix="c"%>
  <[EMAIL PROTECTED] uri="http://java.sun.com/jstl/fmt"; prefix="fmt"%>
  
  <portlet:defineObjects/>
  <fmt:setBundle 
basename="org.apache.jetspeed.portlets.security.resources.ChgPwdResources" />
  
  <c:choose>
    <c:when test="${pageContext.request.userPrincipal != null}">
  
      <c:set var="errorMessagesKey"><%=ChangePasswordPortlet.ERROR_MESSAGES%></c:set>
      <c:set var="errorMessages" value="${requestScope[errorMessagesKey]}"/>
      <c:if test="${errorMessages != null}">
      <ul>
        <c:forEach items="${errorMessages}" var="error">
          <li style="color:red"><c:out value="${error}"/></li>
        </c:forEach>
      </ul>
      </c:if>
  
      <c:set 
var="passwordChangedKey"><%=ChangePasswordPortlet.PASSWORD_CHANGED%></c:set>
      <c:set var="p" value="${requestScope[passwordChangedKey]}"/>
      <c:if test="${requestScope[passwordChangedKey] != null}">
        <br>
        <i><fmt:message key="chgpwd.message.passwordChanged"/></i>
        <br><br>
      </c:if>
  
      <form method="POST" action='<portlet:actionURL/>'>
        <table border="0">
        <tr>
          <td><fmt:message key="chgpwd.label.currentPassword"/></td>
          <td><input type="text" size="30" 
name="<%=ChangePasswordPortlet.CURRENT_PASSWORD%>"></td>
        </tr>
        <tr>
          <td><fmt:message key="chgpwd.label.newPassword"/></td>
          <td><input type="text" size="30" 
name="<%=ChangePasswordPortlet.NEW_PASSWORD%>"></td>
        </tr>
        <tr>
          <td><fmt:message key="chgpwd.label.newPasswordAgain"/></td>
          <td><input type="text" size="30" 
name="<%=ChangePasswordPortlet.NEW_PASSWORD_AGAIN%>"></td>
        </tr>
        <tr>
          <td colspan="2"><input type="submit" value="<fmt:message 
key="chgpwd.label.save"/>"></td>
        </tr>
        </table>
      </form>
    </c:when>
    <c:otherwise>
      <fmt:message key="chgpwd.error.notLoggedOn"/><br>
    </c:otherwise>
  </c:choose>
  
  
  1.5       +34 -25    
jakarta-jetspeed-2/applications/security/src/webapp/WEB-INF/security/login/login.jsp
  
  Index: login.jsp
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/applications/security/src/webapp/WEB-INF/security/login/login.jsp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- login.jsp 17 Sep 2004 22:43:31 -0000      1.4
  +++ login.jsp 18 Oct 2004 01:42:07 -0000      1.5
  @@ -13,32 +13,41 @@
   See the License for the specific language governing permissions and
   limitations under the License.
   --%>
  -<[EMAIL PROTECTED] import="org.apache.jetspeed.login.LoginConstants" %>
  -<%@ taglib uri="http://java.sun.com/jstl/fmt"; prefix="fmt" %>
  +<[EMAIL PROTECTED] import="org.apache.jetspeed.login.LoginConstants"%>
  +<[EMAIL PROTECTED] uri="http://java.sun.com/jstl/fmt"; prefix="fmt"%>
  +<[EMAIL PROTECTED] uri="http://java.sun.com/jstl/core"; prefix="c"%>
  +
   <fmt:setBundle 
basename="org.apache.jetspeed.portlets.security.resources.LoginResources" />
   
  -<html>
  -  <title><fmt:message key="login.label.Login"/></title>
  -  <body>
  -  <% if ( request.getUserPrincipal() != null )
  -             { %>
  -     <fmt:message key="login.label.Welcome"><fmt:param><%= 
request.getUserPrincipal().getName() %></fmt:param></fmt:message><br>
  -     <a href='<%= response.encodeURL(request.getContextPath()+"/login/logout") 
%>'><fmt:message key="login.label.Logout"/></a>
  -  <%         }
  -     else
  -                     {
  -                                     Integer retryCount = 
(Integer)request.getSession().getAttribute(LoginConstants.RETRYCOUNT);
  -                                     if ( retryCount != null )
  -                                     { %>
  -             <br><i><fmt:message 
key="login.label.InvalidUsernameOrPassword"><fmt:param><%=retryCount%></fmt:param></fmt:message></i><br>
  -                <% } %>
  -             <form method="POST" action='<%= 
response.encodeURL(request.getContextPath()+"/login/proxy")%>'>
  -      <fmt:message key="login.label.Username"/> <input type="text" size="15" 
name="<%=LoginConstants.USERNAME%>">
  +<c:choose>
  +  <c:when test="${pageContext.request.userPrincipal != null}">
  +    <fmt:message key="login.label.Welcome"><fmt:param><c:out 
value="${pageContext.request.userPrincipal.name}"/></fmt:param></fmt:message><br>
  +    <a href='<c:url value="/login/logout"/>'><fmt:message 
key="login.label.Logout"/></a>
  +    <br>
  +    <a href='<c:url 
value="/portal/Administrative/change-password.psml"/>'><fmt:message 
key="login.label.ChangePassword"/></a>
  +  </c:when>
  +  <c:otherwise>
  +    <c:set var="retryCountKey"><%=LoginConstants.RETRYCOUNT%></c:set>
  +    <c:set var="retryCount" value="${sessionScope[retryCountKey]}"/>
  +    <c:if test="${retryCount != null}">
  +      <br>
  +      <i><fmt:message key="login.label.InvalidUsernameOrPassword"><fmt:param 
value="${retryCount}"/></fmt:message></i>
         <br>
  -      <fmt:message key="login.label.Password"/> <input type="password" size="15" 
name="<%=LoginConstants.PASSWORD%>">
  -      <input type="submit" value="<fmt:message key="login.label.Login"/>">
  +    </c:if>
  +    <form method="POST" action='<c:url value="/login/proxy"/>'>
  +      <table border="0">
  +      <tr>
  +        <td><fmt:message key="login.label.Username"/></td>
  +        <td><input type="text" size="15" name="<%=LoginConstants.USERNAME%>"></td>
  +      </tr>
  +      <tr>
  +        <td><fmt:message key="login.label.Password"/></td>
  +        <td><input type="password" size="15" 
name="<%=LoginConstants.PASSWORD%>"></td>
  +      </tr>
  +      <tr>
  +        <td colspan="2"><input type="submit" value="<fmt:message 
key="login.label.Login"/>"></td>
  +      </tr>
  +      </table>
       </form>
  -  <% } %>
  -  </body>
  -</html>
  -
  +  </c:otherwise>
  +</c:choose>
  
  
  
  1.1                  
jakarta-jetspeed-2/portal/src/webapp/WEB-INF/pages/Administrative/change-password.psml
  
  Index: change-password.psml
  ===================================================================
  <!--
Copyright 2004 The Apache Software Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
    http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<page id="chgpwd">
  <defaults
     skin="orange"
     layout-decorator="jetspeed"
     portlet-decorator="jetspeed"
  />
  <title>Change Password</title>
  <fragment id="cpwd-1" type="layout" name="jetspeed::VelocityTwoColumns">
    <fragment id="cpwd-2" type="portlet" name="security::ChangePasswordPortlet">
      <property layout="TwoColumns" name="row" value="0" />
      <property layout="TwoColumns" name="column" value="0" />
    </fragment>
  </fragment>
</page>

  
  
  1.10      +10 -1     jakarta-jetspeed-2/applications/security/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/applications/security/project.xml,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- project.xml       6 Oct 2004 23:45:05 -0000       1.9
  +++ project.xml       18 Oct 2004 01:42:07 -0000      1.10
  @@ -16,6 +16,15 @@
     </repository>
   
     <dependencies>
  +     <dependency>
  +      <groupId>jetspeed2</groupId>
  +      <artifactId>jetspeed-api</artifactId>
  +      <version>2.0-a1-dev</version>
  +      <type>jar</type>
  +      <properties>
  +        <war.bundle>false</war.bundle>
  +      </properties>
  +     </dependency>
       <dependency>
         <id>portlet-api</id>
         <groupId>portlet-api</groupId>
  
  
  
  1.1                  
jakarta-jetspeed-2/applications/security/src/java/org/apache/jetspeed/portlets/security/ChangePasswordPortlet.java
  
  Index: ChangePasswordPortlet.java
  ===================================================================
  /*
   * Copyright 2000-2004 The Apache Software Foundation.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   * 
   *      http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  package org.apache.jetspeed.portlets.security;
  
  import java.io.IOException;
  import java.util.ArrayList;
  import java.util.ResourceBundle;
  
  import javax.portlet.ActionRequest;
  import javax.portlet.ActionResponse;
  import javax.portlet.PortletConfig;
  import javax.portlet.PortletException;
  import javax.portlet.RenderRequest;
  import javax.portlet.RenderResponse;
  
  import org.apache.jetspeed.security.SecurityException;
  import org.apache.jetspeed.security.UserManager;
  import org.apache.portals.bridges.common.GenericServletPortlet;
  
  /**
   * This portlet allows a logged on user to change its password.
   *
   * @author <a href="mailto:[EMAIL PROTECTED]">Ate Douma</a>
   * @version $Id: ChangePasswordPortlet.java,v 1.1 2004/10/18 01:42:08 ate Exp $
   */
  public class ChangePasswordPortlet extends GenericServletPortlet
  {
      private UserManager manager;
      
      public static final String CURRENT_PASSWORD = "currentPassword";
      public static final String NEW_PASSWORD = "newPassword";
      public static final String NEW_PASSWORD_AGAIN = "newPasswordAgain";
      public static final String ERROR_MESSAGES = "errorMessages";
      public static final String PASSWORD_CHANGED = "passwordChanged";
      public static final String CPS_USER_MANAGER_COMPONENT = "cps:UserManager";
      
      public void init(PortletConfig config)
      throws PortletException 
      {
          super.init(config);
          manager = (UserManager) 
getPortletContext().getAttribute(CPS_USER_MANAGER_COMPONENT);
          if (null == manager)
          {
              throw new PortletException("Failed to find the User Manager on portlet 
initialization");
          }
      }
      
      public void doView(RenderRequest request, RenderResponse response) throws 
PortletException, IOException
      {
          response.setContentType("text/html");
          
          ArrayList errorMessages = 
(ArrayList)request.getPortletSession().getAttribute(ERROR_MESSAGES);
          if (errorMessages != null )
          {
              request.getPortletSession().removeAttribute(ERROR_MESSAGES);
              request.setAttribute(ERROR_MESSAGES,errorMessages);
          }
          else
          {
              Boolean password_changed = 
(Boolean)request.getPortletSession().getAttribute(PASSWORD_CHANGED);
              if ( password_changed != null )
              {
                  request.getPortletSession().removeAttribute(PASSWORD_CHANGED);
                  request.setAttribute(PASSWORD_CHANGED,password_changed);
              }
          }        
          super.doView(request, response);
      }
      
      public void processAction(ActionRequest actionRequest, ActionResponse 
actionResponse) throws PortletException,
      IOException
      {
          ResourceBundle bundle = 
ResourceBundle.getBundle("org.apache.jetspeed.portlets.security.resources.ChgPwdResources",actionRequest.getLocale());
  
          ArrayList errorMessages = new ArrayList();
          
          if ( actionRequest.getUserPrincipal() != null )
          {
              String currPassword = actionRequest.getParameter(CURRENT_PASSWORD);
              String newPassword = actionRequest.getParameter(NEW_PASSWORD);
              String newPasswordAgain = actionRequest.getParameter(NEW_PASSWORD_AGAIN);
          
              if (currPassword == null || currPassword.length() == 0)
              {
                  
errorMessages.add(bundle.getString("chgpwd.error.currentPasswordNull"));
                  currPassword = null;
              }
              if (newPassword == null || newPassword.length() == 0)
              {
                  errorMessages.add(bundle.getString("chgpwd.error.newPasswordNull"));
                  newPassword = null;
              }
              if (newPassword != null && newPassword.length() == 0)
              {
                  newPassword = null;
              }
              
              if (newPassword != null && 
                      (newPasswordAgain == null || (newPasswordAgain != null && 
!newPassword.equals(newPasswordAgain))))
              {
                  
errorMessages.add(bundle.getString("chgpwd.error.newPasswordsDoNotMatch"));
              }
              if ( errorMessages.size() == 0 )
              {
                  try
                  {
                      System.out.println("manager="+manager);
                      manager.setPassword(actionRequest.getUserPrincipal().getName(), 
currPassword, newPassword);
                  }
                  catch ( SecurityException e)
                  {
                      errorMessages.add(e.getMessage());
                  }
              }
              if ( errorMessages.size() > 0 )
              {
                  
actionRequest.getPortletSession().setAttribute(ERROR_MESSAGES,errorMessages);
              }
              else
              {
                  
actionRequest.getPortletSession().setAttribute(PASSWORD_CHANGED,Boolean.TRUE);
              }
          }
      }
  }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to