Browse Source

+ /captcha

master
Alex 'AdUser' Z 7 years ago
parent
commit
a948571bc0
  1. 17
      lib/CMTD/Main.pm

17
lib/CMTD/Main.pm

@ -13,6 +13,23 @@ sub index {
}
sub captcha {
my ($self) = @_;
eval {
my $table = $c->app->config->{captcha}->{table};
my @sort = qw(shown tries);
$self->app->db->begin;
my ($cid, $data) = $self->app->db->select($table, ['id', 'data'], undef, \@sort)->list;
$self->app->db->update($table, {shown => time()}, {id => $cid});
$self->app->db->commit;
$self->app->log->debug("showing captcha #$cid");
$self->render(json => {id => $cid, data => $data}); 1;
} or do {
chomp $@;
$self->app->log->error("error when showing captcha: $@");
$self->res->code(500);
$self->render(text => 'internal error');
};
}
sub c_list {

Loading…
Cancel
Save