before register => sub {
my ($self, $c) = @_;
+ warn $c->config->{'Registration'}->{'no_recaptcha'};
+
## Puts HTML into stash in "recaptcha" key.
- $c->forward('captcha_get');
+ if (!$c->config->{'Registration'}->{'no_recaptcha'}) {
+ $c->forward('captcha_get');
+ }
## When submitting, check recaptcha passes, else re-draw form
if($c->req->method eq 'POST') {
- if(!$c->forward('captcha_check') || 0 ) {
+ if ( !$c->config->{'Registration'}->{'no_recaptcha'} && !$c->forward('captcha_check') ) {
## Need these two lines to detach, so end can draw the correct template again:
my $form = $self->form_handler->new( active => [ $self->login_id_field, 'password', 'confirm_password' ] );
$c->stash( template => $self->register_template, form => $form );
public_cert_url https://www.googleapis.com/oauth2/v1/certs
client_id 577442226093-pi2ud795g49ibip78bgfoabhl4kdrguc.apps.googleusercontent.com
</Authentication::Credential::Google>
+<Registration>
+ no_recaptcha 0
+</Registration>
--- /dev/null
+<Registration>
+ no_recaptcha 1
+</Registration>
--- /dev/null
+use warnings;
+use strict;
+
+use stemmaweb;
+use LWP::Protocol::PSGI;
+use Test::WWW::Mechanize;
+
+use Test::More;
+use HTML::TreeBuilder;
+use Data::Dumper;
+
+use FindBin;
+use lib ("$FindBin::Bin/lib");
+
+use stemmaweb::Test::DB;
+
+stemmaweb::Test::DB->new_db;
+
+LWP::Protocol::PSGI->register(stemmaweb->psgi_app);
+
+use stemmaweb::Test::Common;
+
+my $ua = Test::WWW::Mechanize->new;
+
+$ua->get_ok('http://localhost/register');
+
+my $response = $ua->submit_form(
+ fields => {
+ username => 'user2@example.org',
+ password => 'UserPass',
+ confirm_password => 'UserPass',
+ });
+
+warn $ua->content;
+
+=cut
+
+$ua->content_contains('Stemmaweb - Logged in', 'Log in successful.');
+
+my $content = $ua->get('/');
+$ua->content_contains('Hello! user@example.org', 'We are logged in.');
+
+=cut
+
+done_testing;
--- /dev/null
+package stemmaweb::Test::Common;
+
+use strict;
+use warnings;
+
+BEGIN {
+ $ENV{STEMMAWEB_CONFIG_LOCAL_SUFFIX} = 'tests';
+ $ENV{STEMMAWEB_CONFIG_PATH} = '.';
+}
+
+1;