File Coverage

blib/lib/Bracket/Form/Password/ResetEmail.pm
Criterion Covered Total %
statement 6 11 54.5
branch 0 2 0.0
condition n/a
subroutine 2 4 50.0
pod 1 2 50.0
total 9 19 47.3


line stmt bran cond sub pod time code
1              
2             use HTML::FormHandler::Moose;
3 4     4   27 extends 'HTML::FormHandler::Model::DBIC';
  4         8  
  4         47  
4             with 'HTML::FormHandler::Render::Simple';
5              
6             has '+item_class' => ( default => 'Player' );
7             has_field 'email' => ( type => 'Email', noupdate => 1 );
8             has_field 'submit' => ( type => 'Submit', value => 'Send email to reset password' );
9              
10             my $self = shift;
11              
12 0     0 1   # Check the given email to see that it exists in the database
13             my $is_valid =
14             $self->schema->resultset('Player')
15 0           ->find( { email => $self->field('email')->value } );
16             if ( !$is_valid ) {
17             $self->field('email')->add_error('Email not on file');
18 0 0         }
19 0          
20             return;
21             }
22 0            
23             # Turn off update_model
24              
25              
26             no HTML::FormHandler::Moose;
27       0 0   __PACKAGE__->meta->make_immutable;
28             1