| 1 | package Bracket::Form::Register; | ||
| 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 | |||
| 9 | 4 | has_field 'first_name' => ( type => 'Text', required => 1 ); | |
| 10 | 4 | has_field 'last_name' => ( type => 'Text' ); | |
| 11 | 4 | has_field 'email' => ( | |
| 12 | type => 'Email', | ||
| 13 | required => 1, | ||
| 14 | unique => 1, | ||
| 15 | ); | ||
| 16 | 4 | has_field 'password' => ( type => 'Password', required => 1 ); | |
| 17 | 4 | has_field 'password_confirm' => ( type => 'PasswordConf' ); | |
| 18 | 4 | has_field 'submit' => ( type => 'Submit', value => 'Register' ); | |
| 19 | |||
| 20 | has '+unique_messages' => | ||
| 21 | 1 | ▶ | ( default => sub { { player_email => 'Email address already registered' } } ); |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 22 | |||
| 23 | # Insert basic role record into player_roles table on registration | ||
| 24 | 0 | ▶ | after 'update_model' => sub { |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 25 | 0 | my $self = shift; | |
| 26 | |||
| 27 | 0 | $self->item->update_or_create_related('player_roles', { role => 2}); | |
| 28 | 4 | }; | |
| 29 | |||
| 30 | 4 | ▶ | no HTML::FormHandler::Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 31 | 4 | __PACKAGE__->meta->make_immutable; | |
| 32 | |||
| 33 | 4 | 1 | |