<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#ffffff" text="#000000">
    Thanks, Will.&nbsp; That I figured that would work, but I thought that
    the flash was the right way to do it -- especially with the
    automatic cleanup, so I was holding off on trying that.<br>
    <br>
    Why doesn't flash work across these multiple requests?&nbsp; I thought
    that was the whole idea of flash vs. stash.<br>
    <br>
    Eric<br>
    <br>
    On 1/23/11 11:52 PM, will trillich wrote:
    <blockquote
      cite="mid:AANLkTikhZkaKS2bXKO6HGjuw1Yq1i59ug00EMYSqonx=@mail.gmail.com"
      type="cite">
      <div>The flash is moved to the stash after the redirect, and then
        it's gone after that, right?</div>
      <div><br>
      </div>
      What we do is stuff the intended destination into the session and
      then pull it from there:
      <div><br>
      </div>
      <div>
        <div>sub login : Chained('/') PathPart('login') Args(0) {</div>
        <div>&nbsp;&nbsp; &nbsp;my ( $self, $c ) = @_;</div>
        <div><br>
        </div>
        <div>&nbsp;&nbsp; &nbsp;my $form = Spill::Form::Login-&gt;new( action =&gt;
          $c-&gt;uri_for('/login') );</div>
        <div><br>
        </div>
        <div>&nbsp;&nbsp; &nbsp;$c-&gt;stash(</div>
        <div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;template =&gt; 'login.tt2',</div>
        <div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;form &nbsp; &nbsp; =&gt; $form,</div>
        <div>&nbsp;&nbsp; &nbsp;);</div>
        <div><br>
        </div>
        <div>&nbsp;&nbsp; &nbsp;if ( $c-&gt;action ne 'login' ) {</div>
        <div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;# Stuff destination into session for later redirect
          if user authenticates</div>
        <div><b>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;$c-&gt;session-&gt;{redirect} =
            $c-&gt;req-&gt;uri-&gt;as_string;</b></div>
        <div>&nbsp;&nbsp; &nbsp;}</div>
        <div><br>
        </div>
        <div>...then, later, after authenticating...</div>
        <div><br>
        </div>
        <div>
          <div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;my $go = <b>delete(
              $c-&gt;session-&gt;{redirect} )</b> ||
            $c-&gt;req-&gt;headers-&gt;referer;</div>
          <div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$go = '/' if $go =~ /\blog(in|out)\b/;</div>
          <div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$c-&gt;res-&gt;redirect( $go );</div>
          <div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$c-&gt;detach;</div>
        </div>
        <div><br>
        </div>
        <br>
        <div class="gmail_quote">On Sun, Jan 23, 2011 at 8:27 PM, Eric
          Berg <span dir="ltr">&lt;<a moz-do-not-send="true"
              href="mailto:eberg@bergbrains.com">eberg@bergbrains.com</a>&gt;</span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
            0.8ex; border-left: 1px solid rgb(204, 204, 204);
            padding-left: 1ex;">If a user submits a certain form without
            being logged in, I flash the current URL, save the params in
            the session, and redirect them to the login.<br>
            <br>
            In my Login controller, I look for
            $c-&gt;flash-&gt;{redirect_url} and redirect them back to
            that URL.<br>
            <br>
            The problem is that that flash entry is gone after the user
            submits the login form. &nbsp;I logged out the redirect URL at
            the beginning of my login routine and it comes through the
            first time, but even if I don't access it via the log
            statement, that redirect_url key is not there in the flash
            when the user submits the login form with their credentials.<br>
            <br>
            I've tried resetting $c-&gt;flash-&gt;{redirect_url} in the
            login routine and also tried $c-&gt;keep_flash( qw(
            redirect_url )) in the login routine, but no go.<br>
            <br>
            Any thoughts on what I might be doing wrong?<br>
            <br>
            Eric<br>
            <br>
            _______________________________________________<br>
            List: <a moz-do-not-send="true"
              href="mailto:Catalyst@lists.scsys.co.uk" target="_blank">Catalyst@lists.scsys.co.uk</a><br>
            Listinfo: <a moz-do-not-send="true"
              href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst"
              target="_blank">http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst</a><br>
            Searchable archive: <a moz-do-not-send="true"
              href="http://www.mail-archive.com/catalyst@lists.scsys.co.uk/"
              target="_blank">http://www.mail-archive.com/catalyst@lists.scsys.co.uk/</a><br>
            Dev site: <a moz-do-not-send="true"
              href="http://dev.catalyst.perl.org/" target="_blank">http://dev.catalyst.perl.org/</a><br>
          </blockquote>
        </div>
        <br>
        <br clear="all">
        <br>
        -- <br>
        The first step towards getting somewhere is to decide that you
        are not going to stay where you are. &nbsp;-- J.P.Morgan<br>
      </div>
      <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
List: <a class="moz-txt-link-abbreviated" href="mailto:Catalyst@lists.scsys.co.uk">Catalyst@lists.scsys.co.uk</a>
Listinfo: <a class="moz-txt-link-freetext" href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst">http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst</a>
Searchable archive: <a class="moz-txt-link-freetext" href="http://www.mail-archive.com/catalyst@lists.scsys.co.uk/">http://www.mail-archive.com/catalyst@lists.scsys.co.uk/</a>
Dev site: <a class="moz-txt-link-freetext" href="http://dev.catalyst.perl.org/">http://dev.catalyst.perl.org/</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>