cleanup module

This commit is contained in:
Daniel Seifert 2018-10-23 22:35:44 +02:00
parent 4e1e5653fb
commit 1cea1512d2
6 changed files with 92 additions and 108 deletions

View File

@ -17,10 +17,8 @@ namespace D3\Totp\Application\Controller\Admin;
use D3\Totp\Application\Model\d3totp; use D3\Totp\Application\Model\d3totp;
use D3\Totp\Modules\Application\Model\d3_totp_user; use D3\Totp\Modules\Application\Model\d3_totp_user;
use Doctrine\DBAL\DBALException;
use OxidEsales\Eshop\Application\Controller\Admin\AdminDetailsController; use OxidEsales\Eshop\Application\Controller\Admin\AdminDetailsController;
use OxidEsales\Eshop\Application\Model\User; use OxidEsales\Eshop\Application\Model\User;
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
use OxidEsales\Eshop\Core\Exception\StandardException; use OxidEsales\Eshop\Core\Exception\StandardException;
use OxidEsales\Eshop\Core\Registry; use OxidEsales\Eshop\Core\Registry;
@ -32,8 +30,6 @@ class d3user_totp extends AdminDetailsController
/** /**
* @return string * @return string
* @throws DBALException
* @throws DatabaseConnectionException
*/ */
public function render() public function render()
{ {

View File

@ -17,13 +17,6 @@
namespace D3\Totp\Application\Model\Exceptions; namespace D3\Totp\Application\Model\Exceptions;
use D3\ModCfg\Application\Model\DependencyInjectionContainer\d3DicHandler;
use D3\ModCfg\Application\Model\Exception\d3_cfg_mod_exception;
use D3\ModCfg\Application\Model\Exception\d3ShopCompatibilityAdapterException;
use D3\ModCfg\Application\Model\Log\d3log;
use Doctrine\DBAL\DBALException;
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
use OxidEsales\Eshop\Core\Exception\StandardException; use OxidEsales\Eshop\Core\Exception\StandardException;
class d3totp_wrongOtpException extends StandardException class d3totp_wrongOtpException extends StandardException

View File

@ -20,7 +20,6 @@ use BaconQrCode\Writer;
use D3\ModCfg\Application\Model\d3database; use D3\ModCfg\Application\Model\d3database;
use D3\Totp\Application\Model\Exceptions\d3totp_wrongOtpException; use D3\Totp\Application\Model\Exceptions\d3totp_wrongOtpException;
use Doctrine\DBAL\DBALException; use Doctrine\DBAL\DBALException;
use Exception;
use OTPHP\TOTP; use OTPHP\TOTP;
use OxidEsales\Eshop\Application\Model\User; use OxidEsales\Eshop\Application\Model\User;
use OxidEsales\Eshop\Core\DatabaseProvider; use OxidEsales\Eshop\Core\DatabaseProvider;
@ -35,6 +34,7 @@ class d3totp extends BaseModel
public $tableName = 'd3totp'; public $tableName = 'd3totp';
public $userId; public $userId;
public $totp; public $totp;
protected $timeWindow = 2;
/** /**
* d3totp constructor. * d3totp constructor.
@ -189,7 +189,7 @@ class d3totp extends BaseModel
*/ */
public function verify($totp, $seed = null) public function verify($totp, $seed = null)
{ {
$blVerify = $this->getTotp($seed)->verify($totp, null, 2); $blVerify = $this->getTotp($seed)->verify($totp, null, $this->timeWindow);
if (false == $blVerify) { if (false == $blVerify) {
$oException = oxNew(d3totp_wrongOtpException::class); $oException = oxNew(d3totp_wrongOtpException::class);
throw $oException; throw $oException;

View File

@ -17,11 +17,8 @@ namespace D3\Totp\Modules\Application\Model;
use D3\Totp\Application\Model\d3totp; use D3\Totp\Application\Model\d3totp;
use Doctrine\DBAL\DBALException; use Doctrine\DBAL\DBALException;
use OxidEsales\Eshop\Application\Controller\ForgotPasswordController;
use OxidEsales\Eshop\Core\DatabaseProvider;
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException; use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
use OxidEsales\Eshop\Core\Registry; use OxidEsales\Eshop\Core\Registry;
use OxidEsales\EshopCommunity\Application\Controller\Admin\UserMain;
class d3_totp_user extends d3_totp_user_parent class d3_totp_user extends d3_totp_user_parent
{ {
@ -29,7 +26,6 @@ class d3_totp_user extends d3_totp_user_parent
{ {
$return = parent::logout(); $return = parent::logout();
// deleting session info
Registry::getSession()->deleteVariable(d3totp::TOTP_SESSION_VARNAME); Registry::getSession()->deleteVariable(d3totp::TOTP_SESSION_VARNAME);
return $return; return $return;

View File

@ -33,7 +33,6 @@ class Installation extends d3install_updatebase
'do' => 'fixIndizes'), 'do' => 'fixIndizes'),
); );
// Standardwerte für checkMultiLangTables() und fixRegisterMultiLangTables()
public $aMultiLangTables = array(); public $aMultiLangTables = array();
public $aFields = array( public $aFields = array(
@ -98,8 +97,7 @@ class Installation extends d3install_updatebase
) )
); );
protected $_aRefreshMetaModuleIds = array('d3ordermanager'); protected $_aRefreshMetaModuleIds = array('d3totp');
/** /**
* @return bool * @return bool

View File

@ -19,60 +19,61 @@ use D3\Totp\Setup as ModuleSetup;
use D3\ModCfg\Application\Model\d3utils; use D3\ModCfg\Application\Model\d3utils;
use OxidEsales\Eshop\Application\Controller\Admin\LoginController; use OxidEsales\Eshop\Application\Controller\Admin\LoginController;
use OxidEsales\Eshop\Core\Utils; use OxidEsales\Eshop\Core\Utils;
use OxidEsales\Eshop\Application\Controller as OxidController;
use OxidEsales\Eshop\Application\Model as OxidModel; use OxidEsales\Eshop\Application\Model as OxidModel;
use OxidEsales\Eshop\Application\Component as OxidComponent;
use OxidEsales\Eshop\Core as OxidCore;
/** /**
* Metadata version * Metadata version
*/ */
$sMetadataVersion = '2.0'; $sMetadataVersion = '2.0';
$logo = (class_exists(d3utils::class) ? d3utils::getInstance()->getD3Logo() : 'D³');
$sModuleId = 'd3totp'; $sModuleId = 'd3totp';
/** /**
* Module information * Module information
*/ */
$aModule = [ $aModule = [
'id' => $sModuleId, 'id' => $sModuleId,
'title' => 'title' => [
(class_exists(d3utils::class) ? d3utils::getInstance()->getD3Logo() : 'D³') . ' Zwei-Faktor-Authentisierung / two-factor authentication', 'de' => $logo.' Zwei-Faktor-Authentisierung',
'description' => [ 'en' => $logo.' two-factor authentication',
'de' => 'Zwei-Faktor-Authentisierung (TOTP) für OXID eSales Shop',
'en' => 'Two-factor authentication (TOTP) for OXID eSales shop',
], ],
'thumbnail' => 'picture.png', 'description' => [
'version' => '0.1', 'de' => 'Zwei-Faktor-Authentisierung (TOTP) für OXID eSales Shop',
'author' => 'D³ Data Development (Inh.: Thomas Dartsch)', 'en' => 'Two-factor authentication (TOTP) for OXID eSales shop',
'email' => 'support@shopmodule.com', ],
'url' => 'http://www.oxidmodule.com/', 'thumbnail' => 'picture.png',
'extend' => [ 'version' => '0.1',
'author' => 'D³ Data Development (Inh.: Thomas Dartsch)',
'email' => 'support@shopmodule.com',
'url' => 'http://www.oxidmodule.com/',
'extend' => [
OxidModel\User::class => \D3\Totp\Modules\Application\Model\d3_totp_user::class, OxidModel\User::class => \D3\Totp\Modules\Application\Model\d3_totp_user::class,
LoginController::class => \D3\Totp\Modules\Application\Controller\Admin\d3_totp_LoginController::class, LoginController::class => \D3\Totp\Modules\Application\Controller\Admin\d3_totp_LoginController::class,
Utils::class => \D3\Totp\Modules\Core\d3_totp_utils::class, Utils::class => \D3\Totp\Modules\Core\d3_totp_utils::class,
], ],
'controllers' => [ 'controllers' => [
'd3user_totp' => \D3\Totp\Application\Controller\Admin\d3user_totp::class 'd3user_totp' => \D3\Totp\Application\Controller\Admin\d3user_totp::class
], ],
'templates' => [ 'templates' => [
'd3user_totp.tpl' => 'd3/totp/Application/views/admin/tpl/d3user_totp.tpl', 'd3user_totp.tpl' => 'd3/totp/Application/views/admin/tpl/d3user_totp.tpl',
], ],
'events' => [ 'events' => [
'onActivate' => '\D3\Totp\Setup\Events::onActivate', 'onActivate' => '\D3\Totp\Setup\Events::onActivate',
'onDeactivate' => '\D3\Totp\Setup\Events::onDeactivate', 'onDeactivate' => '\D3\Totp\Setup\Events::onDeactivate',
], ],
'settings' => [ 'settings' => [
], ],
'blocks' => [ 'blocks' => [
[ [
'template' => 'login.tpl', 'template' => 'login.tpl',
'block' => 'admin_login_form', 'block' => 'admin_login_form',
'file' => 'Application/views/admin/blocks/d3totp_login_admin_login_form.tpl', 'file' => 'Application/views/admin/blocks/d3totp_login_admin_login_form.tpl',
] ]
], ],
'd3FileRegister' => [ 'd3FileRegister' => [
], ],
'd3SetupClasses' => [ 'd3SetupClasses' => [
ModuleSetup\Installation::class ModuleSetup\Installation::class
] ]
]; ];