CatalystX::SimpleLogin::TraitFor::Controller::Login::WithRedirect3pm
Redirect users who login back to the page they originally requested.
Usage
package MyApp::Controller::NeedsAuth;use Moose;use namespace::autoclean;# One needs to inherit from Catalyst::Controller in order# to get the Does('NeedsLogin') functionality.BEGIN { extends 'Catalyst::Controller'; }sub inbox : Path Does('NeedsLogin') {# Redirects to /login if not logged inmy ($self, $c) = @_;$c->stash->{template} = "inbox.tt2";return;}# Turn on in configMyApp->config('Contoller::Login' => { traits => 'WithRedirect' });
Overview
Provides the "login" action with a wrapper to redirect to a page which needs authentication, from which the user was previously redirected. Goes hand in hand with Catalyst::ActionRole::NeedsLogin
Wrapped methods
redirect_after_login_uri
Make it use and extract "$c->session->{redirect_to_after_login}" if it exists.
Methods
$controller->login_redirect($c, $message)
This sets the error message to $message and sets "$c->session->{redirect_to_after_login}" to the current URL.
Releases
7 releases since Debian 7 (Wheezy); the text changed 5 times.