Skip to content

Commit

Permalink
Dev Updated/missing translation in 2FA plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
c-schmitz committed Sep 29, 2021
1 parent 8433104 commit 3ef77d3
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 34 deletions.
Expand Up @@ -34,40 +34,40 @@ class TwoFactorAdminLogin extends AuthPluginBase
'type' => 'string',
'label' => 'Issuer',
'default' => 'LimeSurvey Survey Software',
'help' => 'Will be displayed in the app as issuer name.'
'help' => 'This will be displayed in the 2FA app as issuer name.'
),
'digits' => array(
'type' => 'string',
'label' => 'Digits (6 is needed for most tools)',
'label' => 'Code length',
'default' => '6',
'help' => 'The number of digits the resulting codes will be. Please leave it at 6 for Google-Authenticator.'
'help' => 'The number of digits the resulting codes will be. Leave it at 6 for best compatibility.'
),
'period' => array(
'type' => 'string',
'label' => 'Time period (30 is needed for most tools)',
'label' => 'Time period',
'default' => '30',
'help' => 'The number of seconds a code will be valid. Please leave it at 30 for Google-Authenticator.'
'help' => 'The number of seconds a code will be valid. Please leave it at 30 for best compatibility.'
),
'leeway' => array(
'type' => 'string',
'label' => 'Discrepancy',
'default' => '0',
'default' => '5',
'help' => 'What amount of discrepancy in seconds is allowed for the client.'
),
'algorithm' => array(
'type' => 'select',
'label' => 'Algorithm (SHA1 is needed for most tools)',
'label' => 'Algorithm',
'default' => 'sha1',
'options' => [
'sha1' => 'SHA1 (Default)',
'sha256 ' => 'SHA256',
'md5' => 'MD5',
],
'help' => 'The algorithm used, please keep in mind, that most tools only work with SHA1 hashing'
'help' => 'Please keep in mind, that most tools only work with SHA1 hashing.'
),
'force2fa' => array(
'type' => 'select',
'label' => 'Force 2FA',
'label' => 'Force 2FA on login',
'default' => '0',
'options' => [
'0 ' => 'No',
Expand All @@ -79,7 +79,6 @@ class TwoFactorAdminLogin extends AuthPluginBase

public function init()
{

//System events
$this->subscribe('direct');
$this->subscribe('newDirectRequest');
Expand All @@ -93,6 +92,7 @@ public function init()
$this->subscribe('afterLoginFormSubmit');
$this->subscribe('newUserSession');
}

//############## Plugin event handlers ##############//
/**
* Listen to direct requests
Expand Down Expand Up @@ -208,7 +208,7 @@ public function beforeAdminMenuRender()
$aMenuItemUserOptions = [
'isDivider' => false,
'isSmallText' => false,
'label' => '2FA-Setting',
'label' => gT('General'),
'href' => $this->api->createUrl('admin/pluginhelper/sa/fullpagewrapper/plugin/TwoFactorAdminLogin/method/userindex', []),
'iconClass' => 'fa fa-user-secret',
];
Expand All @@ -219,7 +219,7 @@ public function beforeAdminMenuRender()
$aMenuItemAdminOptions = [
'isDivider' => false,
'isSmallText' => false,
'label' => '2FA-Administration',
'label' => gT('Administration'),
'href' => $this->api->createUrl('admin/pluginhelper/sa/fullpagewrapper/plugin/TwoFactorAdminLogin/method/index', []),
'iconClass' => 'fa fa-users',
];
Expand All @@ -228,7 +228,7 @@ public function beforeAdminMenuRender()

$aNewMenuOptions = [
'isDropDown' => true,
'label' => '2-Factor-Settings',
'label' => gT('2FA settings'),
'href' => '#',
'menuItems' => $aMenuItems,
'iconClass' => 'fa fa-lock fa-lg',
Expand Down
Expand Up @@ -12,11 +12,11 @@ class TFAUser extends User
public function attributeLabels()
{
return [
'authType' => 'Type of 2-Factor-Authentication used',
'secretKey' => 'Authentication base value',
'authType' => gT('Two-factor authentication method'),
'secretKey' => gT('Secret base key'),
'uid' => gT('User ID'),
'firstLogin' => 'Logged in with 2FA',
'forceNewFirstLogin' => 'Force to set 2FA'
'firstLogin' => gT('Logged in with 2FA'),
'forceNewFirstLogin' => gT('Force to enable 2FA')
];
}

Expand Down
Expand Up @@ -40,13 +40,14 @@ public function primaryKey()
}

/** @inheritdoc */
public function attributeLabels() {
public function attributeLabels()
{
return [
'authType' => 'Type of 2-Factor-Authentication used',
'secretKey' => 'Authentication base value',
'authType' => gT('Two-factor authentication method'),
'secretKey' => gT('Secret base key'),
'uid' => gT('User ID'),
'firstLogin' => 'Logged in with 2FA',
'forceNewFirstLogin' => 'Force to set 2FA'
'firstLogin' => gT('Logged in with 2FA'),
'forceNewFirstLogin' => gT('Force to enable 2FA')
];
}

Expand Down
@@ -1,4 +1,3 @@

<div class="modal-header">
<h2>Register 2FA Method</h2>
</div>
Expand All @@ -7,28 +6,28 @@
<div class="row">
<div class="errorContainer"></div>
</div>
<?=TbHtml::formTb(null, App()->createUrl('plugins/direct', ['plugin' => 'TwoFactorAdminLogin', 'function' => 'directCallConfirmKey']), 'post', ["id"=>"TFA--modalform"])?>
<?php echo TbHtml::activeHiddenField($model,'uid'); ?>
<?=TbHtml::formTb(null, App()->createUrl('plugins/direct', ['plugin' => 'TwoFactorAdminLogin', 'function' => 'directCallConfirmKey']), 'post', ["id" => "TFA--modalform"])?>
<?php echo TbHtml::activeHiddenField($model, 'uid'); ?>
<div class="row ls-space margin bottom-5 top-5">
<?php echo TbHtml::activeLabel($model, 'authType'); ?>
<?php echo TbHtml::activeDropDownList($model,'authType', TFAUserKey::$authTypeOptions, [
<?php echo TbHtml::activeDropDownList($model, 'authType', TFAUserKey::$authTypeOptions, [
'required' => true
]); ?>
</div>
<div class="row ls-space margin bottom-5 top-5">
<?php echo TbHtml::activeLabel($model,'secretKey'); ?>
<?php echo TbHtml::activeTextField($model,'secretKey', ['readonly' => true]); ?>
<?php echo TbHtml::activeLabel($model, 'secretKey'); ?>
<?php echo TbHtml::activeTextField($model, 'secretKey', ['readonly' => true]); ?>
</div>
<div class="row ls-space margin bottom-5 top-5">
<label class="col-sm-12 ls-space margin bottom-5">QR-Code to be scanned:</label>
<label class="col-sm-12 ls-space margin bottom-5"><?php eT('QR code'); ?></label>
<div class="col-sm-6 col-sm-offset-3"><?=$sQRCodeContent?></div>
</div>
<div class="row ls-space margin bottom-5 top-5">
<?php echo TbHtml::label('confirmationKey', 'Confirmation key' ); ?>
<?php echo TbHtml::textField('confirmationKey', null,['required' => true]); ?>
<?php echo TbHtml::label(gt('Confirmation key'), 'confirmationKey'); ?>
<?php echo TbHtml::textField('confirmationKey', null, ['required' => true]); ?>
</div>
<div class="row ls-space margin bottom-5 top-5">
<button class="btn btn-success ls-space margin left-5" id="TFA--submitform"> Create 2FA binding </button>
<button class="btn btn-success ls-space margin left-5" id="TFA--submitform"><?php eT('Confirm & save'); ?></button>
<button class="btn btn-error ls-space margin left-5" id="TFA--cancelform"> <?=gT('Cancel')?> </button>
</div>
</form>
Expand Down
Expand Up @@ -42,8 +42,8 @@
class="btn btn-default TFA--actionconfirm"
data-href="<?=App()->createUrl("plugins/direct/plugin/TwoFactorAdminLogin/function/directCallDeleteKey")?>"
id="TFA--unset2fa"
data-confirmtext="<?=gT('Are you sure you want to delete your 2FA key?')?>"
data-buttons="{confirm_cancel: '<?=gT('No, cancel')?>', confirm_ok: '<?=gT('Yes, I am sure')?>'}"
data-confirmtext="<?=gT('Are you sure you want to disable two-factor authentication (2FA) for your account?')?>"
data-buttons='{"confirm_cancel": "<?=gT('No, cancel', 'js')?>", "confirm_ok": "<?=gT('Yes, I am sure', 'js')?>"}'
data-uid="<?=$oTFAModel->uid?>"
data-errortext="<?=gT('An error has occurred, and the key could not be deleted.')?>"
><?=gT("Remove 2FA")?></a>
Expand Down

0 comments on commit 3ef77d3

Please sign in to comment.