lib/Bracket/Form/Password/Change.pm

filter: Statementstmt 75.0% 15 / 20 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 66.6% 2 / 3 Podpod 100% 1 / 1 totaltotal 69.2% 18 / 26 CC 2 SCAR 12.5
CC
2
Cov
68%
validate
6.0
BEGIN
1.0
BEGIN
1.0
CRAP 3.5
« lib/Bracket/Controller/Player.pm ↑ Summary lib/Bracket/Controller/Auth.pm »
1 package Bracket::Form::Password::Change;
2  
3 4 ▶use HTML::FormHandler::Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 extends 'HTML::FormHandler::Model::DBIC';
5 4 with 'HTML::FormHandler::Render::Table';
6  
7 4 has '+item_class' => ( default => 'Player' );
8 4 has_field 'current_password' => ( type => 'Password', );
9 4 has_field 'password' => ( type => 'Password' );
10 4 has_field 'password_confirm' => ( type => 'PasswordConf' );
11 4 has_field 'submit' => ( type => 'Submit', value => 'Change Password' );
12  
13 0 ▶sub validate {
Subroutine validate: not called CC=2 SCAR=17.9
Pod documented
14 0 my $self = shift;
15  
16 # check current password against what's in the database
17 0 my $is_valid =
18 $self->schema->resultset('Player')->find( { id => $self->item_id } )
19 ->check_password( $self->field('current_password')->value );
20 0 ▶ if ( !$is_valid ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($is_valid) 0 0 0
21 0 $self->field('current_password')
22 ->add_error('Current password incorrect');
23 }
24 0 return;
25 }
26  
27 4 ▶no HTML::FormHandler::Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
28 4 __PACKAGE__->meta->make_immutable;
29 4 1
« lib/Bracket/Controller/Player.pm ↑ Summary lib/Bracket/Controller/Auth.pm »