Catalyst::ActionRole::NeedsLogin - checks if a user is logged in and if not redirects him to login page


CatalystX-SimpleLogin documentation  | view source Contained in the CatalystX-SimpleLogin distribution.

Index


NAME

Top

Catalyst::ActionRole::NeedsLogin - checks if a user is logged in and if not redirects him to login page

SYNOPSIS

Top

    package MyApp::Controller::NeedsAuth;

    sub inbox : Path Does('NeedsLogin') {
        # Redirects to /login if not logged in
        my ($self, $c) = @_;

        $c->stash->{template} = "inbox.tt2";

        return;
    }

    sub inbox : Path Does('NeedsLogin') :LoginRedirectMessage('Your custom Message') {
        # Redirects to /login if not logged in-
    }

    # Turn on in config
    MyApp->config('Contoller::Login' => { traits => ['WithRedirect'] });

DESCRIPTION

Top

Provides a ActionRole for forcing the user to login.

WRAPPED METHODS

Top

execute

If there is no logged-in user, call the login_redirect() method in the 'Login' controller with the Catalyst context object, $c, and the message specified by the :LoginRedirectMessage('Message here') method attribute (see the synopsis).

If there is a user logged-in (i.e: $c->user is true), execute the body of the action as it is.

SEE ALSO

Top

CatalystX::SimpleLogin::ControllerRole::Login::WithRedirect
CatalystX::SimpleLogin::ControllerRole::Login
CatalystX::SimpleLogin::Form::Login

AUTHORS

Top

See CatalystX::SimpleLogin for authors.

LICENSE

Top

See CatalystX::SimpleLogin for license.


CatalystX-SimpleLogin documentation  | view source Contained in the CatalystX-SimpleLogin distribution.