"flash" puts the data into the session, not the parameters. If it's in the
same request just use the stash to pass the data, if it's in a different
request then you need to retrieve it from the session -
https://metacpan.org/pod/Mojolicious::Controller#session . Be careful using
flash since it is by nature transient, and can act strangely if the user
has multiple instances of the site open, for instance.

-Dan

On Wed, Nov 22, 2017 at 12:18 PM, <[email protected]> wrote:

> Hi there,
>
> There's something that I don't understand about the rendering process.
> I've got a method in the Controller that checks credentials from a login
> form, with this fragment at the end of a successful authentication
>
>     $self->stash(user => $username);
>     $self->render(template => 'tutorial/welcome', format => 'html');
>
> when I want to redirect back to the page originally requested that
> required a login, I store the url in the flash with
>    $self->flash(calling_page => $self->req->url);
> in the method that checks if the user has logged in and then squeezed in a
> redirect_to call before the render
>
>     $self->stash(user => $username);
>     $self->redirect_to($self->param('calling_page')) if
> $self->param('calling_page');
>     $self->render(template => 'tutorial/welcome', format => 'html');
>
> Control seems to still fall through to the 'tutorial/welcome' template.
> Why?  Is there an obvious reason why this doesn't work?  Or is it
> programmer error in how I'm saving the calling page (is putting it in a
> cookie better)?
>
> many thanks,
> Boyd
>
> --
> You received this message because you are subscribed to the Google Groups
> "Mojolicious" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/mojolicious.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

Reply via email to