cleanup module

Cette révision appartient à :
Daniel Seifert 2018-10-23 22:35:44 +02:00
Parent 4e1e5653fb
révision 1cea1512d2
6 fichiers modifiés avec 92 ajouts et 108 suppressions

Voir le fichier

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

Voir le fichier

@ -17,13 +17,6 @@
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;
class d3totp_wrongOtpException extends StandardException

Voir le fichier

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

Voir le fichier

@ -17,11 +17,8 @@ namespace D3\Totp\Modules\Application\Model;
use D3\Totp\Application\Model\d3totp;
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\Registry;
use OxidEsales\EshopCommunity\Application\Controller\Admin\UserMain;
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();
// deleting session info
Registry::getSession()->deleteVariable(d3totp::TOTP_SESSION_VARNAME);
return $return;

Voir le fichier

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

Voir le fichier

@ -1,89 +1,90 @@
<?php
/**
* This Software is the property of Data Development and is protected
* by copyright law - it is NOT Freeware.
*
* Any unauthorized use of this software without a valid license
* is a violation of the license agreement and will be prosecuted by
* civil and criminal law.
*
* http://www.shopmodule.com
*
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Daniel Seifert <support@shopmodule.com>
* @link http://www.oxidmodule.com
*/
use D3\Totp\Setup as ModuleSetup;
use D3\ModCfg\Application\Model\d3utils;
use OxidEsales\Eshop\Application\Controller\Admin\LoginController;
use OxidEsales\Eshop\Core\Utils;
use OxidEsales\Eshop\Application\Controller as OxidController;
use OxidEsales\Eshop\Application\Model as OxidModel;
use OxidEsales\Eshop\Application\Component as OxidComponent;
use OxidEsales\Eshop\Core as OxidCore;
/**
* Metadata version
*/
$sMetadataVersion = '2.0';
$sModuleId = 'd3totp';
/**
* Module information
*/
$aModule = [
'id' => $sModuleId,
'title' =>
(class_exists(d3utils::class) ? d3utils::getInstance()->getD3Logo() : 'D&sup3;') . ' Zwei-Faktor-Authentisierung / two-factor authentication',
'description' => [
'de' => 'Zwei-Faktor-Authentisierung (TOTP) f&uuml;r OXID eSales Shop',
'en' => 'Two-factor authentication (TOTP) for OXID eSales shop',
],
'thumbnail' => 'picture.png',
'version' => '0.1',
'author' => 'D&sup3; 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,
LoginController::class => \D3\Totp\Modules\Application\Controller\Admin\d3_totp_LoginController::class,
Utils::class => \D3\Totp\Modules\Core\d3_totp_utils::class,
],
'controllers' => [
'd3user_totp' => \D3\Totp\Application\Controller\Admin\d3user_totp::class
],
'templates' => [
'd3user_totp.tpl' => 'd3/totp/Application/views/admin/tpl/d3user_totp.tpl',
],
'events' => [
'onActivate' => '\D3\Totp\Setup\Events::onActivate',
'onDeactivate' => '\D3\Totp\Setup\Events::onDeactivate',
],
'settings' => [
],
'blocks' => [
[
'template' => 'login.tpl',
'block' => 'admin_login_form',
'file' => 'Application/views/admin/blocks/d3totp_login_admin_login_form.tpl',
]
],
'd3FileRegister' => [
],
'd3SetupClasses' => [
ModuleSetup\Installation::class
]
];
// CREATE TABLE `d3totp` (
// `OXID` CHAR(32) NOT NULL,
// `OXUSERID` CHAR(32) NOT NULL,
// `USETOTP` TINYINT(1) NOT NULL DEFAULT '0',
// `SEED` VARCHAR(125) NOT NULL DEFAULT '0',
// PRIMARY KEY (`OXID`),
// UNIQUE INDEX `Schl<68>ssel 2` (`OXUSERID`)
//)
//ENGINE=InnoDB
<?php
/**
* This Software is the property of Data Development and is protected
* by copyright law - it is NOT Freeware.
*
* Any unauthorized use of this software without a valid license
* is a violation of the license agreement and will be prosecuted by
* civil and criminal law.
*
* http://www.shopmodule.com
*
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Daniel Seifert <support@shopmodule.com>
* @link http://www.oxidmodule.com
*/
use D3\Totp\Setup as ModuleSetup;
use D3\ModCfg\Application\Model\d3utils;
use OxidEsales\Eshop\Application\Controller\Admin\LoginController;
use OxidEsales\Eshop\Core\Utils;
use OxidEsales\Eshop\Application\Model as OxidModel;
/**
* Metadata version
*/
$sMetadataVersion = '2.0';
$logo = (class_exists(d3utils::class) ? d3utils::getInstance()->getD3Logo() : 'D&sup3;');
$sModuleId = 'd3totp';
/**
* Module information
*/
$aModule = [
'id' => $sModuleId,
'title' => [
'de' => $logo.' Zwei-Faktor-Authentisierung',
'en' => $logo.' two-factor authentication',
],
'description' => [
'de' => 'Zwei-Faktor-Authentisierung (TOTP) f&uuml;r OXID eSales Shop',
'en' => 'Two-factor authentication (TOTP) for OXID eSales shop',
],
'thumbnail' => 'picture.png',
'version' => '0.1',
'author' => 'D&sup3; 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,
LoginController::class => \D3\Totp\Modules\Application\Controller\Admin\d3_totp_LoginController::class,
Utils::class => \D3\Totp\Modules\Core\d3_totp_utils::class,
],
'controllers' => [
'd3user_totp' => \D3\Totp\Application\Controller\Admin\d3user_totp::class
],
'templates' => [
'd3user_totp.tpl' => 'd3/totp/Application/views/admin/tpl/d3user_totp.tpl',
],
'events' => [
'onActivate' => '\D3\Totp\Setup\Events::onActivate',
'onDeactivate' => '\D3\Totp\Setup\Events::onDeactivate',
],
'settings' => [
],
'blocks' => [
[
'template' => 'login.tpl',
'block' => 'admin_login_form',
'file' => 'Application/views/admin/blocks/d3totp_login_admin_login_form.tpl',
]
],
'd3FileRegister' => [
],
'd3SetupClasses' => [
ModuleSetup\Installation::class
]
];
// CREATE TABLE `d3totp` (
// `OXID` CHAR(32) NOT NULL,
// `OXUSERID` CHAR(32) NOT NULL,
// `USETOTP` TINYINT(1) NOT NULL DEFAULT '0',
// `SEED` VARCHAR(125) NOT NULL DEFAULT '0',
// PRIMARY KEY (`OXID`),
// UNIQUE INDEX `Schl<68>ssel 2` (`OXUSERID`)
//)
//ENGINE=InnoDB
//;