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