add setup, admin panel, tpl block

This commit is contained in:
Daniel Seifert 2018-10-17 23:48:20 +02:00
parent d8cd285342
commit ed3eee4e67
9 changed files with 212 additions and 22 deletions

View File

@ -0,0 +1,23 @@
<?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
*/
namespace D3\Totp\Application\Controller\Admin;
use OxidEsales\Eshop\Application\Controller\Admin\AdminDetailsController;
class d3user_totp extends AdminDetailsController
{
protected $_sThisTemplate = 'd3user_totp.tpl';
}

View File

@ -0,0 +1,17 @@
[{if $request_totp}]
[{$oViewConf->getHiddenSid()}]
<input type="hidden" name="fnc" value="checklogin">
<input type="hidden" name="cl" value="login">
[{if $Errors.default|@count}]
[{include file="inc_error.tpl" Errorlist=$Errors.default}]
[{/if}]
<label for="d3totp">[{oxmultilang ident="TOTP_INPUT"}]</label>
<input type="text" name="d3totp" id="d3totp" value="" size="49" autofocus><br>
[{oxmultilang ident="TOTP_INPUT_HELP"}]
[{else}]
[{$smarty.block.parent}]
[{/if}]

View File

@ -0,0 +1,27 @@
<?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
*/
$sLangName = "Deutsch";
$aLang = [
'charset' => 'UTF-8',
'TOTP_INPUT' => 'Authentisierungscode',
'TOTP_INPUT_HELP' => 'Den Authentisierungscode erhalten Sie von der Zweifaktorauthentisierung-App auf Ihrem Gerät.',
'd3mxuser_totp' => '2-Faktor-Authentisierung',
];

View File

@ -0,0 +1,27 @@
<?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
*/
$sLangName = "English";
$aLang = [
'charset' => 'UTF-8',
'TOTP_INPUT' => 'authentication code',
'TOTP_INPUT_HELP' => 'The authentication code is available from the Two-Factor Authentication app on your device.',
'd3mxuser_totp' => 'Two-factor authentication',
];

View File

@ -0,0 +1,6 @@
[{include file="headitem.tpl" title="GENERAL_ADMIN_TITLE"|oxmultilangassign}]
foo
[{include file="bottomnaviitem.tpl"}]
[{include file="bottomitem.tpl"}]

48
src/Setup/Events.php Normal file
View File

@ -0,0 +1,48 @@
<?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
*/
namespace D3\Totp\Setup;
use D3\ModCfg\Application\Model\Exception\d3ShopCompatibilityAdapterException;
use D3\ModCfg\Application\Model\Install\d3install;
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\SystemComponentException;
class Events
{
/**
* @throws d3ShopCompatibilityAdapterException
* @throws DBALException
* @throws DatabaseConnectionException
* @throws DatabaseErrorException
* @throws StandardException
* @throws SystemComponentException
*/
public static function onActivate()
{
if (class_exists(d3install::class)) {
d3install::checkUpdateStart();
}
}
public static function onDeactivate()
{
}
}

View File

@ -0,0 +1,23 @@
<?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
*/
namespace D3\Totp\Setup;
use D3\ModCfg\Application\Model\Install\d3install_updatebase;
class Installation extends d3install_updatebase
{
}

10
src/menu.xml Normal file
View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<OX>
<OXMENU id="NAVIGATION_ESHOPADMIN">
<MAINMENU id="mxuadmin">
<SUBMENU id="mxusers" cl="admin_user" list="user_list">
<TAB id="d3mxuser_totp" cl="d3user_totp" />
</SUBMENU>
</MAINMENU>
</OXMENU>
</OX>

View File

@ -15,11 +15,10 @@
* @link http://www.oxidmodule.com
*/
use D3\Extsearch\setup as ModuleSetup;
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\VisualCmsModule\Application\Controller\Admin\VisualCmsAdmin as VisualCMSAdmin;
use OxidEsales\Eshop\Application\Controller as OxidController;
use OxidEsales\Eshop\Application\Model as OxidModel;
use OxidEsales\Eshop\Application\Component as OxidComponent;
@ -34,39 +33,49 @@ $sModuleId = 'd3totp';
/**
* Module information
*/
$aModule = array(
$aModule = [
'id' => $sModuleId,
'title' =>
(class_exists(d3utils::class) ? d3utils::getInstance()->getD3Logo() : 'D&sup3;') . ' Zwei-Faktor-Authentisierung',
'description' => array(
'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' => array(
'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' => array(
),
'templates' => array(
),
'events' => [
],
'settings' => array(
),
'blocks' => array(
),
'd3FileRegister' => array(
),
'd3SetupClasses' => array(
),
);
'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,
@ -74,7 +83,7 @@ $aModule = array(
// `USETOTP` TINYINT(1) NOT NULL DEFAULT '0',
// `SEED` VARCHAR(100) NOT NULL DEFAULT '0',
// PRIMARY KEY (`OXID`),
// UNIQUE INDEX `Schlüssel 2` (`OXUSERID`)
// UNIQUE INDEX `Schl<EFBFBD>ssel 2` (`OXUSERID`)
//)
//ENGINE=InnoDB
//;