Branch Coverage

blib/lib/Dancer2/Plugin/Auth/Extensible.pm
Criterion Covered Total %
branch 190 228 84.2


line true false branch
160 4 36 unless $name
245 1 14 unless $plugin->realm_count
255 13 1 unless ($plugin->no_default_pages)
267 4 16 if ($weak_plugin->logged_in_user)
277 1 2 if ($code and $weak_plugin->reset_password_handler and $weak_plugin->user_password('code', $code))
301 13 1 unless ($plugin->no_login_handler)
322 1 13 if ($plugin->login_without_redirect)
344 6 3 if (defined $username and defined $password)
373 3 3 if ($success) { }
379 3 0 if $app->can('change_session_id')
412 33 417 unless (defined $realm)
413 31 2 if ($plugin->app->session->read('logged_in_user')) { }
423 412 36 if exists $plugin->realm_providers->{$realm}
427 2 34 unless my $realm_settings = $plugin->realm($realm)
431 1 33 unless my $provider_class = $realm_settings->{'provider'}
434 24 9 unless ($provider_class =~ /::/)
453 67 12 if (defined $username and ref $username eq '' and $username ne '' and defined $password and ref $password eq '' and $password ne '')
460 14 53 $realm ? :
467 108 53 $plugin->record_lastlogin ? :
477 1 160 unless (eval { do { $success = $provider->authenticate_user($username, $password, %lastlogin); 1 } })
484 42 119 if ($success)
506 97 33 wantarray ? :
515 1 11 if not $options{'realm'} and $plugin->realm_count > 1
525 2 9 unless (eval { do { $user = $provider->create_user(%options); 1 } })
532 9 2 if ($user)
534 1 8 if ($email_welcome) { }
6 2 elsif ($password) { }
553 1 5 unless (eval { do { $provider->set_user_password($options{'username'}, $password); 1 } })
572 2 83 unless defined $username
574 78 5 $realm ? :
580 1 90 unless (eval { do { $user = $provider->get_user_details($username); 1 } })
585 78 13 if $user
596 71 91 if (my $username = $session->read('logged_in_user')) { }
598 4 67 if $existing
601 66 1 $provider->can('get_user_details') ? :
619 1 0 if (defined $lastlogin and ref $lastlogin eq '' and $lastlogin =~ /^\d+$/)
632 1 2 unless $plugin->logged_in_user
645 0 2 $options{'realm'} ? :
648 0 2 unless my $username = $options{'username'}
666 1 5 if ($user)
675 0 1 &blessed($user) ? :
680 1 0 if &{$plugin->password_reset_send_email;}($plugin, %options)
683 1 1 $result ? :
688 1 4 if $plugin->disable_roles
695 1 2 if $plugin->disable_roles
706 4 59 if (not $coderef or ref $coderef ne 'CODE')
712 36 27 if $plugin->logged_in_user
721 1 8 if $plugin->disable_roles
730 2 1 if (my $username = $session->read('logged_in_user')) { }
744 1 8 if not $update{'realm'} and $plugin->realm_count > 1
751 2 6 if $cur_user and $cur_user eq $username
758 1 14 if $plugin->disable_roles
762 6 8 if (@_ == 2) { }
770 2 12 unless defined $username
775 8 10 if $has_role eq $want_role
789 2 14 $params{'realm'} ? :
792 6 10 if (exists $params{'code'}) { }
793 0 6 unless my $code = $params{'code'}
805 3 15 if ($username) { }
816 3 3 unless $username
819 2 8 if (not $params{'username'}) { }
820 0 2 unless $username = $plugin->app->session->read('logged_in_user')
828 8 2 if (exists $params{'password'})
835 4 4 unless $success
840 4 5 if (my $new_password = $params{'new_password'})
841 2 2 unless ($realm)
846 2 4 if $provider->get_user_details($username)
848 0 2 unless $realm
852 1 3 if ($params{'code'})
868 1 31 if $plugin->disable_roles
872 15 16 unless (defined $username)
876 2 13 unless $username
881 0 29 unless defined $roles
882 11 18 wantarray ? :
895 6 8 ref $require_role eq 'ARRAY' ? :
901 6 15 unless $plugin->logged_in_user
908 9 6 if ($mode eq 'single') { }
2 4 elsif ($mode eq 'any') { }
4 0 elsif ($mode eq 'all') { }
910 6 12 if _smart_match($_, $require_role)
916 2 2 if $role_ok{$_}
922 2 6 unless ($plugin->user_has_role($role))
929 10 5 if ($role_match)
945 5 0 unless ($template_engine->pathname_exists($path))
963 8 25 if ($plugin->login_without_redirect)
975 7 1 if (not $ua->browser_string or $ua->robot) { }
989 5 3 unless ($request->var('login_failed'))
1001 0 25 if $request->query_string
1022 23 1 unless ($template_engine->pathname_exists($path))
1035 0 0 if (my $password_reset_text = $plugin->password_reset_text) { }
1074 1 15 if (defined $new_password)
1101 0 0 if (my $welcome_text = $plugin->welcome_text) { }
1135 0 0 if $params{'plain'}
1142 0 0 if $params{'html'}
1144 0 0 unless @parts
1146 0 0 @parts > 1 ? :
1160 0 0 unless my $mailer = $plugin->mailer
1163 0 0 unless my $module = $mailer->{'module'}
1165 0 0 if ($module eq 'Mail::Message') { }
1178 55 6 unless my $return_url = $app->request->query_parameters->get('return_url') || $app->request->body_parameters->get('return_url')
1203 2 26 if (my $url = _return_url($app)) { }
26 0 elsif ($plugin->exit_page) { }
1223 2 26 if ($plugin->reset_password_handler and $params->{'submit_reset'})
1225 0 2 if ref $username
1240 2 35 if ($code)
1243 1 1 if (my $username = $plugin->user_password('code', $code, 'new_password', $randompw))
1248 1 2 if $provider->get_user_details($username)
1276 0 72 if (ref $_)
1283 1 35 if ($plugin->logged_in_user)
1292 28 7 if ($success) { }
1295 28 0 if $plugin->app->can('change_session_id')
1330 14 4 if (not ref $want) { }
4 0 elsif (ref $want eq 'Regexp') { }
0 0 elsif (ref $want eq 'ARRAY') { }