R: R: [opencms-dev] Multi Site Login problem

Claus Priisholm cpr at codedroids.com
Fri Sep 15 18:37:54 CEST 2006


Nope can't help with that - the sites in question ended up having only a 
couple of users in common so running two separate instances turned out 
to be the better solution anyway.

Mario D'Angelo wrote:
> Thank you, but I already assumed that, could you find the solution ?
> 
> -----Messaggio originale-----
> Da: opencms-dev-bounces at opencms.org [mailto:opencms-dev-bounces at opencms.org]
> Per conto di Claus Priisholm
> Inviato: martedì 12 settembre 2006 9.48
> A: The OpenCms mailing list
> Oggetto: Re: R: [opencms-dev] Multi Site Login problem
> 
> At least in 6.0.4 login to a offline type of project from the "frontend" 
> failed to work properly in a multisite setup, as soon as trying to log 
> in via the non-default site. It would work when doing it via the default 
> site.
> 
> Somewhere the non-default site would start assuming it was the 
> default-site causing files not to be found the like. Ended up making two 
> instances instead of using the multisite setup - have not testet it in 
> later versions.
> 
> Mario D'Angelo wrote:
>> 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
>>
>>
>> ------------------------------------------------------------------------
>>
>>
>> _______________________________________________
>> This mail is sent to you from the opencms-dev mailing list
>> To change your list options, or to unsubscribe from the list, please visit
>> http://lists.opencms.org/mailman/listinfo/opencms-dev
> 

-- 
Claus Priisholm, CodeDroids ApS
Phone: +45 48 22 46 46
cpr (you know what) codedroids.com - http://www.codedroids.com
cpr (you know what) interlet.dk - http://www.interlet.dk
--
Javadocs and other OpenCms stuff: 
http://www.codedroids.com/community/opencms




More information about the opencms-dev mailing list