blib/lib/OpusVL/AppKit/FormFu/Constraint/AppKitPassword.pm

filter: Statementstmt 82.6% 19 / 23 Branchbran 75.0% 6 / 8 Conditioncond 44.4% 4 / 9 MC/DCmcdc 16.6% 1 / 6 Subroutinesub 100% 3 / 3 Podpod 100% 1 / 1 totaltotal 68.0% 34 / 50 CC 8 SCAR 21.4
CC
8
Cov
72%
constrain_value
10.4
BEGIN
1.0
BEGIN
1.0
CRAP 8.5
« lib/OpusVL/AppKit/RolesFor/Controller/GUI.pm ↑ Summary lib/OpusVL/AppKit/Action/AppKitForm.pm »
1 package OpusVL::AppKit::FormFu::Constraint::AppKitPassword;
2  
3  
4 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use base 'HTML::FormFu::Constraint';
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7  
8  
9 sub constrain_value
10 12 ▶{
Subroutine constrain_value: called CC=8 SCAR=23.4
Pod documented
11 12 my $self = shift;
12 12 my ($value, $params) = @_;
13 12 my $c = $self->form->stash->{context};
14 12 ▶ return 1 unless $value;
Branch: 1 branch
BranchTrueFalseTotal
unless $value 1 11 12
15 11 my $password = $value;
16  
17 my ($pass_min_length, $pass_numerics, $pass_symbols) = (
18 $c->config->{AppKit}->{password_min_characters},
19 $c->config->{AppKit}->{password_force_numerics},
20 $c->config->{AppKit}->{password_force_symbols},
21 11 );
22  
23 11 ▶ if ($pass_min_length && length($password) < $pass_min_length) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pass_min_length and length $password < $pass_min_length) 1 10 11
Condition66%2/3
$pass_min_length and length $password < $pass_min_length
!ll&&!rl&&r
0101
MC/DC50%1/2
$pass_min_length and length $password < $pass_min_length
$pass_min_length length $password < $pass_min_length
Truth table66%2/3
A and B
A= $pass_min_lengthB= length $password < $pass_min_length
ABresult
0X0
100
111
24 1 $self->{message} = "Minimum length for password is ${pass_min_length} characters";
25 1 return 0;
26 }
27  
28 10 ▶ if ($pass_numerics && $password !~ /[0-9]/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pass_numerics and not $password =~ /[0-9]/) 0 10 10
Condition33%1/3
$pass_numerics and not $password =~ /[0-9]/
!ll&&!rl&&r
1000
MC/DC0%0/2
$pass_numerics and not $password =~ /[0-9]/
$pass_numerics not $password =~ /[0-9]/
Truth table33%1/3
A and not(B)
A= $pass_numericsB= not $password =~ /[0-9]/
ABresult
0X0
100
111
29 0 $self->{message} = "Expecting a numeric character in password. None found";
30 0 return 0;
31 }
32  
33 10 ▶ if ($pass_symbols && $password !~ /\W/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pass_symbols and not $password =~ /\W/) 0 10 10
Condition33%1/3
$pass_symbols and not $password =~ /\W/
!ll&&!rl&&r
1000
MC/DC0%0/2
$pass_symbols and not $password =~ /\W/
$pass_symbols not $password =~ /\W/
Truth table33%1/3
A and not(B)
A= $pass_symbolsB= not $password =~ /\W/
ABresult
0X0
100
111
34 0 $self->{message} = "Expecting a symbol character in password. None found";
35 0 return 0;
36 }
37  
38 10 return 1;
39 }
40  
41 ##
42 2 1;
43  
44 __END__
« lib/OpusVL/AppKit/RolesFor/Controller/GUI.pm ↑ Summary lib/OpusVL/AppKit/Action/AppKitForm.pm »