diff options
Diffstat (limited to 'perllib')
-rw-r--r-- | perllib/CrossSell.pm | 11 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Admin.pm | 11 |
2 files changed, 17 insertions, 5 deletions
diff --git a/perllib/CrossSell.pm b/perllib/CrossSell.pm index 5c7bf04ac..0c621e9d0 100644 --- a/perllib/CrossSell.pm +++ b/perllib/CrossSell.pm @@ -129,12 +129,15 @@ sub display_news_form { address below and we’ll send you occasional emails about what mySociety and our users have been up to.</p> -<form method="post" action="https://secure.mysociety.org/admin/lists/mailman/subscribe/news"> +<form method="post" action="//mysociety.us9.list-manage.com/subscribe/post?u=53d0d2026dea615ed488a8834&id=287dc28511"> +<label style="position: absolute; left: -5000px;"> +Leave this box empty: <input type="text" name="b_53d0d2026dea615ed488a8834_287dc28511" tabindex="-1" value="" /> +</label> <label for="name">Name:</label> -<input type="text" name="fullname" id="name" value="$input_h{name}" size="30"> +<input type="text" name="NAME" id="name" value="$input_h{name}" size="30"> <br><label for="email">Email:</label> -<input type="text" name="email" id="email" value="$input_h{email}" size="30"> - <input type="submit" value="Add me to the list"> +<input type="text" name="EMAIL" id="email" value="$input_h{email}" size="30"> + <input type="submit" name="subscribe" value="Add me to the list"> </form> <p>mySociety respects your privacy, and we'll never sell or give away your private diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm index cfe165f43..c1df8622f 100644 --- a/perllib/FixMyStreet/App/Controller/Admin.pm +++ b/perllib/FixMyStreet/App/Controller/Admin.pm @@ -343,8 +343,13 @@ sub update_contacts : Private { if ( $posted eq 'new' ) { $c->forward('check_token'); + my %errors; + my $category = $self->trim( $c->req->param( 'category' ) ); + $errors{category} = _("Please choose a category") unless $category; my $email = $self->trim( $c->req->param( 'email' ) ); + $errors{email} = _('Please enter a valid email') unless is_valid_email($email); + $errors{note} = _('Please enter a message') unless $c->req->param('note'); $category = 'Empty property' if $c->cobrand->moniker eq 'emptyhomes'; @@ -367,7 +372,11 @@ sub update_contacts : Private { $contact->api_key( $c->req->param('api_key') ); $contact->send_method( $c->req->param('send_method') ); - if ( $contact->in_storage ) { + if ( %errors ) { + $c->stash->{updated} = _('Please correct the errors below'); + $c->stash->{contact} = $contact; + $c->stash->{errors} = \%errors; + } elsif ( $contact->in_storage ) { $c->stash->{updated} = _('Values updated'); # NB: History is automatically stored by a trigger in the database |