[opencms] Re: [opencms-dev] (6) (OT) Getting CmsJspActionElement from strutsaction

Jorge González informatico at hotelparadisepark.com
Tue Jul 5 16:40:18 CEST 2005


Dear Achim,

Im trying to do this:


1. User access index.jsp
2. User fill username/password and submit the form
3. Action loginAction.do is called
4. Here is the loginAction.do code

----
	public class LoginCmsAction extends AbstractAction {

	// --------------------------------------------------------- Methods

	public ActionForward executeAction(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {

		DynaValidatorForm loginForm = (DynaValidatorForm) form;
		String userName = null;
		String password = null;

		userName = (String) loginForm.get("userName");
		password = (String) loginForm.get("password");

	    log.debug(request.getSession().getAttributeNames());

		log.debug("User " + userName + " is logging in...");

		CmsObject cmso =
(CmsObject)request.getSession().getAttribute("OPT_CMSOBJECT");

		try {
			cmso.loginUser(userName, password);
		}catch (Exception e) {
			ActionError ae = new ActionError("login failed");
			ActionErrors aes = new ActionErrors();
			aes.add(ActionErrors.GLOBAL_ERROR, ae);
			log.debug("login failed user "+userName);
			this.saveErrors(request, aes);
			return mapping.findForward("fail");
		}

		log.debug("login in user OK...");
		return mapping.findForward("successAffiliate");
	}

}
----

5. After succes on loginUser, the control forwards to a protected page

Here is the problem, the system asks for a new password to show the
protected zone, the loginUser methor does not store the login info into the
session, so the rest of the opencms system can?t use this login info.

This is what i want to do :)


Thank you, Achim.




More information about the opencms-dev mailing list