head	1.34;
access;
symbols
	TIGRIS_1_1_0RC2:1.23
	TIGRIS_1_1_0RC1:1.23
	TIGRIS_1_1:1.23.0.4
	TIGRIS_1_0_8:1.23
	TIGRIS_1_0_8RC3:1.23
	TIGRIS_1_0_8RC2:1.23
	TIGRIS_1_0_8RC1:1.23
	TIGRIS_1_0_7:1.23
	TIGRIS_1_0_7RC3:1.23
	TIGRIS_1_0_7RC2:1.23
	TIGRIS_1_0_7RC1:1.23
	TIGRIS_1_0_6:1.23
	TIGRIS_1_0_6RC5:1.23
	TIGRIS_1_0_6RC4:1.23
	TIGRIS_1_0_6RC3:1.23
	TIGRIS_1_0_6RC2:1.23
	TIGRIS_1_0_6RC1:1.23
	TIGRIS_1_0_5:1.23
	TIGRIS_1_0_5RC6:1.23
	TIGRIS_1_0_5RC5:1.23
	TIGRIS_1_0_5RC4:1.23
	TIGRIS_1_0_5RC3:1.23
	TIGRIS_1_0_5RC2:1.23
	TIGRIS_1_0_5RC1:1.23
	TIGRIS_1_0_4:1.23
	TIGRIS_1_0_3:1.23
	TIGRIS_1_0_2:1.23
	TIGRIS_1_0_1:1.23
	TIGRIS_1_0:1.23.0.6
	TIGRIS_1_0_0:1.23
	TIGRIS_1_0_0_RC1:1.23.0.2
	TIGRIS_0_9_2_4:1.15
	TIGRIS_0_9_2_3:1.15
	HELM_PEER_PORT_BRANCH:1.17.0.2
	TURBINE_PEER:1.17
	TIGRIS_0_9_2_1:1.17
	TIGRIS_0_9_2:1.15.0.4
	TIGRIS_0_9_0:1.15.0.2
	TIGRIS_0_8_4:1.11.0.2
	NEWHELM:1.1.1.1
	TIGRIS_NOV_12_2000:1.1.1;
locks; strict;
comment	@# @;


1.34
date	2001.08.11.09.08.01;	author dlr;	state Exp;
branches;
next	1.33;

1.33
date	2001.08.06.21.29.10;	author dlr;	state Exp;
branches;
next	1.32;

1.32
date	2001.07.24.00.02.27;	author leonardr;	state Exp;
branches;
next	1.31;

1.31
date	2001.07.18.23.49.52;	author dlr;	state Exp;
branches;
next	1.30;

1.30
date	2001.07.18.10.05.12;	author dlr;	state Exp;
branches;
next	1.29;

1.29
date	2001.07.17.17.55.45;	author leonardr;	state Exp;
branches;
next	1.28;

1.28
date	2001.07.12.00.50.17;	author leonardr;	state Exp;
branches;
next	1.27;

1.27
date	2001.07.11.23.13.29;	author leonardr;	state Exp;
branches;
next	1.26;

1.26
date	2001.07.06.19.17.35;	author leonardr;	state Exp;
branches;
next	1.25;

1.25
date	2001.05.23.01.50.09;	author dlr;	state Exp;
branches;
next	1.24;

1.24
date	2001.04.11.17.42.11;	author leonardr;	state Exp;
branches;
next	1.23;

1.23
date	2001.03.09.01.47.22;	author leonardr;	state Exp;
branches;
next	1.22;

1.22
date	2001.03.07.01.53.20;	author lucas;	state Exp;
branches;
next	1.21;

1.21
date	2001.02.28.23.29.58;	author dlr;	state Exp;
branches;
next	1.20;

1.20
date	2001.02.27.05.15.39;	author dlr;	state Exp;
branches;
next	1.19;

1.19
date	2001.02.21.04.38.34;	author dlr;	state Exp;
branches;
next	1.18;

1.18
date	2001.02.21.03.23.57;	author edk;	state Exp;
branches;
next	1.17;

1.17
date	2001.01.26.18.29.02;	author edk;	state Exp;
branches
	1.17.2.1;
next	1.16;

1.16
date	2001.01.26.05.24.05;	author edk;	state dead;
branches;
next	1.15;

1.15
date	2000.12.20.08.06.35;	author dlr;	state Exp;
branches;
next	1.14;

1.14
date	2000.12.16.00.12.11;	author dlr;	state Exp;
branches;
next	1.13;

1.13
date	2000.12.06.22.36.33;	author dlr;	state Exp;
branches;
next	1.12;

1.12
date	2000.12.06.22.16.49;	author dlr;	state Exp;
branches;
next	1.11;

1.11
date	2000.12.01.10.20.00;	author dlr;	state Exp;
branches;
next	1.10;

1.10
date	2000.12.01.09.45.00;	author dlr;	state Exp;
branches;
next	1.9;

1.9
date	2000.12.01.09.09.59;	author dlr;	state Exp;
branches;
next	1.8;

1.8
date	2000.12.01.08.46.28;	author dlr;	state Exp;
branches;
next	1.7;

1.7
date	2000.12.01.08.43.55;	author dlr;	state Exp;
branches;
next	1.6;

1.6
date	2000.12.01.07.59.02;	author dlr;	state Exp;
branches;
next	1.5;

1.5
date	2000.11.30.23.27.58;	author dlr;	state Exp;
branches;
next	1.4;

1.4
date	2000.11.30.23.16.17;	author dlr;	state Exp;
branches;
next	1.3;

1.3
date	2000.11.30.21.05.09;	author dlr;	state Exp;
branches;
next	1.2;

1.2
date	2000.11.30.08.32.36;	author dlr;	state Exp;
branches;
next	1.1;

1.1
date	2000.11.12.21.15.30;	author dlr;	state Exp;
branches
	1.1.1.1;
next	;

1.1.1.1
date	2000.11.12.21.15.30;	author dlr;	state Exp;
branches;
next	;

1.17.2.1
date	2001.01.28.01.02.17;	author dlr;	state dead;
branches;
next	;


desc
@@


1.34
log
@Upgrading to Turbine 3.0-dev, Fulcrum 1.0, and Torque 1.0.
@
text
@/* ================================================================
 * Copyright (c) 2000 CollabNet.  All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
 * met:
 * 
 * 1. Redistributions of source code must retain the above copyright
 * notice, this list of conditions and the following disclaimer.
 * 
 * 2. Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * 
 * 3. The end-user documentation included with the redistribution, if
 * any, must include the following acknowlegement: "This product includes
 * software developed by CollabNet (http://www.collab.net/)."
 * Alternately, this acknowlegement may appear in the software itself, if
 * and wherever such third-party acknowlegements normally appear.
 * 
 * 4. The hosted project names must not be used to endorse or promote
 * products derived from this software without prior written
 * permission. For written permission, please contact info@@collab.net.
 * 
 * 5. Products derived from this software may not use the "Tigris" name
 * nor may "Tigris" appear in their names without prior written
 * permission of CollabNet.
 * 
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 * IN NO EVENT SHALL COLLABNET OR ITS CONTRIBUTORS BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * ====================================================================
 * 
 * This software consists of voluntary contributions made by many
 * individuals on behalf of CollabNet.
 */


package org.tigris.helm.domain;

import java.util.*;
import java.sql.*;
import javax.servlet.http.HttpSession;

import org.apache.turbine.util.Log;
import org.apache.commons.util.exception.NestableException;
import org.apache.commons.util.StringUtils;

import org.apache.velocity.context.Context;

import org.tigris.helm.om.User;
import org.tigris.helm.om.UserPeer;
import org.tigris.helm.security.ACLException;
import org.tigris.helm.security.HelmServlet;
import org.tigris.helm.security.RedirectException;
import org.tigris.helm.tool.ContextAPI;
import org.tigris.helm.tool.SessionManager;

/**
 * Allows a new password to be set by user's holding the right password change
 * ticket.
 *
 * @@author <a href="mailto:dlr@@collab.net">Daniel Rall</a>
 * @@version $Id: PasswordEdit.java,v 1.33 2001/08/06 21:29:10 dlr Exp $
 */
public class PasswordEdit extends HelmServlet
{
    /**
     * The ticket necessary for change of password.
     */
    private static final String TICKET = "ticket";

    /**
     * Password CGI key.
     */
    private static final String PASSWD = "passwd";

    /**
     * Password confirmation context key.
     */
    private static final String PASSWD_CONFIRM = "passwdConfirm";

    /**
     * The action for changing the password.
     */
    private static final String CHANGE_PASSWD = "Change Password";

    /**
     * Password changed message.
     */
    private static final String PASSWORD_CHANGED_MESSAGE =
        "Your password has been changed";

    /**
     * The message to show when either the ticket or the userID is invalid.
     */
    private static final String INVALID_TICKET_MESSAGE =
        "The ticket you specified is not valid. It may have been used already.";

    private static final boolean DEBUG = true;

    /**
     * Display UI for changing the user's password if they have a ticket to
     * the show.
     */
    protected String processRequest(Context context)
        throws NestableException, RedirectException
    {
        String templateName = super.processRequest(context);
        String action = getAction(context);

        SessionManager sMgr = getSessionManager(context);
        try
        {
            User loginUser = getLoginUser(context);
            User currentUser = getCurrentUser(context);

            String ticket = ContextAPI.processField(context, TICKET);
            if (haveValue(ticket))
            {
                if (!currentUser.isValidPasswordTicket(ticket))
                {
                    throw new NestableException(INVALID_TICKET_MESSAGE);
                }
            }
            else if (!currentUser.isEditableBy(loginUser.getACL()))
            {
                throw new ACLException
                    (loginUser.getACL(), 
                     "Permission to edit " + currentUser.getLoginName(),
                     loginUser.getDomain().getName(), null);
            }

            if (CHANGE_PASSWD.equals(action))
            {                
                //Get new password data.
                String oldPassword = null;
                String passwd = ContextAPI.processRequiredFieldRaw
                    (context, PASSWD, "Password");
                String passwdConfirm = ContextAPI.processRequiredFieldRaw
                    (context, PASSWD_CONFIRM, "Password confirmation");
                
                if (ContextAPI.isValidUserInput(context))
                {
                    if (!StringUtils.isValid(ticket))
                    {
                        //They're trying to change a user's password
                        //using their user editing permissions. We've
                        //already verified that they have permission.
                        currentUser.changePassword (passwd, passwdConfirm);
                    }
                    else
                    {
                        currentUser.changePassword
                            (ticket, passwd, passwdConfirm);
                    }
                    
                    //Password has been successfully changed (else
                    //an exception was thrown). Log the user in
                    //and send them to StartPage.
                    ContextAPI.addMessage(context, PASSWORD_CHANGED_MESSAGE);
                    sMgr.init(currentUser);

                    redirectTo("StartPage");
                }
            }
        }
        catch (RedirectException e)
        {
            throw e;
        }
        catch (Exception e)
        {
            Log.error(e);
            throw new NestableException(e);
        }

        return templateName;
    }
}
@


1.33
log
@Added an init() method to the SessionManager class; made use of it in two places.
@
text
@d55 2
a56 2
import org.apache.turbine.util.TurbineException;
import org.apache.turbine.util.StringUtils;
d73 1
a73 1
 * @@version $Id: PasswordEdit.java,v 1.32 2001/07/24 00:02:27 leonardr Exp $
d116 1
a116 1
        throws TurbineException, RedirectException
d132 1
a132 1
                    throw new TurbineException(INVALID_TICKET_MESSAGE);
d184 1
a184 1
            throw new TurbineException(e);
@


1.32
log
@The final pieces of the error handling revolution.
@
text
@d73 1
a73 1
 * @@version $Id: PasswordEdit.java,v 1.31 2001/07/18 23:49:52 dlr Exp $
d171 2
a172 6
                    sMgr.isLoggedIn(true); 
                    sMgr.setUserID(currentUser.getID()); 
                    sMgr.setLoginID(currentUser.getLoginName()); 
                    sMgr.setEmail(currentUser.getEmail()); 
                    sMgr.setUserName(currentUser.getRealName()); 
                    
@


1.31
log
@Removed Joist dependancies.
@
text
@d73 1
a73 1
 * @@version $Id: PasswordEdit.java,v 1.30 2001/07/18 10:05:12 dlr Exp $
d154 6
a159 26
                    try 
                    {                        
                        if (!StringUtils.isValid(ticket))
                        {
                            //They're trying to change a user's password
                            //using their user editing permissions. We've
                            //already verified that they have permission.
                            currentUser.changePassword (passwd, passwdConfirm);
                        }
                        else
                        {
                            currentUser.changePassword
                                (ticket, passwd, passwdConfirm);
                        }

                        //Password has been successfully changed (else
                        //an exception was thrown). Log the user in
                        //and send them to StartPage.
                        appendToMessage(context, PASSWORD_CHANGED_MESSAGE);
                        sMgr.isLoggedIn(true); 
                        sMgr.setUserID(currentUser.getID()); 
                        sMgr.setLoginID(currentUser.getLoginName()); 
                        sMgr.setEmail(currentUser.getEmail()); 
                        sMgr.setUserName(currentUser.getRealName()); 
                    
                        redirectTo("StartPage");
d161 1
a161 1
                    catch (RedirectException e)
d163 2
a164 1
                        throw e;
d166 12
a177 5
                    catch (Exception e)
                    {
                        //Display an error, but let them try again.
                        appendToError(context, e.getMessage());
                    }                    
d187 2
a188 4
            String errMsg = e.getMessage();
            Log.error(errMsg, e);
            appendToError(context, errMsg);
            throw new TurbineException(errMsg, e);
@


1.30
log
@Ported Joist Redirect*Exception to Helm.
@
text
@a59 8
import org.joist.*;
import org.joist.util.*;
import org.tigris.helm.tool.SessionManager;
import org.tigris.helm.security.RedirectException;
import org.joist.security.UnsecureServlet;
import org.joist.database.DataManager;

import org.tigris.helm.security.*;
d62 3
d66 1
d73 1
a73 1
 * @@version $Id: PasswordEdit.java,v 1.29 2001/07/17 17:55:45 leonardr Exp $
@


1.29
log
@Porting of domain package to new error handling API.
@
text
@d63 1
a63 1
import org.joist.security.RedirectException;
d77 1
a77 1
 * @@version $Id: PasswordEdit.java,v 1.28 2001/07/12 00:50:17 leonardr Exp $
@


1.28
log
@Fixed ticket bug and got rid of the need to store ticket in session.
@
text
@d56 1
a56 1
import org.apache.turbine.util.TurbineException;
d70 1
d77 1
a77 1
 * @@version $Id: PasswordEdit.java,v 1.27 2001/07/11 23:13:29 leonardr Exp $
d131 1
a131 1
            String ticket = processField(context, TICKET);
a149 1
                List missingFields = new ArrayList();
d151 4
a154 5
                String passwd = processFieldRaw(context, PASSWD, "Password",
                                                missingFields);
                String passwdConfirm = processFieldRaw
                    (context, PASSWD_CONFIRM, "Password confirmation", 
                     missingFields);
d156 1
a156 1
                if (isValidUserInput(missingFields, null))
d160 1
a160 1
                        if (!haveValue(ticket))
a193 4
                }
                else
                {
                    reportInvalidUserInput(context, missingFields, null);
@


1.27
log
@Trim leading and trailing spaces in form fields, except when obtaining passwords.
@
text
@d70 1
d76 1
a76 1
 * @@version $Id: PasswordEdit.java,v 1.26 2001/07/06 19:17:35 leonardr Exp $
d127 1
a127 1
            //See which user they're trying to edit the password of.
a128 1
            User loginUser = getLoginUser(context);
d130 1
a130 3
            //If they are providing a ticket, get it and store it in
            //the session.
            String ticket = processField(context, TICKET, sMgr.getSession());
d133 1
a133 5
                if (currentUser.isValidPasswordTicket(ticket))
                {
                    sMgr.getSession().putValue(TICKET, ticket);
                }
                else
d138 7
d146 1
a146 1
            if (action != null && action.equals(CHANGE_PASSWD))
d160 2
a161 2
                    {
                        if (loginUser.equals(currentUser))
d163 4
a166 6
                            if (loginUser.getACL().hasPermission
                                ("User - Edit - Self"))
                            {
                                currentUser.changePassword
                                    (passwd, passwdConfirm);
                            }
a171 1
                            sMgr.getSession().removeValue(TICKET);
@


1.26
log
@Change to new API.
@
text
@d75 1
a75 1
 * @@version $Id: PasswordEdit.java,v 1.25 2001/05/23 01:50:09 dlr Exp $
d150 5
a154 5
                String passwd = processField(context, PASSWD, "Password",
                                             missingFields);
                String passwdConfirm =
                    processField(context, PASSWD_CONFIRM,
                                 "Password confirmation", missingFields);
d160 15
a174 3
                        currentUser.changePassword
                            (ticket, passwd, passwdConfirm);
                        sMgr.getSession().removeValue(TICKET);
@


1.25
log
@Ported Helm from WebMacro to Velocity.
@
text
@d75 1
a75 1
 * @@version $Id: PasswordEdit.java,v 1.24 2001/04/11 17:42:11 leonardr Exp $
d149 1
d160 3
a162 18
                        try
                        {
                            currentUser.changePassword(loginUser.getACL(), passwd,
                                                       passwdConfirm);
                        }
                        catch (ACLException e)
                        {
                            if (ticket != null)
                            {
                                currentUser.changePassword
                                    (ticket, passwd, passwdConfirm);
                                sMgr.getSession().removeValue(TICKET);
                            }
                            else
                            {
                                throw e;
                            }
                        }
@


1.24
log
@Reworked PasswordEdit and got rid of the practice of generating passwords for new users. New users now get a ticket into PasswordEdit to set their passwords initially.
@
text
@d55 2
d58 1
a58 1
import org.webmacro.servlet.*;
d62 1
a62 1
import org.joist.session.SessionManager;
d75 1
a75 1
 * @@version $Id: PasswordEdit.java,v 1.23 2001/03/09 01:47:22 leonardr Exp $
d117 2
a118 2
    protected String processRequest (Connection conn, WebContext context)
        throws HandlerException, RedirectException
d120 1
a120 1
        String templateName = super.processRequest(conn, context);
d141 1
a141 1
                    throw new HandlerException(INVALID_TICKET_MESSAGE);
d215 1
a215 1
            throw new HandlerException(errMsg);
@


1.23
log
@Removed debugging info.
@
text
@d65 1
d73 1
a73 1
 * @@version $Id: PasswordEdit.java,v 1.22 2001/03/07 01:53:20 lucas Exp $
d75 1
a75 1
public class PasswordEdit extends UnsecureServlet
d88 1
a88 1
     * The action for changing the password.
d90 1
a90 3
    private static final String CHANGE_PASSWD = "Change Password";

    private static final String USER_ID = "passwordEditUserID";
d93 1
a93 1
     * Context key which indicates password edit autorization.
d95 1
a95 6
    private static final String HAS_AUTH = "hasPasswordEditAuth";

    /**
     * Password confirmation context key.
     */
    private static final String PASSWD_CONFIRM = "passwdConfirm";
d100 1
a100 1
    private static final String PASSWD_CHANGED_MSG =
d106 2
a107 2
    private static final String INVALID_AUTH_MSG =
        "Your password modification autorization is not valid.";
d112 1
a112 1
     * Display WUI for changing the user's password if they have a ticket to
d115 1
a115 1
    protected String processRequest (Connection conn, WebContext ctx)
d118 2
a119 3
        String templateName = super.processRequest(conn, ctx);

        String action = getAction(ctx);
d121 1
d124 18
a141 5
            HttpSession session = getSessionManager(ctx).getSession();
            String userID = ctx.getForm("userID");
            if (!haveValue(userID)) userID = (String)session.getValue(USER_ID);
            User user = UserPeer.getInstance(userID);
            Boolean hasAuth = null;
d144 10
a153 3
            {
                hasAuth = (Boolean)session.getValue(HAS_AUTH);
                if (hasAuth != null && hasAuth.booleanValue())
d155 1
a155 8
                    // Allow change of password.
                    List missingFields = new ArrayList();
                    String passwd = processField(ctx, PASSWD, "Password",
                                                 missingFields);
                    String passwdConfirm =
                        processField(ctx, PASSWD_CONFIRM,
                                     "Password confirmation", missingFields);
                    if (isValidUserInput(missingFields, null))
d159 2
a160 17
                            // ASSUMPTION: The user is changing their own
                            // password.
                            user.changePassword(user.getACL(), passwd,
                                                passwdConfirm);
                            appendToMessage(ctx, PASSWD_CHANGED_MSG);
                            user.clearPasswordTicket();
                            session.removeValue(USER_ID);
                            session.removeValue(HAS_AUTH);

                            SessionManager sMgr = getSessionManager(ctx);
                            sMgr.isLoggedIn(true); 
                            sMgr.setUserID(user.getID()); 
                            sMgr.setLoginID(user.getLoginName()); 
                            sMgr.setEmail(user.getEmail()); 
                            sMgr.setUserName(user.getRealName()); 

                            redirectTo("StartPage");
d162 1
a162 1
                        catch (RedirectException e)
d164 10
a173 6
                            throw e;
                        }
                        catch (Exception passwdMismatch)
                        {
                            // Passwords did not match.
                            appendToMessage(ctx, passwdMismatch.getMessage());
d175 12
d188 1
a188 1
                    else
d190 1
a190 1
                        reportInvalidUserInput(ctx, missingFields, null);
d192 5
d200 1
a200 1
                    appendToMessage(ctx, INVALID_AUTH_MSG);
a202 19
            else
            {
                // Display UI.
                String ticket = ctx.getForm(TICKET);
                if (user != null && user.isValidPasswordTicket(ticket))
                {
                    // Cache auth status and user key.
                    hasAuth = Boolean.TRUE;
                    session.putValue(HAS_AUTH, hasAuth);
                    session.putValue(USER_ID, user.getID());
                }
                else
                {
                    appendToMessage(ctx, INVALID_AUTH_MSG);
                }
            }

            ctx.put(HAS_AUTH, hasAuth);
            ctx.put("user", user);
d210 1
a210 1
            String errMsg = "Error changing password: " + e.getMessage();
d212 1
a212 1
            appendToMessage(ctx, errMsg);
@


1.22
log
@Corrected regex madness for Torque upgrade.  -dlr
@
text
@d17 1
a17 1
 * software developed by Collab.Net (http://www.Collab.Net/)."
d27 1
a27 1
 * permission of Collab.Net.
d32 1
a32 1
 * IN NO EVENT SHALL COLLAB.NET OR ITS CONTRIBUTORS BE LIABLE FOR ANY
d72 1
a72 1
 * @@version $Id: PasswordEdit.java,v 1.21 2001/02/28 23:29:58 dlr Exp $
a126 1
        if (DEBUG) Log.debug("action=" + action);
a132 1
            if (DEBUG) Log.debug("userID=" + userID);
a193 1
                if (DEBUG) Log.debug("Password edit ticket=" + ticket);
@


1.21
log
@Log in the user and redirect them to their StartPage after their
password has been changed (IZ #2758).
@
text
@d66 1
a66 2
import org.tigris.helm.om.peer.UserPeer;

d72 1
a72 1
 * @@version $Id: PasswordEdit.java,v 1.20 2001/02/27 05:15:39 dlr Exp $
@


1.20
log
@* Clear the user's password ticket before clearing the session flag.
* Moved redirectTo() into try block, adding rethrow of
  RedirectException.
* Improved logging output for ticket value.
* Always put the user and auth flag into the context.
@
text
@d73 1
a73 1
 * @@version $Id: PasswordEdit.java,v 1.19 2001/02/21 04:38:34 dlr Exp $
d163 9
a171 1
                            redirectTo("TLogin");
@


1.19
log
@Password update changes.
@
text
@d73 1
a73 1
 * @@version $Id: PasswordEdit.java,v 1.18 2001/02/21 03:23:57 edk Exp $
d160 1
d163 5
a167 1
                            user.clearPasswordTicket();
a173 1
                        redirectTo("TLogin");
d189 1
a189 1
                if (DEBUG) Log.debug("ticket=" + ticket);
a194 1
                    ctx.put(HAS_AUTH, hasAuth);
a200 1
                ctx.put("user", user);
d202 3
@


1.18
log
@delete stuff from the head which is obsolete in the branch (more changes
are still needed for a clean compile)
@
text
@d54 2
a55 1
import org.webmacro.util.Log;
d73 1
a73 1
 * @@version $Id: PasswordEdit.java,v 1.17 2001/01/26 18:29:02 edk Exp $
d116 1
a116 3
    private static Log log = new Log("pwdEdit", "PasswordEdit");

    private static final boolean debug = true;
a124 1
        if (debug) log.info("started");
d128 1
a128 1
        if (debug) log.info("action=" + action);
a132 1
            DataManager dMgr = getDataManager(ctx);
d135 1
a135 1
            if (debug) log.info("userID=" + userID);
a152 1
                        
d155 4
a158 1
                            user.updatePassword(ctx, passwd, passwdConfirm);
d185 1
a185 1
                if (debug) log.info("ticket=" + ticket);
d207 2
a208 3
            log.exception(e);
            String errMsg = e.getMessage();
            if (debug) log.warning(errMsg);
@


1.17
log
@readding all the files as part of the process of returning to the way
things were as of tuesday
@
text
@d64 3
d72 1
a72 1
 * @@version $Id: PasswordEdit.java,v 1.15 2000/12/20 08:06:35 dlr Exp $
d139 1
a139 1
            User user = new User(conn, dMgr, userID);
d165 1
a165 1
                        catch (JoistException passwdMismatch)
@


1.17.2.1
log
@Porting to the Turbine Peer system.  -dlr and leonardr
@
text
@d69 1
a69 1
 * @@version $Id: PasswordEdit.java,v 1.17 2001/01/26 18:29:02 edk Exp $
@


1.16
log
@revert this stuff to its state as of 2001/01/24 12:42:00 GMT -- with
the following exceptions, which have some different modifications so
they'll work with changes which have happened in joist:

ProjectNewsEdit.java
SkinManager.java
SkinStyleElementValueManager.java
StyleElementManager.java
StyleManager.java

it compiles.  i dunno if it works, though.
@
text
@@


1.15
log
@- Only clear out the persistant values if the passwords match.
- Use redirectTo() to reuse the current context (and the message it
  contains) on the next screen.
@
text
@d69 1
a69 1
 * @@version $Id: PasswordEdit.java,v 1.14 2000/12/16 00:12:11 dlr Exp $
@


1.14
log
@Add the user whose password to change to the context.
@
text
@d69 1
a69 1
 * @@version $Id: PasswordEdit.java,v 1.13 2000/12/06 22:36:33 dlr Exp $
d157 4
d167 1
a167 5
                        appendToMessage(ctx, PASSWD_CHANGED_MSG);
                        session.removeValue(USER_ID);
                        session.removeValue(HAS_AUTH);
                        user.clearPasswordTicket();
                        redirectToURL(ctx, "TLogin");
@


1.13
log
@Added a breadcrumb.
@
text
@d69 1
a69 1
 * @@version $Id: PasswordEdit.java,v 1.12 2000/12/06 22:16:49 dlr Exp $
d196 1
@


1.12
log
@Changed invalid auth message.
@
text
@d69 1
a69 1
 * @@version $Id: PasswordEdit.java,v 1.11 2000/12/01 10:20:00 dlr Exp $
d183 1
@


1.11
log
@Now removing password ticket after use.
@
text
@d69 1
a69 1
 * @@version $Id: PasswordEdit.java,v 1.10 2000/12/01 09:45:00 dlr Exp $
d110 1
a110 1
        "Your autorization to modify your password is not valid.";
@


1.10
log
@This actually works now.
@
text
@d69 1
a69 1
 * @@version $Id: PasswordEdit.java,v 1.9 2000/12/01 09:09:59 dlr Exp $
d166 1
a166 1
                        // TODO: Remove ticket from database.
@


1.9
log
@Auth status needs to be reflected in the context (as well as the
session).
@
text
@d69 1
a69 1
 * @@version $Id: PasswordEdit.java,v 1.8 2000/12/01 08:46:28 dlr Exp $
d137 1
a137 14
            String ticket = ctx.getForm(TICKET);
            if (user != null && user.isValidPasswordTicket(ticket))
            {
                // Cache auth status and user key.
                session.putValue(HAS_AUTH, Boolean.TRUE);
                session.putValue(USER_ID, user.getID());
            }
            else
            {
                appendToMessage(ctx, INVALID_AUTH_MSG);
            }

            Boolean hasAuth = (Boolean)session.getValue(HAS_AUTH);
            ctx.put(HAS_AUTH, hasAuth);
d141 1
d167 1
a167 1
                        redirectTo("TLogin");
d173 17
@


1.8
log
@"Out, damn tab!"
@
text
@d69 1
a69 1
 * @@version $Id: PasswordEdit.java,v 1.7 2000/12/01 08:43:55 dlr Exp $
d135 1
d140 1
a140 1
                // Cache auth status in the session.
d149 3
d154 1
a154 1
                if (session.getValue(HAS_AUTH) != null)
@


1.7
log
@PasswordEdit should not require the user to log in, so it must
subclass UnsecureServlet (rather than HelmSerlvet).
@
text
@d69 1
a69 1
 * @@version $Id: PasswordEdit.java,v 1.6 2000/12/01 07:59:02 dlr Exp $
d121 1
a121 1
	throws HandlerException, RedirectException
d123 2
a124 2
	if (debug) log.info("started");
	String templateName = super.processRequest(conn, ctx);
d126 2
a127 2
	String action = getAction(ctx);
	if (debug) log.info("action=" + action);
d129 1
a129 1
	try
d188 1
a188 1
	catch (RedirectException e)
d192 1
a192 1
	catch (Exception e)
d194 3
a196 3
	    log.exception(e);
	    String errMsg = e.getMessage();
	    if (debug) log.warning(errMsg);
d199 1
a199 1
	}
@


1.6
log
@Untested, but expected to now allow editting of passwords when
presented with a valid ticket.
@
text
@d61 2
a62 2

import org.tigris.helm.security.HelmServlet;
d69 1
a69 1
 * @@version $Id: PasswordEdit.java,v 1.5 2000/11/30 23:27:58 dlr Exp $
d71 1
a71 1
public class PasswordEdit extends HelmServlet
d132 4
a135 4
            String userID = (String)session.getValue(USER_ID);
            User user = (haveValue(userID) ?
                         new User(conn, dMgr, userID) :
                         getCurrentUser(ctx));
@


1.5
log
@Now named PasswordEdit.
@
text
@d52 1
d59 1
d69 1
a69 1
 * @@version $Id: PasswordEdit.java,v 1.4 2000/11/30 23:16:17 dlr Exp $
d79 1
a79 1
     * Password context key.
d84 12
d100 12
d131 5
a135 1
            User user = getCurrentUser(ctx);
d139 47
a185 4
                String passwd = ctx.getForm(PASSWD);
                String passwdConfirm = ctx.getForm(PASSWD_CONFIRM);
                // TODO: Allow change of password.
                user.updatePassword(ctx, passwd, passwdConfirm);
d187 2
a188 2
	}
        catch (JoistException e)
d190 1
a190 2
            // Passwords did not match.
            appendToMessage(ctx, e.getMessage());
@


1.4
log
@Prep'd for name change.
@
text
@d67 1
a67 1
 * @@version $Id: PasswordEmailed.java,v 1.3 2000/11/30 21:05:09 dlr Exp $
d69 1
a69 1
public class PasswordEmailed extends HelmServlet
d86 1
a86 1
    private static Log log = new Log("pwdEmail", "PasswordEmailed");
@


1.3
log
@Closer to the desired behavior.
@
text
@d67 1
a67 1
 * @@version $Id: PasswordEmailed.java,v 1.2 2000/11/30 08:32:36 dlr Exp $
d76 11
a86 1
    private static Log log = new Log("PasswordEmailed", "Tigris StartPage");
d98 1
a99 1
	String templateName = super.processRequest(conn, ctx);
d109 2
d112 1
d115 5
@


1.2
log
@Scrubbed for addition of new functionality.  This servlet should be
renamed if the new comments are in line with the desired
functionality.
@
text
@d67 1
a67 1
 * @@version $Id: $
d71 5
d95 6
a100 2
            User user = getLoginUser(ctx);
            // TODO: Allow change of password.
@


1.1
log
@Initial revision
@
text
@a49 1
import java.io.*;
a51 2
import javax.servlet.*;
import javax.servlet.http.*;
d53 1
a53 1
import org.webmacro.util.*;
a54 3
import org.webmacro.engine.*;
import org.webmacro.broker.*;
import org.webmacro.resource.*;
d58 1
a58 1
import org.joist.session.*;
a60 2
import org.joist.security.RedirectException;
import org.joist.database.DataManager;
d62 10
d73 1
a73 4
public class PasswordEmailed extends org.tigris.helm.security.HelmServlet {
    public static final  String versionID = "$Id: PasswordEmailed.java,v 1.3 2000/11/06 06:15:30 edk Exp $";
    private static Log log = new Log("PasswordEmailed", "Tigris StartPage");
    private static boolean debug = true;
d76 2
a77 1
     *  Display and process the login screen.
d79 1
a79 2
    protected String
	processRequest (Connection connection, WebContext context)
d82 1
a82 6
	if (debug) log.debug("PasswordEmailed: started!");

	String templateName = super.processRequest(connection, context);
	

	if (debug) log.debug("PasswordEmailed: step 1");
d84 8
a91 18
	HttpServletRequest request = context.getRequest();
	HttpServletResponse response = context.getResponse();
	HttpSession session = context.getSession();
	SessionManager sMgr = getSessionManager(context);
	DataManager dMgr = sMgr.getDataManager();

	if (debug) log.debug("PasswordEmailed: step 2");

	String action = (String)context.get("action");

        if (debug) log.debug("PasswordEmailed: step 3");

	try {
	    String userID = sMgr.getUserID();
	    if (debug) log.debug("PasswordEmailed: userID=" + userID );
	    String loginID = sMgr.getLoginID();
	    context.put("loginID", loginID);
	    if (debug) log.debug("PasswordEmailed: loginID=" + loginID );
d93 2
a94 1
	catch (Exception e) {
d96 4
a99 3
	    String message = "PasswordEmailed: " + e.getMessage();
	    if (debug) log.debug(message);
	    context.put("message", message);
a100 5
	
	
	if (debug) log.debug("PasswordEmailed: action=" + action );

	if (debug) log.debug("PasswordEmailed:  done");
d104 1
a104 2
  
} /* end class PasswordEmailed */
@


1.1.1.1
log
@Merging newhelm tree into helm, as per IZ issue #557.  Previous major version of helm is tagged TIGRIS_NOV_11_2000.
@
text
@@
