1 package SGN
::Controller
::Contact
;
4 use namespace
::autoclean
;
7 BEGIN { extends
'Catalyst::Controller' }
11 SGN::Controller::Contact - controller for contact page
16 sub form
:Path
('/contact/form') :Args
(0) {
18 my ($username, $useremail) = _load_user
($c);
20 my $random_factor = int rand(5);
21 my $minimum = int(rand(10)) * 10**$random_factor;
22 my $val_2 = int rand(20);
23 my $question = "$minimum + $val_2";
24 my $answer = $minimum + $val_2;
26 $c->stash->{website_name
} = $c->config->{project_name
};
27 #$c->stash->{captcha_public_key} = $c->config->{captcha_public_key};
28 #$c->stash->{captcha_private_key} = $c->config->{captcha_private_key};
29 $c->stash->{contact_form_human_question
} = $question;
30 $c->stash->{contact_form_human_answer
} = $answer;
31 $c->stash->{email_address_to_display
} = $c->config->{feedback_email
};
32 $c->stash->{template
} = '/help/contact.mas';
35 #Loads the user if he has an account
38 my $dbh = $c->dbc->dbh;
39 my $user = $c->user_exists ?
$c->user->get_object : CXGN
::People
::Person
->new( $dbh, undef );
41 my $username = join ' ', grep defined, $user->get_first_name, $user->get_last_name;
42 my $useremail = $user->get_private_email;
44 return ($username, $useremail);
48 __PACKAGE__
->meta->make_immutable;