On Mon, May 4, 2015 at 6:37 AM, mjb152 <[email protected]> wrote:
> I'm using the authentication plugin, and I'm wondering what's the best
> method to remember the route I came from if I have to go to a login screen
> first. E.g if I'm not authenticated and come from either /route1 or /route2
> , once I have entered my login details how can I get back to the correct
> place ?
I would store it in a client-side session:
get '/authentication_required' => sub ($c) {
$c->session(page => $c->current_route);
$c->redirect_to('login') unless $c->auth;
$c->render(text => 'Success!');
};
get '/login' => sub ($c) {
$c->redirect_to($c->session('page')) if $c->auth;
}
I significantly abstracted away the authentication details.
--
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 http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.