make connector compatible
This commit is contained in:
parent
40a24d6ef2
commit
57de2aabce
@ -53,12 +53,17 @@ class d3totp extends BaseModel
|
||||
{
|
||||
$this->userId = $userId;
|
||||
$oQB = d3database::getInstance()->getQueryBuilder();
|
||||
$oQB->select('oxid')
|
||||
->from($this->getViewName())
|
||||
->where("oxuserid = ".$oQB->createNamedParameter($userId))
|
||||
->setMaxResults(1);
|
||||
|
||||
return $this->load(DatabaseProvider::getDb(DatabaseProvider::FETCH_MODE_ASSOC)->getOne($oQB->getSQL(), $oQB->getParameters()));
|
||||
if (DatabaseProvider::getDb(DatabaseProvider::FETCH_MODE_ASSOC)->getOne("SHOW TABLES LIKE 'd3totp'")) {
|
||||
$oQB->select('oxid')
|
||||
->from($this->getViewName())
|
||||
->where("oxuserid = " . $oQB->createNamedParameter($userId))
|
||||
->setMaxResults(1);
|
||||
|
||||
return $this->load(DatabaseProvider::getDb(DatabaseProvider::FETCH_MODE_ASSOC)->getOne($oQB->getSQL(), $oQB->getParameters()));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -184,7 +189,7 @@ class d3totp extends BaseModel
|
||||
{
|
||||
$blVerify = $this->getTotp($seed)->verify($totp, null, 2);
|
||||
if (false == $blVerify) {
|
||||
$oException = oxNew(d3totp_wrongOtpException::class, 'unvalid TOTP');
|
||||
$oException = oxNew(d3totp_wrongOtpException::class, 'D3_TOTP_ERROR_UNVALID');
|
||||
throw $oException;
|
||||
}
|
||||
|
||||
|
@ -34,4 +34,10 @@ $aLang = [
|
||||
'D3_TOTP_CURRPWD_HELP' => 'Die Zeichenkette wird verschlüsselt im Shop abgelegt. Zum Verschlüsseln wird das Passwort des ausgewählten Kundenkontos benötigt. Zugleich stellt dies sicher, dass nur Berechtigte Änderungen an diesen Einstellungen vornehmen dürfen.',
|
||||
'D3_TOTP_CURROTP' => 'Bestätigung mit Einmalpasswort',
|
||||
'D3_TOTP_CURROTP_HELP' => 'Haben Sie dieses Kundenkonto in Ihrer Authentisierungs-App registriert, generieren Sie damit ein Einmalpasswort, tragen Sie es hier ein und senden das Formular direkt darauf hin ab.',
|
||||
|
||||
'D3_TOTP_REGISTEREXIST' => 'vorhandene Registrierung',
|
||||
'D3_TOTP_REGISTERDELETE' => 'Registrierung löschen',
|
||||
'D3_TOTP_REGISTERDELETE_DESC' => 'Das Konto ist dann nicht mehr durch die Zweifaktorauthtisierung geschützt.',
|
||||
|
||||
'D3_TOTP_ERROR_UNVALID' => 'Das Einmalpasswort ist ungültig.',
|
||||
];
|
||||
|
@ -52,6 +52,36 @@
|
||||
[{oxinputhelp ident="D3_TOTP_QRCODE_HELP"}]
|
||||
</td>
|
||||
</tr>
|
||||
[{else}]
|
||||
<tr>
|
||||
<td class="edittext" colspan="2">
|
||||
<h4>[{oxmultilang ident="D3_TOTP_REGISTEREXIST"}]</h4>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="edittext">
|
||||
|
||||
</td>
|
||||
<td class="edittext">
|
||||
[{oxmultilang ident="D3_TOTP_REGISTERDELETE"}]<br>
|
||||
[{oxmultilang ident="D3_TOTP_REGISTERDELETE_DESC"}]
|
||||
</td>
|
||||
</tr>
|
||||
[{/if}]
|
||||
|
||||
[{/block}]
|
||||
</table>
|
||||
</td>
|
||||
<!-- Anfang rechte Seite -->
|
||||
<td valign="top" class="edittext" align="left" style="height:99%;padding-left:5px;padding-bottom:30px;padding-top:10px; width: 50%;">
|
||||
<table cellspacing="0" cellpadding="0" border="0">
|
||||
[{block name="user_d3user_totp_form2"}]
|
||||
[{if false == $totp->getId()}]
|
||||
<tr>
|
||||
<td class="edittext" colspan="2">
|
||||
<h4> </h4>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="edittext">
|
||||
<label for="secret">[{oxmultilang ident="D3_TOTP_SECRET"}]</label>
|
||||
@ -81,15 +111,6 @@
|
||||
[{oxinputhelp ident="D3_TOTP_CURROTP_HELP"}]
|
||||
</td>
|
||||
</tr>
|
||||
[{else}]
|
||||
<tr>
|
||||
<td class="edittext">
|
||||
|
||||
</td>
|
||||
<td class="edittext">
|
||||
neuen Zugang anlegen, alle bisherigen Zugännge werden damit ungültig
|
||||
</td>
|
||||
</tr>
|
||||
[{/if}]
|
||||
|
||||
[{/block}]
|
||||
@ -101,12 +122,6 @@
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<!-- Anfang rechte Seite -->
|
||||
<td valign="top" class="edittext" align="left" style="height:99%;padding-left:5px;padding-bottom:30px;padding-top:10px; width: 50%;">
|
||||
<table cellspacing="0" cellpadding="0" border="0">
|
||||
[{block name="user_d3user_totp_form2"}][{/block}]
|
||||
</table>
|
||||
</td>
|
||||
<!-- Ende rechte Seite -->
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -40,6 +40,7 @@ class d3_totp_LoginController extends d3_totp_LoginController_parent
|
||||
if ($auth
|
||||
&& $totp->UserUseTotp()
|
||||
&& false == Registry::getSession()->getVariable(d3totp::TOTP_SESSION_VARNAME)
|
||||
&& Registry::getSession()->hasVariable('pwdTransmit')
|
||||
) {
|
||||
// set auth as secured parameter;
|
||||
Registry::getSession()->setVariable("auth", $auth);
|
||||
|
@ -15,9 +15,124 @@
|
||||
|
||||
namespace D3\Totp\Setup;
|
||||
|
||||
use D3\ModCfg\Application\Model\d3database;
|
||||
use D3\ModCfg\Application\Model\Install\d3install_updatebase;
|
||||
use Doctrine\DBAL\DBALException;
|
||||
use OxidEsales\Eshop\Core\Exception\ConnectionException;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
|
||||
|
||||
class Installation extends d3install_updatebase
|
||||
{
|
||||
protected $_aUpdateMethods = array(
|
||||
array('check' => 'doesTotpTableNotExist',
|
||||
'do' => 'addTotpTable'),
|
||||
array('check' => 'checkFields',
|
||||
'do' => 'fixFields'),
|
||||
array('check' => 'checkIndizes',
|
||||
'do' => 'fixIndizes'),
|
||||
);
|
||||
|
||||
// Standardwerte für checkMultiLangTables() und fixRegisterMultiLangTables()
|
||||
public $aMultiLangTables = array();
|
||||
|
||||
public $aFields = array(
|
||||
'OXID' => array(
|
||||
'sTableName' => 'd3totp',
|
||||
'sFieldName' => 'OXID',
|
||||
'sType' => 'CHAR(32)',
|
||||
'blNull' => false,
|
||||
'sDefault' => false,
|
||||
'sComment' => '',
|
||||
'sExtra' => '',
|
||||
'blMultilang' => false,
|
||||
),
|
||||
'OXUSERID' => array(
|
||||
'sTableName' => 'd3totp',
|
||||
'sFieldName' => 'OXUSERID',
|
||||
'sType' => 'CHAR(32)',
|
||||
'blNull' => false,
|
||||
'sDefault' => false,
|
||||
'sComment' => '',
|
||||
'sExtra' => '',
|
||||
'blMultilang' => false,
|
||||
),
|
||||
'USETOTP' => array(
|
||||
'sTableName' => 'd3totp',
|
||||
'sFieldName' => 'USETOTP',
|
||||
'sType' => 'TINYINT(1)',
|
||||
'blNull' => false,
|
||||
'sDefault' => 0,
|
||||
'sComment' => '',
|
||||
'sExtra' => '',
|
||||
'blMultilang' => false,
|
||||
),
|
||||
'SEED' => array(
|
||||
'sTableName' => 'd3totp',
|
||||
'sFieldName' => 'SEED',
|
||||
'sType' => 'VARCHAR(256)',
|
||||
'blNull' => false,
|
||||
'sDefault' => false,
|
||||
'sComment' => '',
|
||||
'sExtra' => '',
|
||||
'blMultilang' => false,
|
||||
)
|
||||
);
|
||||
|
||||
public $aIndizes = array(
|
||||
'OXID' => array(
|
||||
'sTableName' => 'd3totp',
|
||||
'sType' => d3database::INDEX_TYPE_PRIMARY,
|
||||
'sName' => 'PRIMARY',
|
||||
'aFields' => array(
|
||||
'OXID' => 'OXID',
|
||||
),
|
||||
),
|
||||
'OXUSERID' => array(
|
||||
'sTableName' => 'd3totp',
|
||||
'sType' => d3database::INDEX_TYPE_UNIQUE,
|
||||
'sName' => 'OXUSERID',
|
||||
'aFields' => array(
|
||||
'OXUSERID' => 'OXUSERID',
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
protected $_aRefreshMetaModuleIds = array('d3ordermanager');
|
||||
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
*/
|
||||
public function doesTotpTableNotExist()
|
||||
{
|
||||
return $this->_checkTableNotExist('d3totp');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
* @throws ConnectionException
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
*/
|
||||
public function addTotpTable()
|
||||
{
|
||||
$blRet = false;
|
||||
if ($this->doesTotpTableNotExist()) {
|
||||
$this->setInitialExecMethod(__METHOD__);
|
||||
$blRet = $this->_addTable2(
|
||||
'd3totp',
|
||||
$this->aFields,
|
||||
$this->aIndizes,
|
||||
'totp setting',
|
||||
'InnoDB'
|
||||
);
|
||||
}
|
||||
|
||||
return $blRet;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user