File Coverage

blib/lib/Dancer2/Plugin/FormValidator/Extension/Password/Robust.pm
Criterion Covered Total %
statement 13 14 92.8
branch 1 2 50.0
condition n/a
subroutine 5 5 100.0
pod 0 2 0.0
total 19 23 82.6


line stmt bran cond sub pod time code
1              
2             use Moo;
3 3     3   11822 use utf8;
  3         10  
  3         20  
4 3     3   1061 use namespace::clean;
  3         7  
  3         22  
5 3     3   95  
  3         15  
  3         28  
6             with 'Dancer2::Plugin::FormValidator::Role::Validator';
7              
8             return {
9             en => '%s must be minimum 8 characters long and contain at least one letter, a number, and a special character',
10             ru => '%s должен иметь длину не менее 8 символов и состоять хотя бы из одной буквы, числа и специального символа',
11 2     2 0 92116 de => '%s muss mindestens 8 Zeichen lang sein und mindestens einen Buchstaben, eine Zahl und ein Sonderzeichen enthalten',
12             };
13             }
14              
15             my ($self, $field, $input) = @_;
16              
17             if ($self->_field_defined_and_non_empty($field, $input)) {
18 4     4 0 2446 return $input->{$field} =~ /^(?=.*[A-Za-z])(?=.*\d)(?=.*[\@\$!%*#?&])[A-Za-z\d\@\$!%*#?&]{8,}$/;
19             }
20 4 50       21  
21 4         65 return 1;
22             }
23              
24 0           1;