package ApikeysetupMgr;
#@LICENSE@#
use strict;
use warnings;
use base qw(RVL::Manager);
use Class::Std::Utils;
{
sub new {
my ($class, $opt) = @_;
my ($this) = $class->SUPER::new($opt);
$this->{pageTitle} = 'API Key Setup';
$this->{template} = 'apikeysetup.html';
$this->{_aActionsMapping} = {
'view' => ['view'],
'add' => ['add'],
};
return $this;
}
sub validate {
my ($this, $req, $input) = @_;
RVL::logMessage('', __CONSTANT__::RVL_LOG_DEBUG);
${$input}->{masterTemplate} = $this->{masterTemplate};
${$input}->{template} = $this->{template};
${$input}->{pageTitle} = $this->{pageTitle};
$this->{validated} = 1;
${$input}->{action} = $req->get('action') ? $req->get('action') : 'view';
my ($obj) = RVL::Output::singleton();
if (!Libs::Rvglobalsoft::singleton()->isAcceptLicense() ) {
$obj->redirect('rvglobalsoft', 'licenseagreement', '');
$this->{validated} = 0;
} elsif (!Libs::Rvglobalsoft::singleton()->isAllowResellerAccess()) {
RVL::raiseMsg('Sorry, ROOT is disabled resellers access to RV Global Store.', 0, __CONSTANT__::RVL_MESSAGE_ERROR);
$obj->redirect('rvglobalsoft', 'notprivilege', '');
$this->{validated} = 0;
} elsif (${$input}->{action} eq 'add') {
${$input}->{whmPublicKey} = $req->get('whmpublickey') ? $req->get('whmpublickey') : '';
if (${$input}->{whmPublicKey} eq '') {
RVL::raiseMsg('Not input control panel public key.', 0, __CONSTANT__::RVL_MESSAGE_ERROR);
${$input}->{action} = 'view';
}
}
}
sub _cmd_view {
my ($this, $input, $output) = @_;
RVL::logMessage('', __CONSTANT__::RVL_LOG_DEBUG);
if (-f RVL::CpHandle::singleton()->getHomeDir() . '/.rvglobalsoft/accesskey.pem') {
open(FD, '<', RVL::CpHandle::singleton()->getHomeDir() . '/.rvglobalsoft/accesskey.pem');
${$output}->{whmPublicKey} = join('', <FD>);
close(FD);
}
if (-f RVL::CpHandle::singleton()->getHomeDir() . '/.rvglobalsoft/authorizeid.pub') {
open(FD, '<', RVL::CpHandle::singleton()->getHomeDir() . '/.rvglobalsoft/authorizeid.pub');
${$output}->{username} = join('', <FD>);
close(FD);
}
}
sub _cmd_add {
my ($this, $input, $output) = @_;
RVL::logMessage('', __CONSTANT__::RVL_LOG_DEBUG);
}
sub display {
my ($this, $output) = @_;
RVL::logMessage('', __CONSTANT__::RVL_LOG_DEBUG);
}
}
1;
Copyright 2K16 - 2K18 Indonesian Hacker Rulez