Ado

 view release on metacpan or  search on metacpan

etc/plugins/auth.conf  view on Meta::CPAN

    #must exactly match keys in the providers hash reference below.
    # Add OAuth2 providers to ado.development.conf.
    auth_methods => ['ado'],

    #Configurations for methods not provided by Mojolicious::Plugin::OAuth2
    providers => {

        #Add the rest of the needed configuration options
        # to auth.development.conf or auth.production.conf only
        # because this is highly sensitive and application specific information.
        # Get the credentials from
        # https://console.developers.google.com/project/yourproject/apiui/credential
        # See https://developers.google.com/accounts/docs/OAuth2UserAgent
        # https://developers.google.com/oauthplayground/
        #Example for google:
        # google =>{
        #     #client_id
        #     key =>'123456654321abcd.apps.googleusercontent.com',
        #     secret =>'Y0uRS3cretHEre',
        #     scope=>'profile email',
        #     info_url => 'https://www.googleapis.com/userinfo/v2/me',

lib/Ado/Plugin/Auth.pm  view on Meta::CPAN

            $c->app->plugins->emit_hook(after_login => $c);

            # Redirect to referrer page with a 302 response
            $c->debug('redirecting to ' . $c->session('over_route'))
              if $Ado::Control::DEV_MODE;
            $c->redirect_to($c->session('over_route'));
            return;
        }
        else {
            unless ($c->res->code // '' eq '403') {
                $c->stash(error_login => 'Wrong credentials! Please try again!');
                $c->render(status => 401, template => 'login');
                return;
            }
        }
    }
    else {
        $c->app->log->error("Error calling \$login_helper:[$login_helper][$@]");
        $c->stash(error_login => 'Please choose one of the supported login methods.');
        $c->render(status => 401, template => 'login');
        return;

t/plugin/auth-01.t  view on Meta::CPAN

#try with no data
$t->post_ok($login_url)->status_is(401, 'No $val->has_data');

#try with unexisting user
$t->get_ok($login_url);
$form_hash->{login_name} = 'alabala';
$form_hash->{csrf_token} = $t->tx->res->dom->at('#login_form [name="csrf_token"]')->{value};
$form_hash->{digest} =
  Mojo::Util::sha1_hex($form_hash->{csrf_token} . Mojo::Util::sha1_hex('' . 'wrong_pass'));
$t->post_ok($login_url => {} => form => $form_hash)->status_is(401, 'No such user $login_name')
  ->text_like('#error_login',      qr'Wrong credentials! Please try again!')
  ->text_like('#error_login_name', qr"No such user '$form_hash->{login_name}'!");

done_testing;

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 1.968 second using v1.00-cache-2.02-grep-82fe00e-cpan-72ae3ad1e6da )