R: [opencms-dev] Multi Site Login problem

Mario D'Angelo mario.dangelo at e-dea.it
Mon Sep 11 13:04:32 CEST 2006


That was just one of the tries, the original login_elemnt code is this one:

 

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

<%

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

CmsSetupBean cmsSetup = new CmsSetupBean();

 

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=" +
curFolder + "index.html"; //DO NOT DELETE

          

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

                        {

                        response.sendRedirect(url);

                        }

                        else

                        {

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

                        }

          }

 

     

%>

 

  _____  

Da: opencms-dev-bounces at opencms.org [mailto:opencms-dev-bounces at opencms.org]
Per conto di Christian Steinert
Inviato: lunedì 11 settembre 2006 12.29
A: The OpenCms mailing list
Oggetto: Re: [opencms-dev] Multi Site Login problem

 

Mario D'Angelo schrieb: 


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.: 


I am surprised about this:



  

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

and this:



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


It seems as if the code is written for only one of your sites. 
I think especially your call of setSiteRoot should be dependent on the URL
for which the login was requested.

christian

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


More information about the opencms-dev mailing list