58 lines
1.1 KiB
Perl
58 lines
1.1 KiB
Perl
package Peace::Controller::AccountVerification;
|
|
|
|
use Mojo::Base 'Mojolicious::Controller';
|
|
|
|
use v5.30.0;
|
|
|
|
use strict;
|
|
use warnings;
|
|
|
|
use Peace;
|
|
use Peace::DB;
|
|
use Peace::DAO::Developer;
|
|
|
|
sub verify {
|
|
my $self = shift;
|
|
my $config = Peace->new->peace_config;
|
|
my $got_verification_secret = $self->stash->{verification_secret};
|
|
my $dbh = Peace::DB->dbh( config => $config );
|
|
my $developer_dao = Peace::DAO::Developer->new( dbh => $dbh );
|
|
eval {
|
|
$developer_dao->verify( verification_secret => $got_verification_secret );
|
|
};
|
|
if ($@) {
|
|
$self->render( text => $@, status => '400' );
|
|
return;
|
|
}
|
|
$self->render( text => 'Successfully verified.' );
|
|
}
|
|
1;
|
|
=encoding utf8
|
|
|
|
=head1 NAME
|
|
|
|
Peace::Controller::AccountVerification - Account verification controller.
|
|
|
|
=head1 SYNOPSIS
|
|
|
|
# This class is not to be used in Perl code.
|
|
|
|
=head1 DESCRIPTION
|
|
|
|
This class handles account verification from the web.
|
|
|
|
=head1 METHODS
|
|
|
|
Peace::Controller::AccountVerification implements the following methods.
|
|
|
|
=head2 verify
|
|
|
|
For internal usage.
|
|
|
|
=head1 SEE ALSO
|
|
|
|
L<Peace::DAO::Developer>
|
|
|
|
=cut
|
|
|