| 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
| |||||||||||||||||||||||||||||
| 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
Condition66%2/3
$pass_min_length and length $password < $pass_min_length
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
| |||||||||||||||||||||||||||||
| 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
Condition33%1/3
$pass_numerics and not $password =~ /[0-9]/
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]/
| |||||||||||||||||||||||||||||
| 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
Condition33%1/3
$pass_symbols and not $password =~ /\W/
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/
| |||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||