| 1 | package Galileo::User; | ||||||||||||||||||||||||||||
| 2 | 3 | ▶ | use Mojo::Base 'Mojolicious::Controller'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||
| 4 | 5 | ▶ | sub login { | ||||||||||||||||||||||||||
|
Subroutine
login: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 5 | 5 | my $self = shift; | |||||||||||||||||||||||||||
| 6 | 5 | my $name = $self->param('username'); | |||||||||||||||||||||||||||
| 7 | 5 | my $pass = $self->param('password'); | |||||||||||||||||||||||||||
| 8 | 5 | my $from = $self->param('from'); | |||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 5 | my $schema = $self->schema; | |||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 5 | my $user = $schema->resultset('User')->single({name => $name}); | |||||||||||||||||||||||||||
| 13 | 5 | ▶ | if ($user and $user->check_password($pass)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$user and $user->check_password($pass)
MC/DC100%2/2
$user and $user->check_password($pass)
$user
$user->check_password($pass)
Truth table100%3/3
A and B
A= $userB= $user->check_password($pass)
| |||||||||||||||||||||||||||||
| 14 | 3 | $self->humane_flash( 'Welcome Back!' ); | |||||||||||||||||||||||||||
| 15 | 3 | $self->session->{id} = $user->user_id; | |||||||||||||||||||||||||||
| 16 | 3 | $self->session->{username} = $name; | |||||||||||||||||||||||||||
| 17 | } else { | ||||||||||||||||||||||||||||
| 18 | 2 | $self->humane_flash( 'Sorry try again' ); | |||||||||||||||||||||||||||
| 19 | } | ||||||||||||||||||||||||||||
| 20 | 5 | $self->redirect_to( $from ); | |||||||||||||||||||||||||||
| 21 | } | ||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 1 | ▶ | sub logout { | ||||||||||||||||||||||||||
|
Subroutine
logout: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 24 | 1 | my $self = shift; | |||||||||||||||||||||||||||
| 25 | 1 | $self->session( expires => 1 ); | |||||||||||||||||||||||||||
| 26 | 1 | $self->humane_flash( 'Goodbye' ); | |||||||||||||||||||||||||||
| 27 | 1 | $self->redirect_to( $self->home_page ); | |||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | 3 | 1; | |||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||