Skip to content

Commit

Permalink
Merge pull request #3253 from metacpan/haarg/remove-captcha
Browse files Browse the repository at this point in the history
remove captcha
  • Loading branch information
haarg authored Dec 21, 2024
2 parents dd53856 + 53b7030 commit f4c296d
Show file tree
Hide file tree
Showing 13 changed files with 7 additions and 119 deletions.
3 changes: 1 addition & 2 deletions app.psgi
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@ builder {
"frame-ancestors 'self' *.metacpan.org",

# temporary 'unsafe-eval' because root/static/js/jquery.tablesorter.js
"script-src 'self' 'unsafe-eval' 'unsafe-inline' *.metacpan.org https://*.googletagmanager.com https://www.google.com/recaptcha/ https://www.gstatic.com/recaptcha/",

"script-src 'self' 'unsafe-eval' 'unsafe-inline' *.metacpan.org https://*.googletagmanager.com",
),
'X-Frame-Options' => 'SAMEORIGIN',
'X-XSS-Protection' => '1; mode=block',
Expand Down
7 changes: 2 additions & 5 deletions lib/MetaCPAN/Web/Authentication/User.pm
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,8 @@ sub BUILDARGS {

sub for_session { $_[0]->token }

has id => ( is => 'ro' );
has looks_human => ( is => 'ro' );
has passed_captcha => ( is => 'ro' );
has access_token => ( is => 'ro' );
has id => ( is => 'ro' );
has access_token => ( is => 'ro' );
has identity => (
is => 'ro',
isa => HashRef->plus_coercions( ArrayToHash ['name'] ),
Expand All @@ -70,7 +68,6 @@ for my $method ( qw(
get_profile
add_favorite
remove_favorite
turing
) )
{
no strict 'refs';
Expand Down
6 changes: 1 addition & 5 deletions lib/MetaCPAN/Web/Controller/Account/Favorite.pm
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,7 @@ sub add : Local : Args(0) {
}
}
else {
$c->res->redirect(
$res->{error}
? $c->uri_for('/account/turing/index')
: $c->req->referer
);
$c->res->redirect( $c->req->referer );
}
}

Expand Down
32 changes: 0 additions & 32 deletions lib/MetaCPAN/Web/Controller/Account/Turing.pm

This file was deleted.

9 changes: 0 additions & 9 deletions lib/MetaCPAN/Web/Model/API/User.pm
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,6 @@ sub remove_favorite {
undef, { access_token => $token }, 'DELETE' );
}

sub turing {
my ( $self, $token, $answer ) = @_;
$self->request(
'/user/turing',
{ answer => $answer },
{ access_token => $token },
);
}

__PACKAGE__->meta->make_immutable;

1;
4 changes: 0 additions & 4 deletions metacpan_web.conf
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ mark_unauthorized_releases = 0
cache = 1
</View::Xslate>

<Controller::Account::Turing>
public_key 6LeH2MsSAAAAANwz3AA73Gw5OjCVjT6I51Ev-ior
</Controller::Account::Turing>

<sitemap sitemap-authors.xml.gz>
object_type = author
field_name = pauseid
Expand Down
24 changes: 0 additions & 24 deletions root/account/turing.tx

This file was deleted.

5 changes: 0 additions & 5 deletions root/base/account.tx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@
%% }
%% override left_nav_classes -> { 'nav nav-pills nav-stacked' }
%% override left_nav_content -> {
%% if !$user.looks_human {
<li class="[% if $current['account/turing'] { 'active' } %]">
<a href="/account/turing">Verify Account</a>
</li>
%% }
<li class="[% if $current['account/identities'] { 'active' } %]">
<a href="/account/identities">Identities</a>
</li>
Expand Down
4 changes: 1 addition & 3 deletions root/static/js/cpan.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,7 @@ for (const favForm of document.querySelectorAll('form[action="/account/favorite/
body: formData,
});
if (!response.ok) {
if (confirm("You have to complete a Captcha in order to ++.")) {
document.location.href = "/account/turing";
}
alert("Error adding favorite!");
}

const button = favForm.querySelector('button');
Expand Down
1 change: 0 additions & 1 deletion root/static/js/main.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import './cpan.js';
import './github.js';
import './dropdown.js';
import './profile.js';
import './recaptcha.mjs';
import './search.js';
import 'bootstrap/js/dropdown.js';
import 'bootstrap/js/collapse.js';
Expand Down
23 changes: 0 additions & 23 deletions root/static/js/recaptcha.mjs

This file was deleted.

5 changes: 1 addition & 4 deletions t/controller/account.t
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,7 @@ test_psgi app, sub {
};

# (we're always authenticated from now on)
$user_res = {
looks_human => \1,
id => '5',
};
$user_res = { id => '5', };

subtest 'GET profile' => sub {
$api_res = { error => 'broken' };
Expand Down
3 changes: 1 addition & 2 deletions t/html.t
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ use Path::Tiny qw( path );

# files that have inline <script> tags
my %skip = map { $_ => 1 } (
'root/about/contributors.tx', 'root/account/profile.tx',
'root/account/turing.tx', 'root/base.tx',
'root/about/contributors.tx', 'root/account/profile.tx', 'root/base.tx',
);

File::Find::find(
Expand Down

0 comments on commit f4c296d

Please sign in to comment.