add cancel login action to login dialog, add translations

This commit is contained in:
Daniel Seifert 2018-10-20 23:20:23 +02:00
parent 57de2aabce
commit 644ceaeca3
7 changed files with 52 additions and 5 deletions

View File

@ -74,7 +74,7 @@ class d3user_totp extends AdminDetailsController
/** @var d3_totp_user $oUser */ /** @var d3_totp_user $oUser */
$oUser = oxNew(User::class); $oUser = oxNew(User::class);
if (false == $oUser->d3CheckPasswordPass($this->getEditObjectId(), $pwd)) { if (false == $oUser->d3CheckPasswordPass($this->getEditObjectId(), $pwd)) {
$oException = oxNew(StandardException::class, 'EXCEPTION_USER_PASSWORDDONTPASS'); $oException = oxNew(StandardException::class, 'D3_TOTP_ERROR_PWDONTPASS');
throw $oException; throw $oException;
} }

View File

@ -13,7 +13,15 @@
[{oxmultilang ident="TOTP_INPUT_HELP"}] [{oxmultilang ident="TOTP_INPUT_HELP"}]
--Anmeldung abbrechen-- [{* prevent cancel button (1st button) action when form is sent via Enter key *}]
<input type="submit" style="display:none !important;">
<input class="btn btn_cancel" value="[{oxmultilang ident="TOTP_CANCEL_LOGIN"}]" type="submit"
onclick="document.getElementById('login').fnc.value='d3CancelLogin'; document.getElementById('login').submit();"
>
[{oxstyle include=$oViewConf->getModuleUrl('d3totp', 'out/admin/src/css/d3totplogin.css')}]
[{oxstyle}]
[{else}] [{else}]
[{$smarty.block.parent}] [{$smarty.block.parent}]
[{/if}] [{/if}]

View File

@ -21,7 +21,8 @@ $aLang = [
'charset' => 'UTF-8', 'charset' => 'UTF-8',
'TOTP_INPUT' => 'Authentisierungscode', 'TOTP_INPUT' => 'Authentisierungscode',
'TOTP_INPUT_HELP' => 'Den Authentisierungscode erhalten Sie von der Zweifaktorauthentisierung-App auf Ihrem Gerät.', 'TOTP_INPUT_HELP' => 'Das Einmalpasswort erhalten Sie von der Zweifaktorauthentisierung-App auf Ihrem Gerät.',
'TOTP_CANCEL_LOGIN' => 'Anmeldung abbrechen',
'd3mxuser_totp' => '2-Faktor-Authentisierung', 'd3mxuser_totp' => '2-Faktor-Authentisierung',
@ -40,4 +41,5 @@ $aLang = [
'D3_TOTP_REGISTERDELETE_DESC' => 'Das Konto ist dann nicht mehr durch die Zweifaktorauthtisierung geschützt.', 'D3_TOTP_REGISTERDELETE_DESC' => 'Das Konto ist dann nicht mehr durch die Zweifaktorauthtisierung geschützt.',
'D3_TOTP_ERROR_UNVALID' => 'Das Einmalpasswort ist ungültig.', 'D3_TOTP_ERROR_UNVALID' => 'Das Einmalpasswort ist ungültig.',
'D3_TOTP_ERROR_PWDONTPASS' => 'Das Passwort passt nicht zum gewählten Benutzerkonto.',
]; ];

View File

@ -22,6 +22,24 @@ $aLang = [
'TOTP_INPUT' => 'authentication code', 'TOTP_INPUT' => 'authentication code',
'TOTP_INPUT_HELP' => 'The authentication code is available from the Two-Factor Authentication app on your device.', 'TOTP_INPUT_HELP' => 'The authentication code is available from the Two-Factor Authentication app on your device.',
'TOTP_CANCEL_LOGIN' => 'Cancel login',
'd3mxuser_totp' => 'Two-factor authentication', 'd3mxuser_totp' => 'Two-factor authentication',
'D3_TOTP_REGISTERNEW' => 'create new registration',
'D3_TOTP_QRCODE' => 'QR code',
'D3_TOTP_QRCODE_HELP' => 'Scan this QR code with your authentication app to deposit this user account.',
'D3_TOTP_SECRET' => 'Can not scan QR code?',
'D3_TOTP_SECRET_HELP' => 'If you do not use an app that can scan the QR code, you can also copy this string into your authentication tool. Please also set the password length to 6 characters and the time interval to 30 seconds.',
'D3_TOTP_CURRPWD' => 'Login password of the user account',
'D3_TOTP_CURRPWD_HELP' => 'The character string is stored encrypted in the shop. To encrypt, the password of the selected customer account is required. Concurrently, this ensures that only authorized users can make changes to these settings.',
'D3_TOTP_CURROTP' => 'Confirmation with one-time password',
'D3_TOTP_CURROTP_HELP' => 'If you have registered this customer account in your authentication app, you generate a one-time password, enter it here and send the form out immediately.',
'D3_TOTP_REGISTEREXIST' => 'existing registration',
'D3_TOTP_REGISTERDELETE' => 'Delete registration',
'D3_TOTP_REGISTERDELETE_DESC' => 'The account is then no longer protected by the two-factor authentication.',
'D3_TOTP_ERROR_UNVALID' => 'The one-time password is invalid.',
'D3_TOTP_ERROR_PWDONTPASS' => 'The password does not match the selected user account.',
]; ];

View File

@ -18,6 +18,7 @@ namespace D3\Totp\Modules\Application\Controller\Admin;
use D3\Totp\Application\Model\d3totp; use D3\Totp\Application\Model\d3totp;
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 OxidEsales\Eshop\Application\Model\User;
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException; use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
use OxidEsales\Eshop\Core\Registry; use OxidEsales\Eshop\Core\Registry;
@ -106,4 +107,10 @@ class d3_totp_LoginController extends d3_totp_LoginController_parent
$sTotp && $totp->verify($sTotp) $sTotp && $totp->verify($sTotp)
); );
} }
public function d3CancelLogin()
{
$oUser = oxNew(User::class);
$oUser->logout();
}
} }

View File

@ -36,7 +36,7 @@ $sModuleId = 'd3totp';
$aModule = [ $aModule = [
'id' => $sModuleId, 'id' => $sModuleId,
'title' => 'title' =>
(class_exists(d3utils::class) ? d3utils::getInstance()->getD3Logo() : 'D&sup3;') . ' Zwei-Faktor-Authentisierung', (class_exists(d3utils::class) ? d3utils::getInstance()->getD3Logo() : 'D&sup3;') . ' Zwei-Faktor-Authentisierung / two-factor authentication',
'description' => [ 'description' => [
'de' => 'Zwei-Faktor-Authentisierung (TOTP) f&uuml;r OXID eSales Shop', 'de' => 'Zwei-Faktor-Authentisierung (TOTP) f&uuml;r OXID eSales Shop',
'en' => 'Two-factor authentication (TOTP) for OXID eSales shop', 'en' => 'Two-factor authentication (TOTP) for OXID eSales shop',

View File

@ -0,0 +1,12 @@
#login {
display: flex;
flex-flow: column;
}
#login .btn {
order: 1;
}
#login .btn.btn_cancel {
order: 2;
background: lightblue;
color: black;
}