1
0
Fork 0
Dieser Commit ist enthalten in:
Daniel Seifert 2018-10-23 22:35:44 +02:00
Ursprung 4e1e5653fb
Commit 1cea1512d2
6 geänderte Dateien mit 92 neuen und 108 gelöschten Zeilen

Datei anzeigen

@ -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()
{ {

Datei anzeigen

@ -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

Datei anzeigen

@ -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;

Datei anzeigen

@ -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;

Datei anzeigen

@ -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

Datei anzeigen

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