Hi Martin, thanks for your answer. My question was related to an email with the subject: [2.0.1] login form w/registration of new users and logout (newbie)
The steps i followed are: > Thanks again, Andreas. > I chose to go with the standard Login.java and Logout.java for now and just > reference them in their respective xconf-files. > It works just as intended now. Beautiful! > ;-) > > After logging in via this method - a special user-page is also displayed. > > After logging out - the front-page is displayed. > Any other attempt at viewing pages requiring authorization will show the > normal Login.jx view as in the acusecases module. > This is probably how some others want their Lenya site to work as well. > > For completeness and perhaps as help for others - here is (verbosely for > other newbies) how I got this working: > (I am just changing the xconf files, really; and then referencing the normal > login/logout handler classes) > > As Andreas suggested, I want to have a separate module handle this - just > like the normal acusecases is a module > and handle the login/logout process. > > First I copied the > modules-core/acusecases > into > > *pubs/default/modules/acusecasesnoview* > > Then deleting *acusecasesnoview/usecases * (since the views > loing.jx/logout.jx) > will not be used) > and deleting *acusecasesnoview/java* (since I will be using the standard > > login/logout handling) > directories. I left the acusecasesnoview/resources and acusecasesnoview/test > intact, since I might want to use them later on. > > *For now a failed login results in a separate page with the message "Could > > not execute usecase: * Authentication failed".* This can probably be handled > different with some sitemap magic, or like Andreas suggested. > > Changing *acusecasesnoview/config/module.xml* into the following: > > <module xmlns="http://apache.org/lenya/module/1.0" > <http://apache.org/lenya/module/1.0%22>;> > <id>org.apache.lenya.modules.acusecasesnoview</id> > <!-- <export package="org.apache.lenya.cms.ac.usecasesnoview"/> > > <depends module="org.apache.lenya.cms.ac.usecases"/> --> > <package>org.apache.lenya.modules</package> > <version>0.1</version> > <name>Page- and view-less access control usecases</name> > > <lenya-version>@lenya.version@</lenya-version> > <description>Page- and view-less access control usecases</description> > </module> > > Note: trying to add/enable the <depends module ...> made the build fail. > > It's commented out above. > > Then having the actual views removed by changing the login xconf into > pubs/default/modules/acusecasesnoview/config/cocoon-xconf/usecases- > ac-noview-login.xconf: > <xconf xpath="/cocoon/usecases" > > unless="/cocoon/usecases/[EMAIL PROTECTED] = 'ac.noviewlogin']"> > <component-instance name="ac.noviewlogin" logger="lenya.ac" class=" > > org.apache.lenya.cms.ac.usecases.Login"> > </component-instance> > </xconf> > > While the one for logout into > pubs/default/modules/acusecasesnoview/config/cocoon-xconf/usecases- > ac-noview-login.xconf: > > <xconf xpath="/cocoon/usecases" > unless="/cocoon/usecases/[EMAIL PROTECTED] = 'ac.noviewlogin']"> > <component-instance name="ac.noviewlogin" logger="lenya.ac" class=" > > org.apache.lenya.cms.ac.usecases.Login"> > </component-instance> > </xconf> > > > The next thing to remember is the * > pubs/default/config/access-control/usecase-policies.xml* and add: > > <usecase id="ac.noviewlogout"> > <role id="visit" method="grant"/> > </usecase> > <usecase id="ac.noviewlogin"> > <role id="visit" method="grant"/> > > </usecase> > > Finally, the module needs to be included in the (default, in this case) > publication by adding to *pubs/default/config/publication.xml* with the > following: > <module name="acusecasesnoview"/> > > > Then the XSLT for including the immediate login/logout form into a page is > as follows: > <xsl:choose> > <xsl:when test="$userid"> > <div> > <span style="font-size: small; margin-right: 2em;">Logged in as > > </span><strong><xsl:value-of select="$username"/></strong> (<xsl:value-of > select="$userid"/>) > <a style="margin-left: 4em;" href="/default/live/index.html?lenya.usecase= > > ac.noviewlogout">Logout</a> > </div> > </xsl:when> > <xsl:otherwise> > <form name="login" id="login" method="get" > action="/default/live/user.html"> > > <div style="float: left; margin-right: 4em;"> > <label for="name">Username: </label> > <input class="lenya-form-element" name="username" type="text" > > value="" /> > <label for="password"> Password: </label> > <input class="lenya-form-element" name="password" > type="password" /> > > <input class="login" name="lenya.usecase" type="hidden" > value="ac.noviewlogin" /> > <input class="login" name="referrerQueryString" type="hidden" > > value="" /> > <input name="submit" type="submit" value="Login" /> > </div> > </form> > <a href="?lenya.usecase=admin.addUser&className= > > org.apache.lenya.ac.file.FileUser&userType=Local+User&input-add_user=Local+User">Register > new user</a> > <div style="clear: both;"></div> > </xsl:otherwise> > > </xsl:choose> > > > I have created a document with path "/index" which results in > "/default/live/index.html" and of doctype "homepage". I chose to have this > login-field above the tabs-section for now. I added the above XSLT to the > > file *pubs/default/xslt/page2xhtml-homepage.xsl* . > I also added two parameters to this file: > <xsl:param name="userid"/> > <xsl:param name="username"/> > > And these two get sent by the sitemap in *pubs/default/sitemap.xmap* at the > > matcher <map:match pattern="lenyabody-*/*/*/*/**"> by adding: > <map:parameter name="userid" value="{access-control:user-id}"/> > <map:parameter name="username" > > value="{access-control:user-name}"/> > > Just some notes on the XSLT and the forms - */default/live/user.html* is the > user homepage which is served after a successful login attempt. Setting > access-control for this URL subtree will always require login - and show the > > normal login screen if trying to access otherwise. > After logging out, I chose to send the user to > */default/live/index.html*which is the front-page of the site. > > There is still the XSLT of handling registration of new users, and > > displaying this nicely. Perhaps a similar technique to the login/logout is > possible - displaying a different view than the standard admin-adding-user > view by overriding with a custom module again. > > Ok, that was it for now. A slight thing still hanging with the handling of > > failed logins, which probably need to be overridden like Andreas mentioned > earlier. But at least this is getting on the right track. > > > Cheers, > Gringinho > > > > However, these steps only, don't seem to be solve my problem, which is, to create a login form in the live section. Thank you Cláudio On Sat, Feb 5, 2011 at 10:45 AM, Martin Dominguez < [email protected]> wrote: > > Hola Cláudio, > > I don't undesrtand very well your question... > > You have installled Lenya 2.0.3, and you can't login in? > You have a new publication ando you can't login in? > You can login using default user (lenya or alice) but when you register a > new user, he can't login in Lenya? > > My first suggestion is try lenya user with levi as password. > > Salu2! > > > Cláudio Sá wrote: > > > > Hi, > > i followed every step and I am always being redirected to login page > > after > > clicking in the login button. > > > > I use version 2.0.3. Any suggestion? > > > > > > -- > View this message in context: > http://old.nabble.com/Re%3A--2.0.1--login-form-w-registration-of-new-users-and-logout-%28newbie%29-tp30846951p30850996.html > Sent from the Lenya - Users mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >
