| 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
| |||||||||||
| 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 | |||||||||