Bracket
view release on metacpan or search on metacpan
lib/Bracket/Form/Password/ResetEmail.pm view on Meta::CPAN
package Bracket::Form::Password::ResetEmail;
use HTML::FormHandler::Moose;
extends 'HTML::FormHandler::Model::DBIC';
with 'HTML::FormHandler::Render::Simple';
has '+item_class' => ( default => 'Player' );
has_field 'email' => ( type => 'Email', noupdate => 1 );
has_field 'submit' => ( type => 'Submit', value => 'Send email to reset password' );
sub validate {
my $self = shift;
# Check the given email to see that it exists in the database
my $is_valid =
$self->schema->resultset('Player')
->find( { email => $self->field('email')->value } );
if ( !$is_valid ) {
$self->field('email')->add_error('Email not on file');
}
return;
}
# Turn off update_model
sub update_model {}
no HTML::FormHandler::Moose;
__PACKAGE__->meta->make_immutable;
1
( run in 0.893 second using v1.01-cache-2.11-cpan-39bf76dae61 )