seedlot upload with accession synonyms. seedlot upload works to update existing seedlots
[sgn.git] / lib / SGN / Controller / Contact.pm
blob79d06d39efc26dfcafa81babde4e2c8c1a0eabc9
1 package SGN::Controller::Contact;
3 use Moose;
4 use namespace::autoclean;
5 use CXGN::People;
7 BEGIN { extends 'Catalyst::Controller' }
9 =head1 NAME
11 SGN::Controller::Contact - controller for contact page
13 =cut
15 #Creates a blank form
16 sub form :Path('/contact/form') :Args(0) {
17 my ($self, $c) = @_;
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
36 sub _load_user {
37 my ($c) = @_;
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;