line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::Validation::Constraints::Password; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
526
|
use namespace::autoclean; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
67
|
use Data::Validation::Constants qw( EXCEPTION_CLASS FALSE TRUE ); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
8
|
|
6
|
1
|
|
|
1
|
|
267
|
use Moo; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
7
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
extends q(Data::Validation::Constraints); |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
EXCEPTION_CLASS->add_exception( 'ValidPassword', { |
11
|
|
|
|
|
|
|
parents => [ 'InvalidParameter' ], |
12
|
|
|
|
|
|
|
error => 'Parameter [_1] is not a valid password' } ); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub validate { |
15
|
9
|
|
100
|
9
|
1
|
13
|
my ($self, $val) = @_; my $min_length = $self->min_length || 6; |
|
9
|
|
|
|
|
38
|
|
16
|
|
|
|
|
|
|
|
17
|
9
|
100
|
|
|
|
24
|
length $val < $min_length and return FALSE; |
18
|
7
|
|
|
|
|
11
|
$val =~ tr{A-Z}{a-z}; $val =~ tr{a-z}{}d; |
|
7
|
|
|
|
|
8
|
|
19
|
7
|
100
|
|
|
|
25
|
return length $val > 0 ? TRUE : FALSE; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
1; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# Local Variables: |
25
|
|
|
|
|
|
|
# mode: perl |
26
|
|
|
|
|
|
|
# tab-width: 3 |
27
|
|
|
|
|
|
|
# End: |