[opencms-dev] Login user from a jsp

Trevor Lee Trevor.Lee at 4Loop.com.au
Mon Nov 17 06:47:01 CET 2003


Hi,

I am using opencms5. I have a user called "user1". When i login to opencms
using the standard opencms login page as user1, this user can view and edit
jsp pages.

However when i use the code below to bypass the standard opencms page, i am
able to log in as "user1". However, i am unable to edit and view jsp pages
when i log in using this approach.

What should i do? Have i missed something?

Code in user_login.jsp:
	<%
		CmsJspActionElement cms = new CmsJspActionElement(pageContext, request,
response);
		CmsObject cmso = cms.getCmsObject();

		String username = request.getParameter("username");
		String password = request.getParameter("password");

		String forward = "/opencms/opencms/system/workplace/action/index.html";

		username = "user1";
		password = "user1";

		try
		{
			cmso.loginUser(username, password);

			if (forward != null && !"".equals(forward))
				response.sendRedirect(forward);
			else
				out.println("You are now logged in as " + username);

		}
		catch (CmsException cmse)
		{
			out.println("<span class=\"errtext\">Invalid Username/Password</span>");
		}
	%>

Thanks in advance for your help

Cheers
Trevor




More information about the opencms-dev mailing list