Login

You provide a method to test the username and password:

sub _login_authenticate {
    my $self = shift;
    my $user = $self->query->param('username');
    my $pass = $self->query->param('password');
    if ($user = find_user_in_my_db($username, $password)) {
        return (1, $user);
    }
    return (undef, undef);
}

If the user gets it right, they continue with the app.