duffee / Mojolicious_session_example

A simple Mojolicious application example for authenticating a user and maintaining a session
Artistic License 2.0
9 stars 5 forks source link

Restricting connections in Controller #14

Open duffee opened 8 years ago

duffee commented 8 years ago

Improve the authentication tutorial. Mention that the is_logged_in() method needs to return a true or false value to affect the under clause.

if ($self->tx->remote_address eq '128.168.0.3') {
    $self->render( inline => '<h2>Restricted Access</h2>', status => 403 );
}

just falls through to the following return 1 if $self->session('logged_in') and renders the page to the undesirable ip address.