[opencms-dev] Multi Site Login problem

Mario D'Angelo mario.dangelo at e-dea.it
Mon Sep 11 12:18:41 CEST 2006


I have two Sites set: "/sites/Provincia_di_Napoli/" and "/sites/InfoNet/",
everything works great, but when I tried to perform a login from the online
site for editing content it works only if the login is performed from the
site set as default in the "opencms-workplace.xml" conf file es.:

 

<workplace-startupsettings>

<locale>en</locale>

            <project>Offline</project>

 
<workplaceview>/system/workplace/views/explorer/explorer_fs.jsp</workplacevi
ew>

            <folder>/</folder>

            <site>/sites/Provincia_di_Napoli/</site>

            <restrictexplorerview>false</restrictexplorerview>

</workplace-startupsettings> 

 

In this case the login works if I access from the site
http://demo.xdea.it:8082/ but doen't if I try to login form
http://192.168.1.160:8084/. I could fix the proble if only there was a way
to set the CURRENT SITE on the fly, but I couldn't find it. Can somebody
help me, please.

 

Here is the simple code for performing login operation:

 

<%@ page session="true" import="org.opencms.main.*, org.opencms.workplace.*,
org.opencms.jsp.*, org.opencms.file.*, java.lang.String" %>

<%

CmsJspActionElement cms = new
CmsJspActionElement(pageContext,request,response);

 

String user = request.getParameter("user");

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

 

String url = request.getParameter("url");

 

//form not submitted? => show login form.

 

     if((user==null)||(user.length()==0))

     {

%>

<form method="post">

<p>username: <input name="user" /></p>

<p>password: <input name="password" type="password" /></p>

<p><input type="submit"/></p>

</form>

<%

     }

          else

          {

          CmsObject cmsObject = cms.getCmsObject();

          cmsObject.loginUser(user, password);

          CmsProject cmsproject = cmsObject.readProject("Offline");

          cmsObject.getRequestContext().setCurrentProject(cmsproject);

          cmsObject.getRequestContext().setSiteRoot("/sites/InfoNet");

          

          String curFolder = cms.info("opencms.request.folder");

          out.print("<br>Cur Folder: " + curFolder + "<br>");

          

          //curFolder = "Micro_Siti/XDEA_ADMIN/";

 

                          String login_redirect =
"/opencms/opencms/system/workplace/commons/displayresource.jsp?resource=/ope
ncms/opencms/sites/InfoNet" + curFolder + "index.html"; //DO NOT DELETE

          

            if( url!=null && url.length()>0 )

                        {

                        response.sendRedirect(url);

                        }

                        else

                        {

                        response.sendRedirect(cms.link(login_redirect));

                        }

          }

 

     

%>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20060911/97f26387/attachment.htm>


More information about the opencms-dev mailing list