Skip to content

Commit 1be0c9f

Browse files
authored
Merge pull request #1332 from metacpan/haarg/remove-captcha
remove captcha
2 parents c1e0902 + 4a3d72d commit 1be0c9f

File tree

12 files changed

+2
-201
lines changed

12 files changed

+2
-201
lines changed

cpanfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ requires 'perl', '5.010';
66
requires 'Archive::Any', '0.0946';
77
requires 'Archive::Tar', '2.40';
88
requires 'Authen::SASL', '2.16'; # for Email::Sender::Transport::SMTP
9-
requires 'Captcha::reCAPTCHA', '0.99';
109
requires 'Catalyst', '5.90128';
1110
requires 'Catalyst::Action::RenderView', '0.16';
1211
requires 'Catalyst::Controller::REST', '1.21';

cpanfile.snapshot

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -428,15 +428,6 @@ DISTRIBUTIONS
428428
Canary::Stability 2013
429429
requirements:
430430
ExtUtils::MakeMaker 0
431-
Captcha-reCaptcha-0.99
432-
pathname: S/SU/SUNNYP/Captcha-reCaptcha-0.99.tar.gz
433-
provides:
434-
Captcha::reCAPTCHA 0.99
435-
requirements:
436-
ExtUtils::MakeMaker 0
437-
HTML::Tiny 0.904
438-
LWP::UserAgent 0
439-
Test::More 0
440431
Capture-Tiny-0.48
441432
pathname: D/DA/DAGOLDEN/Capture-Tiny-0.48.tar.gz
442433
provides:

es/account/mapping.json

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,6 @@
4040
"type": "string"
4141
}
4242
}
43-
},
44-
"looks_human": {
45-
"type": "boolean"
46-
},
47-
"passed_captcha": {
48-
"format": "strict_date_optional_time||epoch_millis",
49-
"type": "date"
5043
}
5144
}
5245
}

lib/MetaCPAN/Model/User/Account.pm

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -70,57 +70,18 @@ has access_token => (
7070
handles => { add_access_token => 'push' },
7171
);
7272

73-
=head2 passed_captcha
74-
75-
L<DateTime> when the user passed the captcha.
76-
77-
=cut
78-
79-
has passed_captcha => (
80-
is => 'ro',
81-
isa => 'DateTime',
82-
writer => '_set_passed_captcha',
83-
);
84-
85-
=head2 looks_human
86-
87-
Certain features are disabled unless a user C<looks_human>. This attribute
88-
is true if the user is connected to a PAUSE account or he L</passed_captcha>.
89-
90-
=cut
91-
92-
has looks_human => (
93-
required => 1,
94-
is => 'ro',
95-
isa => ESBool,
96-
lazy => 1,
97-
builder => '_build_looks_human',
98-
clearer => 'clear_looks_human',
99-
);
100-
101-
sub _build_looks_human {
102-
my $self = shift;
103-
return (
104-
( $self->has_identity('pause') || $self->passed_captcha )
105-
? true
106-
: false
107-
);
108-
}
109-
11073
=head1 METHODS
11174
11275
=head2 add_identity
11376
11477
Adds an identity to L</identity>. If the identity is a PAUSE account,
115-
the user ID is added to the corresponding L<MetaCPAN::Document::Author> document
116-
and L</looks_human> is updated.
78+
the user ID is added to the corresponding L<MetaCPAN::Document::Author> document.
11779
11880
=cut
11981

12082
after add_identity => sub {
12183
my ( $self, $identity ) = @_;
12284
if ( $identity->{name} eq 'pause' ) {
123-
$self->clear_looks_human;
12485
my $profile
12586
= $self->index->model->doc('author')->get( $identity->{key} );
12687

lib/MetaCPAN/Server/Controller/Login.pm

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ sub update_user {
4444
if ( $c->session->{__user} );
4545
$user ||= $model->new_document;
4646
$user->add_identity( { name => $type, key => $id, extra => $data } );
47-
$user->clear_looks_human; # rebuild
48-
$user->put( { refresh => true } );
47+
$user->put( { refresh => true } );
4948
}
5049
$c->authenticate( { user => $user } );
5150

lib/MetaCPAN/Server/Controller/User/Favorite.pm

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,6 @@ use MetaCPAN::Util qw( true false );
88

99
BEGIN { extends 'Catalyst::Controller::REST' }
1010

11-
sub auto : Private {
12-
my ( $self, $c ) = @_;
13-
unless ( $c->user->looks_human ) {
14-
$self->status_forbidden( $c,
15-
message => 'please complete the turing test' );
16-
return 0;
17-
}
18-
else {
19-
return 1;
20-
}
21-
}
22-
2311
sub index : Path : ActionClass('REST') {
2412
}
2513

lib/MetaCPAN/Server/Controller/User/Turing.pm

Lines changed: 0 additions & 45 deletions
This file was deleted.

metacpan_server.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ logger:
1515
filename: ../var/log/metacpan.log
1616
syswrite: 1
1717

18-
controller:
19-
User::Turing:
20-
private_key: 59125ffc09413eed3f2a2c07a37c7a44b95633e2
21-
2218
smtp:
2319
host: smtp.fastmail.com
2420
port: 465

metacpan_server_testing.yaml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@ logger:
1212
class: Log::Log4perl::Appender::Screen
1313
name: testing
1414

15-
controller:
16-
User::Turing:
17-
captcha_class: Captcha::Mock
18-
private_key: testing
19-
2015
github_key: foo
2116
github_secret: bar
2217

t/server/controller/user/favorite.t

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -59,22 +59,6 @@ test_psgi app, sub {
5959

6060
ok( $user = $cb->( GET '/user?access_token=bot' ), 'get bot' );
6161
is( $user->code, 200, 'code 200' );
62-
63-
$user = decode_json_ok($user);
64-
ok( !$user->{looks_human}, 'user looks like a bot' );
65-
ok(
66-
$res = $cb->(
67-
POST '/user/favorite?access_token=bot',
68-
Content => encode_json( {
69-
distribution => 'Moose',
70-
release => 'Moose-1.10',
71-
author => 'DOY'
72-
} )
73-
),
74-
'POST favorite'
75-
);
76-
decode_json_ok($res);
77-
is( $res->code, 403, 'forbidden' );
7862
};
7963

8064
done_testing;

t/server/controller/user/turing.t

Lines changed: 0 additions & 54 deletions
This file was deleted.

t/testrules.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,7 @@ seq:
33
- seq: t/0*.t
44

55
# ensure t/script/cover.t runs before t/server/controller/cover.t
6-
76
- seq: t/script/cover.t
87

9-
# If t/server/controller/user/favorite.t this runs too late then the
10-
# looks_human test will fail. We should probably reset the user data, but
11-
# this is a quicker fix for now.
12-
13-
- seq: t/server/controller/user/favorite.t
148
- par:
159
- t/**.t

0 commit comments

Comments
 (0)