cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oscar Picasso <>
Subject Authentication "lost" in flowscript
Date Wed, 13 Oct 2004 16:01:51 GMT
I have a problem when combining the authentication framework with flowscript.
Here is the relevant code.

<map:match pattern="">
  <map:act type="auth-loggedIn"> 
    <map:parameter name="handler" value="managehandler"/>
    <map:act type="auth-protect">
      <map:parameter name="handler" value="managehandler"/>
      <map:serialize type="xhtml"/>
  <map:redirect-to uri="login"/>

function login(form) {

  var model = form.getModel();
  var email = cocoon.parameters["email"];
  var handler = cocoon.parameters["handler"];
  print("email: " + email);
  print("handler: " + handler);

  if(email != null && email != "")
  { = email;


  cocoon.request.setAttribute("password", model.password);

  var authenticated = auth_login(handler, null, {})

    cocoon.sendPage("/"); [1]
    print("not authenticated");

[1] Actually send the page relevant to the actual authenticated user (when the
user is authenticated the pipeline actually generate
This part works great.

Now, from inside the "user page", I have a link that points to the "password"

<map:match pattern="password">
    <map:act type="auth-protect">  <!-- give access to the context -->
      <map:parameter name="handler" value="managehandler"/>
      <map:call function="handleForm">
        <map:parameter name="function" value="password"/>
        <map:parameter name="form-definition" value="cocoon:/password-form"/>

function password(form) {
  cocoon.sendPage("/"); [2]

The form is properly displayed when the user is authenticated.

I have also printed the context info from inside the password function and it
properly prints all the authentication user info. However on submitting the
password form, the cocoon.sendPage("/") [2] sends an empty page to the browser.

I have also tried to send others protected pages from the password function and
it redisplays the initial login just like if the user authentication were lost.

Any idea?

NOTE: the password pipeline is actually supposed to do something more useful. I
made it simpler just to try to understand what's going on.

Do you Yahoo!?
Declare Yourself - Register online to vote today!

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message