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   8645 use utf8;
  3         8  
  3         18  
4 3     3   818 use namespace::clean;
  3         7  
  3         16  
5 3     3   76  
  3         10  
  3         36  
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 80132 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 (exists $input->{$field}) {
18 4     4 0 1825 return $input->{$field} =~ /^(?=.*[A-Za-z])(?=.*\d)(?=.*[\@\$!%*#?&])[A-Za-z\d\@\$!%*#?&]{8,}$/;
19             }
20 4 50       14  
21 4         30 return 1;
22             }
23              
24 0           1;