File Coverage

blib/lib/Bracket/Form/Password/Change.pm
Criterion Covered Total %
statement 6 11 54.5
branch 0 2 0.0
condition n/a
subroutine 2 3 66.6
pod 1 1 100.0
total 9 17 52.9


line stmt bran cond sub pod time code
1              
2             use HTML::FormHandler::Moose;
3 4     4   28 extends 'HTML::FormHandler::Model::DBIC';
  4         7  
  4         47  
4             with 'HTML::FormHandler::Render::Table';
5              
6             has '+item_class' => ( default => 'Player' );
7             has_field 'current_password' => ( type => 'Password', );
8             has_field 'password' => ( type => 'Password' );
9             has_field 'password_confirm' => ( type => 'PasswordConf' );
10             has_field 'submit' => ( type => 'Submit', value => 'Change Password' );
11              
12             my $self = shift;
13              
14 0     0 1   # check current password against what's in the database
15             my $is_valid =
16             $self->schema->resultset('Player')->find( { id => $self->item_id } )
17 0           ->check_password( $self->field('current_password')->value );
18             if ( !$is_valid ) {
19             $self->field('current_password')
20 0 0         ->add_error('Current password incorrect');
21 0           }
22             return;
23             }
24 0            
25             no HTML::FormHandler::Moose;
26             __PACKAGE__->meta->make_immutable;
27 4     4   42048 1
  4         10  
  4         19