Skip to content

Commit

Permalink
Wording and Screenshots
Browse files Browse the repository at this point in the history
  • Loading branch information
luke- committed Feb 9, 2021
1 parent acdcaa2 commit 7375d22
Show file tree
Hide file tree
Showing 18 changed files with 58 additions and 73 deletions.
8 changes: 5 additions & 3 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
Changelog
=========

0.0.1 - Unreleased
----------------------
1.0.0 (February 9, 2021)
------------------------
- Enh: Initial release
- Init: Default driver to send code by e-mail
- Enh: Driver "Google Authenticator"
- Enh: Require pin code before enabling Google Authenticator
- Enh: Require pin code before enabling Google Authenticator

2 changes: 2 additions & 0 deletions docs/DEVELOPER.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Developer

## Individual Drivers

New driver should be extended from `humhub\modules\twofa\drivers\BaseDriver` in the folder `drivers`.

Also new created driver should be added into array `humhub\modules\twofa\Module->drivers`:
Expand Down
26 changes: 0 additions & 26 deletions docs/MANUAL.md

This file was deleted.

16 changes: 7 additions & 9 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
# Two-Factor Authentication
# Two-Factor Authentication (2FA)

The two-factor authentication modules allows users to select additional checking on log in by random generated code that may be sent by selected driver like E-mail.
Increase security within your network by adding an additional authentication method besides username and password.

** Available drivers:**
**Available methods:**

- E-mail
- Google Authenticator
- Email
- Time-based one-time passwords (e.g. Google Authenticator)

Some user groups may be enforced to always use 2FA.
Administrators can individually define which user groups are required to use an additional authentication method.
For administrators themselves, a second authentication method will be enabled by default.

Group "Administrator" is enforced by default.

Length of verifying code can be defined in the module configuration. Default is 6.
4 changes: 2 additions & 2 deletions drivers/EmailDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ class EmailDriver extends BaseDriver
public function init()
{
parent::init();
$this->name = Yii::t('TwofaModule.base', 'E-mail');
$this->info = Yii::t('TwofaModule.base', 'A confirmation code for this login has just been sent to your email address. Please enter the code from the e-mail in the field below.');
$this->name = Yii::t('TwofaModule.base', 'Email');
$this->info = Yii::t('TwofaModule.base', 'A confirmation code hast just been sent to your email address. Please enter the code from the email in order to proceed.');
}

/**
Expand Down
6 changes: 3 additions & 3 deletions drivers/GoogleAuthenticatorDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ public function renderUserSettings($params)
Yii::$app->getView()->registerJsConfig('twofa', [
'text' => [
'confirm.action.header' => Yii::t('TwofaModule.config', '<strong>Request</strong> new code'),
'confirm.action.question' => Yii::t('TwofaModule.config', 'Do you really want to request new code?') . '<br>'
. Yii::t('TwofaModule.config', 'Please <strong>don\'t forget</strong> to update new code in your Google Authenticator app, otherwise you will cannot log in!'),
'confirm.action.button' => Yii::t('TwofaModule.config', 'Request'),
'confirm.action.question' => Yii::t('TwofaModule.config', 'Do you really want to request a new code?') . '<br><br>'
. Yii::t('TwofaModule.config', 'Please <strong>do not forget</strong> to update the code in your authenticator app! If you do not do so, you will not be able to login.'),
'confirm.action.button' => Yii::t('TwofaModule.config', 'Request new code'),
]
]);

Expand Down
4 changes: 2 additions & 2 deletions models/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ public function rules()
public function attributeLabels()
{
return [
'enabledDrivers' => Yii::t('TwofaModule.config', 'Enabled drivers'),
'enabledDrivers' => Yii::t('TwofaModule.config', 'Enabled methods'),
'codeLength' => Yii::t('TwofaModule.config', 'Length of verifying code'),
'enforcedGroups' => Yii::t('TwofaModule.config', 'Enforced groups to use 2FA'),
'enforcedGroups' => Yii::t('TwofaModule.config', 'Mandatory for the following groups'),
];
}

Expand Down
2 changes: 1 addition & 1 deletion models/GoogleAuthenticatorUserSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function verifyPinCode($attribute, $params)
{
$driver = new GoogleAuthenticatorDriver();
if (!$driver->checkCode($this->pinCode, TwofaHelper::getSetting($driver::SECRET_TEMP_SETTING))) {
$this->addError($attribute, Yii::t('TwofaModule.base', 'Pin code is not valid!'));
$this->addError($attribute, Yii::t('TwofaModule.base', 'Code is not valid!'));
}
}

Expand Down
12 changes: 9 additions & 3 deletions module.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
{
"id": "twofa",
"name": "2-Factor Authentication",
"description": "Increase access security by using various 2FA methods like e-mail or TOPT.",
"name": "Two-Factor Authentication (2FA)",
"description": "Increase security by using 2FA methods like e-mail or TOPT.",
"keywords": [
"2fa",
"two-factor authentication"
],
"version": "0.9.0",
"homepage": "https://github.com/humhub/humhub-modules-twofa",
"screenshots": [
"resources/screen1.png",
"resources/screen2.png",
"resources/screen3.png"
],
"version": "1.0.0",
"humhub": {
"minVersion": "1.8"
}
Expand Down
Binary file added resources/screen1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/screen2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/screen3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 4 additions & 5 deletions views/check/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,20 @@
<div class="panel-heading"><?= Yii::t('TwofaModule.base', '<strong>Two-factor</strong> authentication'); ?></div>
<div class="panel-body">

<?php $form = ActiveForm::begin(); ?>
<?php $form = ActiveForm::begin(['enableClientValidation' => false]); ?>

<?php $driver->beforeCheckCodeFormInput($form, $model); ?>

<br />
<br/>

<?= $form->field($model, 'code')->textInput(); ?>

<br />

<?= Button::danger(Yii::t('TwofaModule.base', 'Log out'))->link(Url::toRoute('/user/auth/logout'))->right()->pjax(false) ?>
<br/>

<?= Html::submitButton(Yii::t('TwofaModule.base', 'Verify'), ['class' => 'btn btn-primary', 'data-ui-loader' => ""]); ?>

<?php ActiveForm::end(); ?>
<?= Html::a(Yii::t('TwofaModule.base', 'Log out'), ['/user/auth/logout'], ['class' => 'pull-right', 'data-pjax' => false]) ?>

</div>
</div>
Expand Down
32 changes: 18 additions & 14 deletions views/config/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,28 @@
<div class="panel-body">
<?php $form = ActiveForm::begin(['id' => 'configure-form']); ?>

<div id="disabledDriversInfo" class="alert alert-warning"<?= empty($model->enabledDrivers) ? '' : ' style="display:none"' ?>>
<i class="fa fa-info-circle"></i> <?= Yii::t('TwofaModule.config', 'This module is disabled because no drivers are selected, however users from the enforced groups always fallback to {defaultDriverName} driver by default.', [
'defaultDriverName' => $defaultDriverName
]) ?>
</div>
<div id="disabledDriversInfo"
class="alert alert-warning"<?= empty($model->enabledDrivers) ? '' : ' style="display:none"' ?>>
<i class="fa fa-info-circle"></i> <?= Yii::t('TwofaModule.config', 'This module is disabled because no drivers are selected, however users from the enforced groups always fallback to {defaultDriverName} driver by default.', [
'defaultDriverName' => $defaultDriverName
]) ?>
</div>

<?= $form->field($model, 'enabledDrivers')->checkboxList($model->module->getDriversOptions(), [
'item' => array($model->module, 'renderDriverCheckboxItem')
]); ?>
<?= $form->field($model, 'enabledDrivers')->checkboxList($model->module->getDriversOptions(), [
'item' => array($model->module, 'renderDriverCheckboxItem')
]); ?>

<?= $form->field($model, 'enforcedGroups')->checkboxList($model->module->getGroupsOptions()); ?>
<div class="help-block"><?= Yii::t('TwofaModule.config', 'Users of the selected groups are enforced to {defaultDriverName} driver by default.', [
'defaultDriverName' => $defaultDriverName
]) ?></div>
<br/>

<?= $form->field($model, 'codeLength'); ?>
<?= $form->field($model, 'enforcedGroups')->checkboxList($model->module->getGroupsOptions()); ?>
<div class="help-block"><?= Yii::t('TwofaModule.config', 'By default, the method "{defaultDriverName}" is used.', [
'defaultDriverName' => $defaultDriverName
]) ?></div>

<?= Button::save()->submit() ?>
<br/>
<?= $form->field($model, 'codeLength'); ?>

<?= Button::save()->submit() ?>

<?php ActiveForm::end(); ?>
</div>
Expand Down
2 changes: 1 addition & 1 deletion views/config/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

<div class="panel-body">
<div class="help-block">
<?= Yii::t('TwofaModule.config', 'Two-factor authentication (2FA) provides an additional level of security for your account. Once enabled, you\'ll be prompted to enter a code in addition to entering your username and password to log in . This code is provided by the 2FA method you choose . '); ?>
<?= Yii::t('TwofaModule.config', 'Two-factor authentication (2FA) provides an additional level of security for your account. Once enabled, you will be prompted to enter a code in addition to entering your username and password.'); ?>
</div>
<br/>

Expand Down
2 changes: 1 addition & 1 deletion views/config/userGoogleAuthenticatorCode.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<div class="alert alert-default">
<p><strong><?= Yii::t('TwofaModule.config', 'Can\'t scan the code?'); ?></strong></p>
<br/>
<p><?= Yii::t('TwofaModule.config', 'To add the entry manually, provide the following details to the TOTP app (e.g. Google Authenticator).'); ?></p>
<p><?= Yii::t('TwofaModule.config', 'To connect the app manually, provide the following details to the TOTP app (e.g. Google Authenticator).'); ?></p>
<br/>
<p>
<?= Yii::t('TwofaModule.config', 'Account:'); ?> <?= TwofaHelper::getAccountName() ?><br>
Expand Down
4 changes: 2 additions & 2 deletions views/mails/VerifyingCode.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,15 @@

<tr>
<td style="font-size: 14px; line-height: 22px; font-family: <?= Yii::$app->view->theme->variable('mail-font-family', DefaultMailStyle::DEFAULT_FONT_FAMILY) ?>; color: <?= Yii::$app->view->theme->variable('text-color-main', '#777') ?>; font-weight: 300; text-align: left; ">

<?= Yii::t('TwofaModule.base', 'Hello {displayName}!', ['{displayName}' => Html::encode($user->displayName)]) ?>
<br><br>
<?= Yii::t('TwofaModule.base', 'In this email you will receive the verification code to continue the current login. This is necessary because your account is additionally secured by two-factor authentication.'); ?>
<?= Yii::t('TwofaModule.base', 'Your account is secured by a two-factor authentication system. Please use the following code to proceed.'); ?>
<br><br>

<strong><?= Yii::t('TwofaModule.base', 'Date and time:'); ?></strong><br/>
<?= Yii::$app->formatter->asDatetime(time()); ?><br/>
<br/>

<strong><?= Yii::t('TwofaModule.base', 'Code:'); ?></strong><br/>
<div style="font-size:30px;line-height:36px;font-weight:bold;color:<?= $colorPrimary ?>"><?= $code ?></div>
</td>
Expand Down
2 changes: 1 addition & 1 deletion views/mails/plaintext/VerifyingCode.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<?= Yii::t('TwofaModule.base', 'Hello {displayName}!', ['{displayName}' => Html::encode($user->displayName)]) ?>


<?= Yii::t('TwofaModule.base', 'In this email you will receive the verification code to continue the current login. This is necessary because your account is additionally secured by two-factor authentication.'); ?>
<?= Yii::t('TwofaModule.base', 'Your account is secured by a two-factor authentication system. Please use the following code to proceed.'); ?>


<?= Yii::t('TwofaModule.base', 'Date and time:'); ?> <?= Yii::$app->formatter->asDatetime(time()); ?>
Expand Down

0 comments on commit 7375d22

Please sign in to comment.