From 91d110e1e72d7f29b028fc88fac1f4c1be4e6226 Mon Sep 17 00:00:00 2001 From: Antonio Cordeddu Date: Sat, 9 Jul 2022 19:10:00 +0200 Subject: [PATCH 01/10] 2fa by email and by sms --- composer.json | 3 +- src/User/Bootstrap.php | 36 ++++++ src/User/Controller/SecurityController.php | 25 +++- src/User/Controller/SettingsController.php | 91 +++++++++++--- src/User/Event/MailEvent.php | 1 + src/User/Factory/MailFactory.php | 22 ++++ src/User/Form/LoginForm.php | 26 ++-- ..._add_auth_tf_type_column_to_user_table.php | 27 +++++ ...h_tf_mobile_phone_column_to_user_table.php | 25 ++++ src/User/Model/User.php | 24 +++- src/User/Module.php | 8 ++ .../TwoFactorEmailCodeGeneratorService.php | 61 ++++++++++ .../TwoFactorSmsCodeGeneratorService.php | 79 +++++++++++++ src/User/Validator/TwoFactorCodeValidator.php | 50 ++++++++ .../Validator/TwoFactorEmailValidator.php | 111 ++++++++++++++++++ .../TwoFactorTextMessageValidator.php | 102 ++++++++++++++++ src/User/resources/i18n/ca/usuario.php | 14 +++ src/User/resources/i18n/da/usuario.php | 14 +++ src/User/resources/i18n/de-DU/usuario.php | 15 +++ src/User/resources/i18n/de/usuario.php | 17 +++ src/User/resources/i18n/es/usuario.php | 15 +++ src/User/resources/i18n/et/usuario.php | 15 +++ src/User/resources/i18n/fa-IR/usuario.php | 14 +++ src/User/resources/i18n/fi/usuario.php | 14 +++ src/User/resources/i18n/fr/usuario.php | 15 +++ src/User/resources/i18n/hr/usuario.php | 14 +++ src/User/resources/i18n/hu/usuario.php | 15 +++ src/User/resources/i18n/it/usuario.php | 18 ++- src/User/resources/i18n/kk/usuario.php | 14 +++ src/User/resources/i18n/lt/usuario.php | 14 +++ src/User/resources/i18n/nl/usuario.php | 15 +++ src/User/resources/i18n/pl/usuario.php | 15 +++ src/User/resources/i18n/pt-BR/usuario.php | 15 +++ src/User/resources/i18n/pt-PT/usuario.php | 15 +++ src/User/resources/i18n/ro/usuario.php | 15 +++ src/User/resources/i18n/ru/usuario.php | 15 +++ src/User/resources/i18n/th/usuario.php | 14 +++ src/User/resources/i18n/tr-TR/usuario.php | 14 +++ src/User/resources/i18n/uk/usuario.php | 15 +++ src/User/resources/i18n/vi/usuario.php | 14 +++ src/User/resources/i18n/zh-CN/usuario.php | 14 +++ .../views/mail/text/twofactorcode.php | 22 ++++ .../resources/views/mail/twofactorcode.php | 27 +++++ src/User/resources/views/security/confirm.php | 1 - src/User/resources/views/settings/account.php | 88 +++++++++++--- .../views/settings/two-factor-email.php | 35 ++++++ .../views/settings/two-factor-sms.php | 68 +++++++++++ 47 files changed, 1253 insertions(+), 48 deletions(-) create mode 100644 src/User/Migration/m000000_000010_add_auth_tf_type_column_to_user_table.php create mode 100644 src/User/Migration/m000000_000011_add_auth_tf_mobile_phone_column_to_user_table.php create mode 100644 src/User/Service/TwoFactorEmailCodeGeneratorService.php create mode 100644 src/User/Service/TwoFactorSmsCodeGeneratorService.php create mode 100644 src/User/Validator/TwoFactorEmailValidator.php create mode 100644 src/User/Validator/TwoFactorTextMessageValidator.php create mode 100644 src/User/resources/views/mail/text/twofactorcode.php create mode 100644 src/User/resources/views/mail/twofactorcode.php create mode 100644 src/User/resources/views/settings/two-factor-email.php create mode 100644 src/User/resources/views/settings/two-factor-sms.php diff --git a/composer.json b/composer.json index 0ce8891..d7f1639 100644 --- a/composer.json +++ b/composer.json @@ -45,7 +45,8 @@ "yiisoft/yii2-authclient": "^2.1", "yiisoft/yii2-httpclient": "^2.0", "yiisoft/yii2-bootstrap": "^2.0", - "yiisoft/yii2-swiftmailer": "^2.0" + "yiisoft/yii2-swiftmailer": "^2.0", + "yetopen/yii2-sms-sender-interface": "^0.1.1" }, "suggest": { "2amigos/2fa-library": "Needed if you want to enable 2 Factor Authentication. Require version ^1.0", diff --git a/src/User/Bootstrap.php b/src/User/Bootstrap.php index 07a8d92..3bfcc41 100644 --- a/src/User/Bootstrap.php +++ b/src/User/Bootstrap.php @@ -162,6 +162,37 @@ class Bootstrap implements BootstrapInterface }); } + // Initialize array of two factor authentication validators available + if(is_null(Yii::$app->getModule('user')->twoFactorAuthenticationValidators)){ + Yii::$app->getModule('user')->twoFactorAuthenticationValidators=[ + 'google-authenticator'=>[ + 'class'=>\Da\User\Validator\TwoFactorCodeValidator::class, + 'description'=>Yii::t('usuario', 'Google Authenticator'), + 'configurationUrl'=>'user/settings/two-factor' + ], + 'email'=>[ + 'class'=>\Da\User\Validator\TwoFactorEmailValidator::class, + 'description'=>Yii::t('usuario', 'Email'), + 'configurationUrl'=>'user/settings/two-factor-email', + // Time duration of the code in seconds + 'codeDurationTime'=>300 + ], + 'sms'=>[ + 'class'=>\Da\User\Validator\TwoFactorTextMessageValidator::class, + 'description'=>Yii::t('usuario', 'Text message'), + 'configurationUrl'=>'user/settings/two-factor-sms', + // component for sending sms + 'smsSender'=>'smsSender', + // Time duration of the code in seconds + 'codeDurationTime'=>300 + ] + ]; + + } + + + + if ($app instanceof WebApplication) { // override Yii $di->set( @@ -173,6 +204,11 @@ class Bootstrap implements BootstrapInterface ] ); } + + + + + } catch (Exception $e) { die($e); } diff --git a/src/User/Controller/SecurityController.php b/src/User/Controller/SecurityController.php index 133dcb0..d995bd2 100644 --- a/src/User/Controller/SecurityController.php +++ b/src/User/Controller/SecurityController.php @@ -20,6 +20,9 @@ use Da\User\Service\SocialNetworkAccountConnectService; use Da\User\Service\SocialNetworkAuthenticateService; use Da\User\Traits\ContainerAwareTrait; use Da\User\Traits\ModuleAwareTrait; +use Da\User\Validator\TwoFactorEmailValidator; +use Da\User\Validator\TwoFactorTextMessageValidator; +use Da\User\Model\User; use Yii; use yii\authclient\AuthAction; use yii\base\InvalidConfigException; @@ -30,6 +33,7 @@ use yii\filters\VerbFilter; use yii\web\Controller; use yii\web\Response; use yii\widgets\ActiveForm; +use yii\helpers\ArrayHelper; class SecurityController extends Controller { @@ -206,13 +210,30 @@ class SecurityController extends Controller return $this->goBack(); } - } + } + else{ + $module = Yii::$app->getModule('user'); + $validators = $module->twoFactorAuthenticationValidators; + $credentials=Yii::$app->session->get('credentials'); + $login= $credentials['login']; + $user = User::findOne(['email'=>$login]); + if( $user==null) + $user = User::findOne(['username'=>$login]); + $tfType = $user->getAuthTfType(); + + $class = ArrayHelper::getValue($validators,$tfType.'.class'); + $object = $this + ->make($class, [$user, null, $this->module->twoFactorAuthenticationCycles]); + $object->generateCode(); + + } + return $this->render( 'confirm', [ 'model' => $form, - 'module' => $this->module, + 'module' => $this->module ] ); } diff --git a/src/User/Controller/SettingsController.php b/src/User/Controller/SettingsController.php index 3b0aef3..764389d 100644 --- a/src/User/Controller/SettingsController.php +++ b/src/User/Controller/SettingsController.php @@ -28,10 +28,14 @@ use Da\User\Query\SocialNetworkAccountQuery; use Da\User\Query\UserQuery; use Da\User\Service\EmailChangeService; use Da\User\Service\TwoFactorQrCodeUriGeneratorService; +use Da\User\Service\TwoFactorEmailCodeGeneratorService; +use Da\User\Service\TwoFactorSmsCodeGeneratorService; use Da\User\Traits\ContainerAwareTrait; use Da\User\Traits\ModuleAwareTrait; use Da\User\Validator\AjaxRequestModelValidator; use Da\User\Validator\TwoFactorCodeValidator; +use Da\User\Validator\TwoFactorEmailValidator; +use Da\User\Validator\TwoFactorTextMessageValidator; use Yii; use yii\base\DynamicModel; use yii\filters\AccessControl; @@ -111,7 +115,8 @@ class SettingsController extends Controller 'delete', 'two-factor', 'two-factor-enable', - 'two-factor-disable' + 'two-factor-disable', + 'two-factor-mobile-phone' ], 'roles' => ['@'], ], @@ -348,7 +353,7 @@ class SettingsController extends Controller public function actionConfirm($id, $code) { $user = $this->userQuery->whereId($id)->one(); - + if ($user === null || MailChangeStrategyInterface::TYPE_INSECURE === $this->module->emailChangeStrategy) { throw new NotFoundHttpException(); } @@ -400,16 +405,31 @@ class SettingsController extends Controller public function actionTwoFactor($id) { - /** @var User $user */ + $choice=Yii::$app->request->post('choice'); + /** + * @var User $user + */ $user = $this->userQuery->whereId($id)->one(); if (null === $user) { throw new NotFoundHttpException(); } - - $uri = $this->make(TwoFactorQrCodeUriGeneratorService::class, [$user])->run(); - - return $this->renderAjax('two-factor', ['id' => $id, 'uri' => $uri]); + + switch($choice) + { + case 'google-authenticator': + $uri = $this->make(TwoFactorQrCodeUriGeneratorService::class, [$user])->run(); + return $this->renderAjax('two-factor', ['id' => $id, 'uri' => $uri]); + case 'email': + $emailCode = $this->make(TwoFactorEmailCodeGeneratorService::class, [$user])->run(); + return $this->renderAjax('two-factor-email', ['id' => $id, 'code' => $emailCode]); + case 'sms': + // get mobile phone, if exists + $mobilePhone=$user->getAuthTfMobilePhone(); + $smsCode = $this->make(TwoFactorSmsCodeGeneratorService::class, [$user])->run(); + return $this->renderAjax('two-factor-sms', ['id' => $id, 'code' => $smsCode, 'mobilePhone' => $mobilePhone] ); + } + } public function actionTwoFactorEnable($id) @@ -426,18 +446,22 @@ class SettingsController extends Controller ]; } $code = Yii::$app->request->get('code'); + $module = Yii::$app->getModule('user'); + $validators = $module->twoFactorAuthenticationValidators; + $choice = Yii::$app->request->get('choice'); + $codeDurationTime = ArrayHelper::getValue($validators,$choice.'.codeDurationTime', 0); + $class = ArrayHelper::getValue($validators,$choice.'.class'); - $success = $this - ->make(TwoFactorCodeValidator::class, [$user, $code, $this->module->twoFactorAuthenticationCycles]) - ->validate(); - - $success = $success && $user->updateAttributes(['auth_tf_enabled' => '1']); - + $object = $this + ->make($class, [$user, $code, $this->module->twoFactorAuthenticationCycles]); + $success = $object->validate(); + $success = $success && $user->updateAttributes(['auth_tf_enabled' => '1','auth_tf_type' => $choice]); + $message = $success + ? $object->getSuccessMessage():$object->getUnsuccessMessage($codeDurationTime); + return [ 'success' => $success, - 'message' => $success - ? Yii::t('usuario', 'Two factor authentication successfully enabled.') - : Yii::t('usuario', 'Verification failed. Please, enter new code.') + 'message' => $message ]; } @@ -488,4 +512,39 @@ class SettingsController extends Controller $account->delete(); $this->trigger(SocialNetworkConnectEvent::EVENT_AFTER_DISCONNECT, $event); } + + public function actionTwoFactorMobilePhone($id) + { + Yii::$app->response->format = Response::FORMAT_JSON; + + /** + * + * + * @var User $user + */ + $user = $this->userQuery->whereId($id)->one(); + + if (null === $user) { + return [ + 'success' => false, + 'message' => Yii::t('usuario', 'User not found.') + ]; + } + $mobilePhone = Yii::$app->request->get('mobilephone'); + $currentMobilePhone = $user->getAuthTfMobilePhone(); + $success=false; + if($currentMobilePhone==$mobilePhone){ + $success=true; + }else{ + $success = $user->updateAttributes(['auth_tf_mobile_phone' => $mobilePhone]); + $this->make(TwoFactorSmsCodeGeneratorService::class, [$user])->run(); + } + + return [ + 'success' => $success, + 'message' => $success + ? Yii::t('usuario', 'Mobile phone number successfully enabled.') + : Yii::t('usuario', 'Mobile phone number not registered.'), + ]; + } } diff --git a/src/User/Event/MailEvent.php b/src/User/Event/MailEvent.php index 13e55b7..b16199a 100644 --- a/src/User/Event/MailEvent.php +++ b/src/User/Event/MailEvent.php @@ -27,6 +27,7 @@ class MailEvent extends Event const TYPE_RECOVERY = 'recovery'; const TYPE_CONFIRM = 'confirm'; const TYPE_RECONFIRM = 'reconfirm'; + const TYPE_TWOFACTORCODE = 'twofactorcode'; const EVENT_BEFORE_SEND_MAIL = 'beforeSendMail'; const EVENT_AFTER_SEND_MAIL = 'afterSendMail'; diff --git a/src/User/Factory/MailFactory.php b/src/User/Factory/MailFactory.php index 6cb7920..b0bd708 100644 --- a/src/User/Factory/MailFactory.php +++ b/src/User/Factory/MailFactory.php @@ -114,6 +114,28 @@ class MailFactory return static::makeMailerService(MailEvent::TYPE_RECONFIRM, $from, $to, $subject, 'reconfirmation', $params); } + /** + * @param User $user + * @param String $code + * + * @throws InvalidConfigException + * @return MailService + */ + public static function makeTwoFactorCodeMailerService(User $user, String $code) + { + /** @var Module $module */ + $module = Yii::$app->getModule('user'); + $to = $user->email; + + $from = $module->mailParams['fromEmail']; + $subject = $module->mailParams['reconfirmationMailSubject']; + $params = [ + 'code' => $code, + ]; + + return static::makeMailerService(MailEvent::TYPE_TWOFACTORCODE, $from, $to, $subject, 'twofactorcode', $params); + } + /** * Builds a MailerService. * diff --git a/src/User/Form/LoginForm.php b/src/User/Form/LoginForm.php index ca33b05..c3bbf7f 100644 --- a/src/User/Form/LoginForm.php +++ b/src/User/Form/LoginForm.php @@ -15,14 +15,19 @@ use Da\User\Helper\SecurityHelper; use Da\User\Model\User; use Da\User\Query\UserQuery; use Da\User\Traits\ModuleAwareTrait; +use Da\User\Traits\ContainerAwareTrait; use Da\User\Validator\TwoFactorCodeValidator; +use Da\User\Validator\TwoFactorEmailValidator; +use Da\User\Validator\TwoFactorTextMessageValidator; use Yii; use yii\base\InvalidParamException; use yii\base\Model; +use yii\helpers\ArrayHelper; class LoginForm extends Model { use ModuleAwareTrait; + use ContainerAwareTrait; /** * @var string login User's email or username @@ -107,14 +112,21 @@ class LoginForm extends Model 'twoFactorAuthenticationCodeValidate' => [ 'twoFactorAuthenticationCode', function ($attribute) { - if ($this->user === null || - !(new TwoFactorCodeValidator( - $this->user, - $this->twoFactorAuthenticationCode, - $this->module->twoFactorAuthenticationCycles - )) - ->validate()) { + + if ($this->user === null ) { $this->addError($attribute, Yii::t('usuario', 'Invalid two factor authentication code')); + }else{ + $module = Yii::$app->getModule('user'); + $validators = $module->twoFactorAuthenticationValidators; + $type = $this->user->auth_tf_type; + $class = ArrayHelper::getValue($validators,$type.'.class'); + $codeDurationTime = ArrayHelper::getValue($validators,$type.'.codeDurationTime', 0); + $validator = $this + ->make($class, [$this->user, $this->twoFactorAuthenticationCode, $this->module->twoFactorAuthenticationCycles]); + $success = $validator->validate(); + if (!$success) { + $this->addError($attribute, $validator->getUnsuccessLoginMessage($codeDurationTime)); + } } } ], diff --git a/src/User/Migration/m000000_000010_add_auth_tf_type_column_to_user_table.php b/src/User/Migration/m000000_000010_add_auth_tf_type_column_to_user_table.php new file mode 100644 index 0000000..57e8161 --- /dev/null +++ b/src/User/Migration/m000000_000010_add_auth_tf_type_column_to_user_table.php @@ -0,0 +1,27 @@ +addColumn('{{%user}}', 'auth_tf_type', $this->string(20)->after('auth_tf_enabled')); + } + + /** + * {@inheritdoc} + */ + public function safeDown() + { + $this->dropColumn('{{%user}}', 'auth_tf_type'); + } +} diff --git a/src/User/Migration/m000000_000011_add_auth_tf_mobile_phone_column_to_user_table.php b/src/User/Migration/m000000_000011_add_auth_tf_mobile_phone_column_to_user_table.php new file mode 100644 index 0000000..e35cf33 --- /dev/null +++ b/src/User/Migration/m000000_000011_add_auth_tf_mobile_phone_column_to_user_table.php @@ -0,0 +1,25 @@ +addColumn('{{%user}}', 'auth_tf_mobile_phone', $this->string(20)->after('auth_tf_type')); + } + + /** + * {@inheritdoc} + */ + public function safeDown() + { + $this->dropColumn('{{%user}}', 'auth_tf_mobile_phone'); + } +} diff --git a/src/User/Model/User.php b/src/User/Model/User.php index 3671c93..3ee70c0 100644 --- a/src/User/Model/User.php +++ b/src/User/Model/User.php @@ -44,6 +44,8 @@ use yii\web\IdentityInterface; * @property string $auth_key * @property string $auth_tf_key * @property int $auth_tf_enabled + * @property string $auth_tf_type + * @property string $auth_tf_mobile_phone * @property string $registration_ip * @property int $confirmed_at * @property int $blocked_at @@ -248,7 +250,9 @@ class User extends ActiveRecord implements IdentityInterface // two factor auth rules 'twoFactorSecretTrim' => ['auth_tf_key', 'trim'], 'twoFactorSecretLength' => ['auth_tf_key', 'string', 'max' => 16], - 'twoFactorEnabledNumber' => ['auth_tf_enabled', 'boolean'] + 'twoFactorEnabledNumber' => ['auth_tf_enabled', 'boolean'], + 'twoFactorTypeLength' => ['auth_tf_type', 'string', 'max' => 20], + 'twoFactorTypeLength' => ['auth_tf_mobile_phone', 'string', 'max' => 20], ]; } @@ -361,4 +365,22 @@ class User extends ActiveRecord implements IdentityInterface return $d->diff(new \DateTime(), true)->format("%a"); } + + /** + * Returns authentication two factor type enabled for the user + * @return integer + */ + public function getAuthTfType() + { + return $this->getAttribute('auth_tf_type'); + } + + /** + * Returns the mobile phone number used for sms authentication two factor for the user + * @return string + */ + public function getAuthTfMobilePhone() + { + return $this->getAttribute('auth_tf_mobile_phone'); + } } diff --git a/src/User/Module.php b/src/User/Module.php index f86c8da..2162085 100644 --- a/src/User/Module.php +++ b/src/User/Module.php @@ -81,11 +81,19 @@ class Module extends BaseModule * @var bool whether to enable two factor authentication or not */ public $enableTwoFactorAuthentication = false; + /** + * @var array list of channel for two factor authentication availables + */ + public $twoFactorAuthenticationValidators = null; /** * @var int cycles of key generation are set on 30 sec. To avoid sync issues, increased validity up to 60 sec. * @see http://2fa-library.readthedocs.io/en/latest/ */ public $twoFactorAuthenticationCycles = 1; + /** + * @var int the number of seconds for which the code sent by email or by mobile phone is valid + * */ + public $twoFactorEmailAuthenticationValidity = 300; /** * @var bool whether to allow auto login or not */ diff --git a/src/User/Service/TwoFactorEmailCodeGeneratorService.php b/src/User/Service/TwoFactorEmailCodeGeneratorService.php new file mode 100644 index 0000000..d946e2a --- /dev/null +++ b/src/User/Service/TwoFactorEmailCodeGeneratorService.php @@ -0,0 +1,61 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +namespace Da\User\Service; + +use Da\TwoFA\Manager; +use Da\User\Contracts\ServiceInterface; +use Da\User\Model\User; +use Da\User\Factory\MailFactory; + +use Yii; + +class TwoFactorEmailCodeGeneratorService implements ServiceInterface +{ + /** + * @var User + */ + protected $user; + + /** + * TwoFactorEmailCodeGeneratorService constructor. + * + * @param User $user + */ + public function __construct(User $user) + { + $this->user = $user; + } + + /** + * @inheritdoc + */ + public function run() + { + $user = $this->user; + if (!$user->auth_tf_key) { + $user->auth_tf_key = (new Manager())->generateSecretKey(); + $user->updateAttributes(['auth_tf_key']); + } + // generate key + $code = random_int(0, 999999); + $code = str_pad($code, 6, 0, STR_PAD_LEFT); + // send email + $mailService = MailFactory::makeTwoFactorCodeMailerService($user, $code); + $mailService->run(); + + // put key in session + Yii::$app->session->set("email_code_time", date('Y-m-d H:i:s')); + Yii::$app->session->set("email_code", $code); + + return $code; + } +} diff --git a/src/User/Service/TwoFactorSmsCodeGeneratorService.php b/src/User/Service/TwoFactorSmsCodeGeneratorService.php new file mode 100644 index 0000000..1bb63e1 --- /dev/null +++ b/src/User/Service/TwoFactorSmsCodeGeneratorService.php @@ -0,0 +1,79 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +namespace Da\User\Service; + +use Da\TwoFA\Manager; +use Da\User\Contracts\ServiceInterface; +use Da\User\Model\User; +use Da\User\Factory\MailFactory; +use yii\di\Instance; +use yetopen\smssender\SmsSenderInterface; +use yii\helpers\ArrayHelper; + +use Yii; + +class TwoFactorSmsCodeGeneratorService implements ServiceInterface +{ + /** + * @var User + */ + protected $user; + + /** + * @var Type + */ + protected $type; + + /** + * @var SmsSenderInterface + */ + protected $smsSender; + + /** + * TwoFactorSmsCodeGeneratorService constructor. + * + * @param User $user + */ + public function __construct(User $user) + { + $this->user = $user; + $this->type = 'sms'; + $module = Yii::$app->getModule('user'); + $validators = $module->twoFactorAuthenticationValidators; + $smsSender = ArrayHelper::getValue($validators,'sms'.'.smsSender'); + $this->smsSender = Instance::ensure($smsSender, SmsSenderInterface::class); + } + + /** + * @inheritdoc + */ + public function run() + { + // generate key + $code = random_int(0, 999999); + $code = str_pad($code, 6, 0, STR_PAD_LEFT); + // get the mobile phone of the user + $user = $this->user; + $mobilePhone=$user->getAuthTfMobilePhone(); + + if( !(null===$mobilePhone) && $mobilePhone!='' ){ + // send sms + $this->smsSender->send($mobilePhone, $code); + // put key in session + Yii::$app->session->set("sms_code_time", date('Y-m-d H:i:s')); + Yii::$app->session->set("sms_code", $code); + } + + return $code; + + } +} diff --git a/src/User/Validator/TwoFactorCodeValidator.php b/src/User/Validator/TwoFactorCodeValidator.php index 9308390..d90448c 100644 --- a/src/User/Validator/TwoFactorCodeValidator.php +++ b/src/User/Validator/TwoFactorCodeValidator.php @@ -15,9 +15,14 @@ use Da\TwoFA\Exception\InvalidSecretKeyException; use Da\TwoFA\Manager; use Da\User\Contracts\ValidatorInterface; use Da\User\Model\User; +use Da\User\Traits\ContainerAwareTrait; +use Da\User\Service\TwoFactorEmailCodeGeneratorService; +use Yii; class TwoFactorCodeValidator implements ValidatorInterface { + use ContainerAwareTrait; + protected $user; protected $code; protected $cycles; @@ -46,4 +51,49 @@ class TwoFactorCodeValidator implements ValidatorInterface $manager = new Manager(); return $manager->setCycles($this->cycles)->verify($this->code, $this->user->auth_tf_key); } + + /** + * @return bool + * + */ + public function isValidationCodeToBeSent() + { + return false; + } + + /** + * @return string + * + */ + public function getSuccessMessage() + { + return Yii::t('usuario', 'Two factor authentication successfully enabled.'); + } + + /** + * @return string + * + */ + public function getUnsuccessMessage($codeDurationTime) + { + return Yii::t('usuario', 'Verification failed. Please, enter new code.'); + } + + /** + * @return string + * + */ + public function getUnsuccessLoginMessage($codeDurationTime) + { + return Yii::t('usuario', 'Verification failed. Please, enter new code.'); + } + + /** + * @return string + * + */ + public function generateCode() + { + return $this->make(TwoFactorEmailCodeGeneratorService::class,[$this->user])->run(); + } } diff --git a/src/User/Validator/TwoFactorEmailValidator.php b/src/User/Validator/TwoFactorEmailValidator.php new file mode 100644 index 0000000..95d7238 --- /dev/null +++ b/src/User/Validator/TwoFactorEmailValidator.php @@ -0,0 +1,111 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +namespace Da\User\Validator; + +use Da\TwoFA\Exception\InvalidSecretKeyException; +use Da\User\Model\User; +use Yii; +use yii\helpers\ArrayHelper; +use Da\User\Traits\ContainerAwareTrait; +use Da\User\Service\TwoFactorEmailCodeGeneratorService; + + +class TwoFactorEmailValidator extends TwoFactorCodeValidator +{ + use ContainerAwareTrait; + + protected $user; + protected $code; + protected $cycles; + protected $type; + + /** + * TwoFactorCodeValidator constructor. + * + * @param User $user + * @param $code + * @param int $cycles + */ + public function __construct(User $user, $code, $cycles = 0) + { + $this->user = $user; + $this->code = $code; + $this->cycles = $cycles; + $this->type = 'email'; + } + + /** + * @throws InvalidSecretKeyException + * @return bool|int + * + */ + public function validate() + { + $emailCodeTime = new \DateTime(Yii::$app->session->get("email_code_time")); + $currentTime = new \DateTime('now'); + $interval = $currentTime->getTimestamp()-$emailCodeTime->getTimestamp(); + + $module = Yii::$app->getModule('user'); + $validators = $module->twoFactorAuthenticationValidators; + $codeDurationTime = ArrayHelper::getValue($validators,$this->type.'.codeDurationTime', 0); + + if($interval > $codeDurationTime ) + return false; + $emailCode = Yii::$app->session->get("email_code"); + return $this->code==$emailCode; + } + + /** + * @return bool + * + */ + public function isValidationCodeToBeSent() + { + return true; + } + + /** + * @return string + * + */ + public function getSuccessMessage() + { + return Yii::t('usuario', 'Two factor authentication successfully enabled.'); + } + + /** + * @return string + * + */ + public function getUnsuccessMessage($codeDurationTime) + { + return Yii::t('usuario', 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please close this window and repeat the enabling request.', [$codeDurationTime]); + } + + /** + * @return string + * + */ + public function getUnsuccessLoginMessage($codeDurationTime) + { + return Yii::t('usuario', 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please click on \'Cancel\' and repeat the login request.', [$codeDurationTime]); + } + + /** + * @return string + * + */ + public function generateCode() + { + return $this->make(TwoFactorEmailCodeGeneratorService::class,$this->user)->run(); + } +} diff --git a/src/User/Validator/TwoFactorTextMessageValidator.php b/src/User/Validator/TwoFactorTextMessageValidator.php new file mode 100644 index 0000000..4455b41 --- /dev/null +++ b/src/User/Validator/TwoFactorTextMessageValidator.php @@ -0,0 +1,102 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +namespace Da\User\Validator; + +use Da\TwoFA\Exception\InvalidSecretKeyException; +use Da\User\Model\User; +use Yii; +use yii\helpers\ArrayHelper; +use Da\User\Traits\ContainerAwareTrait; +use Da\User\Service\TwoFactorSmsCodeGeneratorService; + + +class TwoFactorTextMessageValidator extends TwoFactorCodeValidator +{ + use ContainerAwareTrait; + + protected $user; + protected $code; + protected $cycles; + + /** + * TwoFactorCodeValidator constructor. + * + * @param User $user + * @param $code + * @param int $cycles + */ + public function __construct(User $user, $code, $cycles = 0) + { + $this->user = $user; + + $this->code = $code; + $this->cycles = $cycles; + $this->type = 'sms'; + } + + /** + * @throws InvalidSecretKeyException + * @return bool|int + * + */ + public function validate() + { + $smsCodeTime = new \DateTime(Yii::$app->session->get("sms_code_time")); + $currentTime = new \DateTime('now'); + $interval = $currentTime->getTimestamp()-$smsCodeTime->getTimestamp(); + $module = Yii::$app->getModule('user'); + $validators = $module->twoFactorAuthenticationValidators; + $codeDurationTime = ArrayHelper::getValue($validators,$this->type.'.codeDurationTime', 0); + + if($interval > $codeDurationTime ) + return false; + $smsCode = Yii::$app->session->get("sms_code"); + return $this->code==$smsCode; + } + + /** + * @return string + * + */ + public function getSuccessMessage() + { + return Yii::t('usuario', 'Two factor authentication successfully enabled.'); + } + + /** + * @return string + * + */ + public function getUnsuccessMessage($codeDurationTime) + { + return Yii::t('usuario', 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please close this window and repeat the enabling request.', [$codeDurationTime]); + } + + /** + * @return string + * + */ + public function getUnsuccessLoginMessage($codeDurationTime) + { + return Yii::t('usuario', 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please click on \'Cancel\' and repeat the login request.', [$codeDurationTime]); + } + + /** + * @return string + * + */ + public function generateCode() + { + $object = $this->make(TwoFactorSmsCodeGeneratorService::class,[$this->user]); + return $object->run(); + } +} diff --git a/src/User/resources/i18n/ca/usuario.php b/src/User/resources/i18n/ca/usuario.php index 0776a37..843098b 100644 --- a/src/User/resources/i18n/ca/usuario.php +++ b/src/User/resources/i18n/ca/usuario.php @@ -109,6 +109,7 @@ return [ 'Finish' => '', 'Force password change at next login' => '', 'Forgot password?' => '', + 'Google Authenticator' => '', 'Gravatar email' => '', 'Hello' => '', 'Here you can download your personal data in a comma separated values format.' => '', @@ -120,6 +121,10 @@ return [ 'In order to complete your request, please click the link below' => '', 'In order to finish your registration, we need you to enter following fields' => '', 'Information' => '', + 'Insert' => '', + 'Insert the code you received by SMS.' => '', + 'Insert the code you received by email.' => '', + 'Insert the mobile phone number on which to receive text message.' => '', 'Invalid login or password' => '', 'Invalid or expired link' => '', 'Invalid password' => '', @@ -135,6 +140,9 @@ return [ 'Login' => '', 'Logout' => '', 'Manage users' => '', + 'Mobile phone number' => '', + 'Mobile phone number not registered.' => '', + 'Mobile phone number successfully enabled.' => '', 'Name' => '', 'Networks' => '', 'Never' => '', @@ -155,6 +163,8 @@ return [ 'Please be certain' => '', 'Please click the link below to complete your password reset' => '', 'Please fix following errors:' => '', + 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please click on \'Cancel\' and repeat the login request.' => '', + 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please close this window and repeat the enabling request.' => '', 'Privacy' => '', 'Privacy settings' => '', 'Profile' => '', @@ -191,6 +201,7 @@ return [ 'Something went wrong' => '', 'Submit' => '', 'Switch identities is disabled.' => '', + 'Text message' => '', 'Thank you for signing up on {0}' => '', 'Thank you, registration is now complete.' => '', 'The "recaptcha" component must be configured.' => '', @@ -200,6 +211,7 @@ return [ 'There was an error in saving user' => '', 'This account has already been connected to another user' => '', 'This email address has already been taken' => '', + 'This is the code to insert to enable two factor authentication' => '', 'This username has already been taken' => '', 'This will disable two factor authentication. Are you sure?' => '', 'This will remove your personal data from this site. You will no longer be able to sign in.' => '', @@ -207,6 +219,8 @@ return [ 'Time zone is not valid' => '', 'Two Factor Authentication (2FA)' => '', 'Two factor authentication code' => '', + 'Two factor authentication code by SMS' => '', + 'Two factor authentication code by email' => '', 'Two factor authentication has been disabled.' => '', 'Two factor authentication protects you in case of stolen credentials' => '', 'Two factor authentication successfully enabled.' => '', diff --git a/src/User/resources/i18n/da/usuario.php b/src/User/resources/i18n/da/usuario.php index 0776a37..843098b 100644 --- a/src/User/resources/i18n/da/usuario.php +++ b/src/User/resources/i18n/da/usuario.php @@ -109,6 +109,7 @@ return [ 'Finish' => '', 'Force password change at next login' => '', 'Forgot password?' => '', + 'Google Authenticator' => '', 'Gravatar email' => '', 'Hello' => '', 'Here you can download your personal data in a comma separated values format.' => '', @@ -120,6 +121,10 @@ return [ 'In order to complete your request, please click the link below' => '', 'In order to finish your registration, we need you to enter following fields' => '', 'Information' => '', + 'Insert' => '', + 'Insert the code you received by SMS.' => '', + 'Insert the code you received by email.' => '', + 'Insert the mobile phone number on which to receive text message.' => '', 'Invalid login or password' => '', 'Invalid or expired link' => '', 'Invalid password' => '', @@ -135,6 +140,9 @@ return [ 'Login' => '', 'Logout' => '', 'Manage users' => '', + 'Mobile phone number' => '', + 'Mobile phone number not registered.' => '', + 'Mobile phone number successfully enabled.' => '', 'Name' => '', 'Networks' => '', 'Never' => '', @@ -155,6 +163,8 @@ return [ 'Please be certain' => '', 'Please click the link below to complete your password reset' => '', 'Please fix following errors:' => '', + 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please click on \'Cancel\' and repeat the login request.' => '', + 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please close this window and repeat the enabling request.' => '', 'Privacy' => '', 'Privacy settings' => '', 'Profile' => '', @@ -191,6 +201,7 @@ return [ 'Something went wrong' => '', 'Submit' => '', 'Switch identities is disabled.' => '', + 'Text message' => '', 'Thank you for signing up on {0}' => '', 'Thank you, registration is now complete.' => '', 'The "recaptcha" component must be configured.' => '', @@ -200,6 +211,7 @@ return [ 'There was an error in saving user' => '', 'This account has already been connected to another user' => '', 'This email address has already been taken' => '', + 'This is the code to insert to enable two factor authentication' => '', 'This username has already been taken' => '', 'This will disable two factor authentication. Are you sure?' => '', 'This will remove your personal data from this site. You will no longer be able to sign in.' => '', @@ -207,6 +219,8 @@ return [ 'Time zone is not valid' => '', 'Two Factor Authentication (2FA)' => '', 'Two factor authentication code' => '', + 'Two factor authentication code by SMS' => '', + 'Two factor authentication code by email' => '', 'Two factor authentication has been disabled.' => '', 'Two factor authentication protects you in case of stolen credentials' => '', 'Two factor authentication successfully enabled.' => '', diff --git a/src/User/resources/i18n/de-DU/usuario.php b/src/User/resources/i18n/de-DU/usuario.php index 4feceab..db98447 100644 --- a/src/User/resources/i18n/de-DU/usuario.php +++ b/src/User/resources/i18n/de-DU/usuario.php @@ -275,7 +275,22 @@ return [ '{0} cannot be blank.' => '{0} darf nicht leer sein.', 'According to the European General Data Protection Regulation (GDPR) we need your consent to work with your personal data.' => '', 'Data privacy' => '', + 'Every user having your role has two factor authentication mandatory, you must enable it' => '', + 'Google Authenticator' => '', + 'Insert' => '', + 'Insert the code you received by SMS.' => '', + 'Insert the code you received by email.' => '', + 'Insert the mobile phone number on which to receive text message.' => '', + 'Mobile phone number' => '', + 'Mobile phone number not registered.' => '', + 'Mobile phone number successfully enabled.' => '', + 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please click on \'Cancel\' and repeat the login request.' => '', + 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please close this window and repeat the enabling request.' => '', 'Submit' => '', + 'Text message' => '', + 'This is the code to insert to enable two factor authentication' => '', + 'Two factor authentication code by SMS' => '', + 'Two factor authentication code by email' => '', 'Unfortunately, you can not work with this site without giving us consent to process your data.' => '', 'Your consent is required to work with this site' => '', 'A message has been sent to your email address. ' => '@@Eine Nachricht wurde an Deine E-Mail Adresse gesendet@@', diff --git a/src/User/resources/i18n/de/usuario.php b/src/User/resources/i18n/de/usuario.php index c4ab007..91f2e2b 100644 --- a/src/User/resources/i18n/de/usuario.php +++ b/src/User/resources/i18n/de/usuario.php @@ -277,4 +277,21 @@ return [ 'Submit' => 'Absenden', 'Unfortunately, you can not work with this site without giving us consent to process your data.' => 'Leider können Sie nicht mit dieser Seite arbeiten, ohne uns die Zustimmung zur Verarbeitung Ihrer Daten zu geben.', 'Your consent is required to work with this site' => 'Ihre Zustimmung ist erforderlich, um mit dieser Website zu arbeiten', + 'Every user having your role has two factor authentication mandatory, you must enable it' => '', + 'Google Authenticator' => '', + 'Information' => '', + 'Insert' => '', + 'Insert the code you received by SMS.' => '', + 'Insert the code you received by email.' => '', + 'Insert the mobile phone number on which to receive text message.' => '', + 'Mobile phone number' => '', + 'Mobile phone number not registered.' => '', + 'Mobile phone number successfully enabled.' => '', + 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please click on \'Cancel\' and repeat the login request.' => '', + 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please close this window and repeat the enabling request.' => '', + 'Text message' => '', + 'This is the code to insert to enable two factor authentication' => '', + 'Two factor authentication code by SMS' => '', + 'Two factor authentication code by email' => '', + 'Now you can resume the login process' => '@@@@', ]; diff --git a/src/User/resources/i18n/es/usuario.php b/src/User/resources/i18n/es/usuario.php index ea4ebc9..2cb4750 100644 --- a/src/User/resources/i18n/es/usuario.php +++ b/src/User/resources/i18n/es/usuario.php @@ -276,6 +276,21 @@ return [ 'privacy policy' => 'política de privacidad', '{0, date, MMMM dd, YYYY HH:mm}' => '{0, date, dd MMMM, YYYY HH:mm}', '{0} cannot be blank.' => '{0} no puede estar vacío.', + 'Every user having your role has two factor authentication mandatory, you must enable it' => '', + 'Google Authenticator' => '', + 'Insert' => '', + 'Insert the code you received by SMS.' => '', + 'Insert the code you received by email.' => '', + 'Insert the mobile phone number on which to receive text message.' => '', + 'Mobile phone number' => '', + 'Mobile phone number not registered.' => '', + 'Mobile phone number successfully enabled.' => '', + 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please click on \'Cancel\' and repeat the login request.' => '', + 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please close this window and repeat the enabling request.' => '', + 'Text message' => '', + 'This is the code to insert to enable two factor authentication' => '', + 'Two factor authentication code by SMS' => '', + 'Two factor authentication code by email' => '', 'Your consent is required to work with this site' => '', '{0, date, MMM dd, YYYY HH:mm}' => '', 'An email has been sent with instructions for resetting your password' => '@@Se ha enviado un correo electrónico con instrucciones para restablecer su contraseña@@', diff --git a/src/User/resources/i18n/et/usuario.php b/src/User/resources/i18n/et/usuario.php index 4d748bc..86bcfb7 100644 --- a/src/User/resources/i18n/et/usuario.php +++ b/src/User/resources/i18n/et/usuario.php @@ -268,8 +268,23 @@ return [ 'According to the European General Data Protection Regulation (GDPR) we need your consent to work with your personal data.' => '', 'Authentication rule class {0} can not be instantiated' => '', 'Data privacy' => '', + 'Every user having your role has two factor authentication mandatory, you must enable it' => '', + 'Google Authenticator' => '', + 'Insert' => '', + 'Insert the code you received by SMS.' => '', + 'Insert the code you received by email.' => '', + 'Insert the mobile phone number on which to receive text message.' => '', + 'Mobile phone number' => '', + 'Mobile phone number not registered.' => '', + 'Mobile phone number successfully enabled.' => '', + 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please click on \'Cancel\' and repeat the login request.' => '', + 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please close this window and repeat the enabling request.' => '', 'Rule class must extend "yii\\rbac\\Rule".' => '', 'Submit' => '', + 'Text message' => '', + 'This is the code to insert to enable two factor authentication' => '', + 'Two factor authentication code by SMS' => '', + 'Two factor authentication code by email' => '', 'Unfortunately, you can not work with this site without giving us consent to process your data.' => '', 'VKontakte' => '', 'Yandex' => '', diff --git a/src/User/resources/i18n/fa-IR/usuario.php b/src/User/resources/i18n/fa-IR/usuario.php index f262beb..c93ed9a 100644 --- a/src/User/resources/i18n/fa-IR/usuario.php +++ b/src/User/resources/i18n/fa-IR/usuario.php @@ -192,9 +192,14 @@ return [ 'Error sending welcome message to "{email}". Please try again later.' => '', 'Export my data' => '', 'Force password change at next login' => '', + 'Google Authenticator' => '', 'Here you can download your personal data in a comma separated values format.' => '', 'Impersonate this user' => '', 'In order to finish your registration, we need you to enter following fields' => '', + 'Insert' => '', + 'Insert the code you received by SMS.' => '', + 'Insert the code you received by email.' => '', + 'Insert the mobile phone number on which to receive text message.' => '', 'Invalid password' => '', 'Invalid two factor authentication code' => '', 'Invalid value' => '', @@ -203,6 +208,9 @@ return [ 'Last login IP' => '', 'Last login time' => '', 'Last password change' => '', + 'Mobile phone number' => '', + 'Mobile phone number not registered.' => '', + 'Mobile phone number successfully enabled.' => '', 'Never' => '', 'New rule' => '', 'Not found' => '', @@ -210,6 +218,8 @@ return [ 'Once you have deleted your data, you will not longer be able to sign in with this account.' => '', 'Password age' => '', 'Please be certain' => '', + 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please click on \'Cancel\' and repeat the login request.' => '', + 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please close this window and repeat the enabling request.' => '', 'Privacy' => '', 'Privacy settings' => '', 'Registration on this website is disabled' => '', @@ -229,14 +239,18 @@ return [ 'Send password recovery email' => '', 'Submit' => '', 'Switch identities is disabled.' => '', + 'Text message' => '', 'The "recaptcha" component must be configured.' => '', 'The verification code is incorrect.' => '', 'There is neither role nor permission with name "{0}"' => '', 'There was an error in saving user' => '', + 'This is the code to insert to enable two factor authentication' => '', 'This will disable two factor authentication. Are you sure?' => '', 'This will remove your personal data from this site. You will no longer be able to sign in.' => '', 'Two Factor Authentication (2FA)' => '', 'Two factor authentication code' => '', + 'Two factor authentication code by SMS' => '', + 'Two factor authentication code by email' => '', 'Two factor authentication has been disabled.' => '', 'Two factor authentication protects you in case of stolen credentials' => '', 'Two factor authentication successfully enabled.' => '', diff --git a/src/User/resources/i18n/fi/usuario.php b/src/User/resources/i18n/fi/usuario.php index 0776a37..843098b 100644 --- a/src/User/resources/i18n/fi/usuario.php +++ b/src/User/resources/i18n/fi/usuario.php @@ -109,6 +109,7 @@ return [ 'Finish' => '', 'Force password change at next login' => '', 'Forgot password?' => '', + 'Google Authenticator' => '', 'Gravatar email' => '', 'Hello' => '', 'Here you can download your personal data in a comma separated values format.' => '', @@ -120,6 +121,10 @@ return [ 'In order to complete your request, please click the link below' => '', 'In order to finish your registration, we need you to enter following fields' => '', 'Information' => '', + 'Insert' => '', + 'Insert the code you received by SMS.' => '', + 'Insert the code you received by email.' => '', + 'Insert the mobile phone number on which to receive text message.' => '', 'Invalid login or password' => '', 'Invalid or expired link' => '', 'Invalid password' => '', @@ -135,6 +140,9 @@ return [ 'Login' => '', 'Logout' => '', 'Manage users' => '', + 'Mobile phone number' => '', + 'Mobile phone number not registered.' => '', + 'Mobile phone number successfully enabled.' => '', 'Name' => '', 'Networks' => '', 'Never' => '', @@ -155,6 +163,8 @@ return [ 'Please be certain' => '', 'Please click the link below to complete your password reset' => '', 'Please fix following errors:' => '', + 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please click on \'Cancel\' and repeat the login request.' => '', + 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please close this window and repeat the enabling request.' => '', 'Privacy' => '', 'Privacy settings' => '', 'Profile' => '', @@ -191,6 +201,7 @@ return [ 'Something went wrong' => '', 'Submit' => '', 'Switch identities is disabled.' => '', + 'Text message' => '', 'Thank you for signing up on {0}' => '', 'Thank you, registration is now complete.' => '', 'The "recaptcha" component must be configured.' => '', @@ -200,6 +211,7 @@ return [ 'There was an error in saving user' => '', 'This account has already been connected to another user' => '', 'This email address has already been taken' => '', + 'This is the code to insert to enable two factor authentication' => '', 'This username has already been taken' => '', 'This will disable two factor authentication. Are you sure?' => '', 'This will remove your personal data from this site. You will no longer be able to sign in.' => '', @@ -207,6 +219,8 @@ return [ 'Time zone is not valid' => '', 'Two Factor Authentication (2FA)' => '', 'Two factor authentication code' => '', + 'Two factor authentication code by SMS' => '', + 'Two factor authentication code by email' => '', 'Two factor authentication has been disabled.' => '', 'Two factor authentication protects you in case of stolen credentials' => '', 'Two factor authentication successfully enabled.' => '', diff --git a/src/User/resources/i18n/fr/usuario.php b/src/User/resources/i18n/fr/usuario.php index 4118950..12bf6b8 100644 --- a/src/User/resources/i18n/fr/usuario.php +++ b/src/User/resources/i18n/fr/usuario.php @@ -272,7 +272,22 @@ return [ '{0} cannot be blank.' => '{0} ne peut être vide.', 'According to the European General Data Protection Regulation (GDPR) we need your consent to work with your personal data.' => '', 'Data privacy' => '', + 'Every user having your role has two factor authentication mandatory, you must enable it' => '', + 'Google Authenticator' => '', + 'Insert' => '', + 'Insert the code you received by SMS.' => '', + 'Insert the code you received by email.' => '', + 'Insert the mobile phone number on which to receive text message.' => '', + 'Mobile phone number' => '', + 'Mobile phone number not registered.' => '', + 'Mobile phone number successfully enabled.' => '', + 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please click on \'Cancel\' and repeat the login request.' => '', + 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please close this window and repeat the enabling request.' => '', 'Submit' => '', + 'Text message' => '', + 'This is the code to insert to enable two factor authentication' => '', + 'Two factor authentication code by SMS' => '', + 'Two factor authentication code by email' => '', 'Unfortunately, you can not work with this site without giving us consent to process your data.' => '', 'Your consent is required to work with this site' => '', '{0, date, MMM dd, YYYY HH:mm}' => '', diff --git a/src/User/resources/i18n/hr/usuario.php b/src/User/resources/i18n/hr/usuario.php index 0776a37..843098b 100644 --- a/src/User/resources/i18n/hr/usuario.php +++ b/src/User/resources/i18n/hr/usuario.php @@ -109,6 +109,7 @@ return [ 'Finish' => '', 'Force password change at next login' => '', 'Forgot password?' => '', + 'Google Authenticator' => '', 'Gravatar email' => '', 'Hello' => '', 'Here you can download your personal data in a comma separated values format.' => '', @@ -120,6 +121,10 @@ return [ 'In order to complete your request, please click the link below' => '', 'In order to finish your registration, we need you to enter following fields' => '', 'Information' => '', + 'Insert' => '', + 'Insert the code you received by SMS.' => '', + 'Insert the code you received by email.' => '', + 'Insert the mobile phone number on which to receive text message.' => '', 'Invalid login or password' => '', 'Invalid or expired link' => '', 'Invalid password' => '', @@ -135,6 +140,9 @@ return [ 'Login' => '', 'Logout' => '', 'Manage users' => '', + 'Mobile phone number' => '', + 'Mobile phone number not registered.' => '', + 'Mobile phone number successfully enabled.' => '', 'Name' => '', 'Networks' => '', 'Never' => '', @@ -155,6 +163,8 @@ return [ 'Please be certain' => '', 'Please click the link below to complete your password reset' => '', 'Please fix following errors:' => '', + 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please click on \'Cancel\' and repeat the login request.' => '', + 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please close this window and repeat the enabling request.' => '', 'Privacy' => '', 'Privacy settings' => '', 'Profile' => '', @@ -191,6 +201,7 @@ return [ 'Something went wrong' => '', 'Submit' => '', 'Switch identities is disabled.' => '', + 'Text message' => '', 'Thank you for signing up on {0}' => '', 'Thank you, registration is now complete.' => '', 'The "recaptcha" component must be configured.' => '', @@ -200,6 +211,7 @@ return [ 'There was an error in saving user' => '', 'This account has already been connected to another user' => '', 'This email address has already been taken' => '', + 'This is the code to insert to enable two factor authentication' => '', 'This username has already been taken' => '', 'This will disable two factor authentication. Are you sure?' => '', 'This will remove your personal data from this site. You will no longer be able to sign in.' => '', @@ -207,6 +219,8 @@ return [ 'Time zone is not valid' => '', 'Two Factor Authentication (2FA)' => '', 'Two factor authentication code' => '', + 'Two factor authentication code by SMS' => '', + 'Two factor authentication code by email' => '', 'Two factor authentication has been disabled.' => '', 'Two factor authentication protects you in case of stolen credentials' => '', 'Two factor authentication successfully enabled.' => '', diff --git a/src/User/resources/i18n/hu/usuario.php b/src/User/resources/i18n/hu/usuario.php index f49f3ef..6670a01 100644 --- a/src/User/resources/i18n/hu/usuario.php +++ b/src/User/resources/i18n/hu/usuario.php @@ -272,9 +272,24 @@ return [ 'According to the European General Data Protection Regulation (GDPR) we need your consent to work with your personal data.' => '', 'An email with instructions to create a new password has been sent to {email} if it is associated with an {appName} account. Your existing password has not been changed.' => '', 'Data privacy' => '', + 'Every user having your role has two factor authentication mandatory, you must enable it' => '', + 'Google Authenticator' => '', + 'Insert' => '', + 'Insert the code you received by SMS.' => '', + 'Insert the code you received by email.' => '', + 'Insert the mobile phone number on which to receive text message.' => '', + 'Mobile phone number' => '', + 'Mobile phone number not registered.' => '', + 'Mobile phone number successfully enabled.' => '', + 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please click on \'Cancel\' and repeat the login request.' => '', + 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please close this window and repeat the enabling request.' => '', 'Rule class name' => '', 'Select rule...' => '', 'Submit' => '', + 'Text message' => '', + 'This is the code to insert to enable two factor authentication' => '', + 'Two factor authentication code by SMS' => '', + 'Two factor authentication code by email' => '', 'Two factor authentication protects you in case of stolen credentials' => '', 'Unfortunately, you can not work with this site without giving us consent to process your data.' => '', 'Your consent is required to work with this site' => '', diff --git a/src/User/resources/i18n/it/usuario.php b/src/User/resources/i18n/it/usuario.php index 6d37ea0..d884e27 100644 --- a/src/User/resources/i18n/it/usuario.php +++ b/src/User/resources/i18n/it/usuario.php @@ -109,6 +109,7 @@ return [ 'Finish' => 'Completa', 'Force password change at next login' => 'Forza il cambio password al prossimo accesso', 'Forgot password?' => 'Password dimenticata?', + 'Google Authenticator' => 'Autenticatore di Google', 'Gravatar email' => 'Email di Gravatar', 'Hello' => 'Ciao', 'Here you can download your personal data in a comma separated values format.' => 'Da qui puoi scaricare i tuoi dati in formato CSV.', @@ -121,6 +122,10 @@ return [ 'In order to complete your request, please click the link below' => 'Per completare la richiesta fai click sul collegamento qui sotto', 'In order to finish your registration, we need you to enter following fields' => 'Per finalizzare la registrazione devi fornire le seguenti informazioni', 'Information' => 'Informazioni', + 'Insert' => 'Inserisci', + 'Insert the code you received by SMS.' => 'Inserisci il codice ricevuto tramite SMS.', + 'Insert the code you received by email.' => 'Inserisci il codice ricevuto tramite email.', + 'Insert the mobile phone number on which to receive text message.' => 'Inserisci il numero del cellulare sul quale ricevere i codici.', 'Invalid login or password' => 'Utente o password non validi', 'Invalid or expired link' => 'Collegamento non valido o scaduto', 'Invalid password' => 'Password non valida', @@ -136,6 +141,9 @@ return [ 'Login' => 'Accedi', 'Logout' => 'Esci', 'Manage users' => 'Gestisci gli utenti', + 'Mobile phone number' => 'Numero di cellulare', + 'Mobile phone number not registered.' => 'L\'attivazione del numero di cellulare non è riuscita', + 'Mobile phone number successfully enabled.' => 'Il numero di cellulare è stato abilitato', 'Name' => 'Nome', 'Networks' => 'Rete', 'Never' => 'Mai', @@ -156,6 +164,8 @@ return [ 'Please be certain' => 'Pensaci bene', 'Please click the link below to complete your password reset' => 'Per favore fai click sul collegamento sotto per completare il cambio password', 'Please fix following errors:' => 'Per favore correggi i seguenti errori:', + 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please click on \'Cancel\' and repeat the login request.' => 'Inserire il codice corretto. Il codice è valido per {0} secondi. Se si desidera ricevere un nuovo codice cliccare su \'Annulla\' e ripetere la procedura di autenticazione', + 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please close this window and repeat the enabling request.' => 'Inserire il codice corretto. Il codice è valido per {0} secondi. Se si desidera ricevere un nuovo codice, chiudere questa finestra e ripetere la richiesta di abilitazione.', 'Privacy' => 'Privacy', 'Privacy settings' => 'Impostazioni privacy', 'Profile' => 'Profilo', @@ -192,6 +202,7 @@ return [ 'Something went wrong' => 'È successo qualcosa di strano', 'Submit' => 'Invia', 'Switch identities is disabled.' => 'Il cambio identità è disabilitato', + 'Text message' => 'Messaggio di testo tramite SMS', 'Thank you for signing up on {0}' => 'Grazie per esserti registrato su {0}', 'Thank you, registration is now complete.' => 'Grazie, la tua registrazione è completa.', 'The "recaptcha" component must be configured.' => 'Occorre configurare il componente "recaptcha".', @@ -208,8 +219,10 @@ return [ 'Time zone is not valid' => 'Il fuso orario non è valido', 'Two Factor Authentication (2FA)' => 'Autenticazione a due fattori (2FA)', 'Two factor authentication code' => 'Codice di autenticazione a due fattori', + 'Two factor authentication code by SMS' => 'Codice di autenticazione a due fattori tramite SMS', + 'Two factor authentication code by email' => 'Codice di autenticazione a due fattori tramite email', 'Two factor authentication has been disabled.' => 'Autenticazione a due fattori disabilitata.', - 'Two factor authentication protects you in case of stolen credentials' => 'L\'autenticazione a due fattura ti protegge in caso di furto di credenziali', + 'Two factor authentication protects you in case of stolen credentials' => 'L\'autenticazione a due fattori ti protegge in caso di furto di credenziali', 'Two factor authentication successfully enabled.' => 'Autenticazione a due fattori abilitata con successo.', 'Unable to confirm user. Please, try again.' => 'Impossibile confermare l\'utente, per favore ritenta.', 'Unable to create an account.' => 'Impossibile creare l\'account.', @@ -278,5 +291,8 @@ return [ '{0, date, MMM dd, YYYY HH:mm}' => '{0, date, MMM dd, YYYY HH:mm}', '{0, date, MMMM dd, YYYY HH:mm}' => '{0, date, dd MMMM YYYY HH:mm}', '{0} cannot be blank.' => '{0} non può essere vuoto.', + 'This is the code to insert to enable two factor authentication' => '', 'An email has been sent with instructions for resetting your password' => '@@È stata inviata un\'email con le istruzioni per azzerare la tua password@@', + 'Now you can resume the login process' => '@@Ora puoi riprendere il processo di autenticazione@@', + 'Send new code' => '@@Invia un nuovo codice@@', ]; diff --git a/src/User/resources/i18n/kk/usuario.php b/src/User/resources/i18n/kk/usuario.php index 0776a37..843098b 100644 --- a/src/User/resources/i18n/kk/usuario.php +++ b/src/User/resources/i18n/kk/usuario.php @@ -109,6 +109,7 @@ return [ 'Finish' => '', 'Force password change at next login' => '', 'Forgot password?' => '', + 'Google Authenticator' => '', 'Gravatar email' => '', 'Hello' => '', 'Here you can download your personal data in a comma separated values format.' => '', @@ -120,6 +121,10 @@ return [ 'In order to complete your request, please click the link below' => '', 'In order to finish your registration, we need you to enter following fields' => '', 'Information' => '', + 'Insert' => '', + 'Insert the code you received by SMS.' => '', + 'Insert the code you received by email.' => '', + 'Insert the mobile phone number on which to receive text message.' => '', 'Invalid login or password' => '', 'Invalid or expired link' => '', 'Invalid password' => '', @@ -135,6 +140,9 @@ return [ 'Login' => '', 'Logout' => '', 'Manage users' => '', + 'Mobile phone number' => '', + 'Mobile phone number not registered.' => '', + 'Mobile phone number successfully enabled.' => '', 'Name' => '', 'Networks' => '', 'Never' => '', @@ -155,6 +163,8 @@ return [ 'Please be certain' => '', 'Please click the link below to complete your password reset' => '', 'Please fix following errors:' => '', + 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please click on \'Cancel\' and repeat the login request.' => '', + 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please close this window and repeat the enabling request.' => '', 'Privacy' => '', 'Privacy settings' => '', 'Profile' => '', @@ -191,6 +201,7 @@ return [ 'Something went wrong' => '', 'Submit' => '', 'Switch identities is disabled.' => '', + 'Text message' => '', 'Thank you for signing up on {0}' => '', 'Thank you, registration is now complete.' => '', 'The "recaptcha" component must be configured.' => '', @@ -200,6 +211,7 @@ return [ 'There was an error in saving user' => '', 'This account has already been connected to another user' => '', 'This email address has already been taken' => '', + 'This is the code to insert to enable two factor authentication' => '', 'This username has already been taken' => '', 'This will disable two factor authentication. Are you sure?' => '', 'This will remove your personal data from this site. You will no longer be able to sign in.' => '', @@ -207,6 +219,8 @@ return [ 'Time zone is not valid' => '', 'Two Factor Authentication (2FA)' => '', 'Two factor authentication code' => '', + 'Two factor authentication code by SMS' => '', + 'Two factor authentication code by email' => '', 'Two factor authentication has been disabled.' => '', 'Two factor authentication protects you in case of stolen credentials' => '', 'Two factor authentication successfully enabled.' => '', diff --git a/src/User/resources/i18n/lt/usuario.php b/src/User/resources/i18n/lt/usuario.php index 0776a37..843098b 100644 --- a/src/User/resources/i18n/lt/usuario.php +++ b/src/User/resources/i18n/lt/usuario.php @@ -109,6 +109,7 @@ return [ 'Finish' => '', 'Force password change at next login' => '', 'Forgot password?' => '', + 'Google Authenticator' => '', 'Gravatar email' => '', 'Hello' => '', 'Here you can download your personal data in a comma separated values format.' => '', @@ -120,6 +121,10 @@ return [ 'In order to complete your request, please click the link below' => '', 'In order to finish your registration, we need you to enter following fields' => '', 'Information' => '', + 'Insert' => '', + 'Insert the code you received by SMS.' => '', + 'Insert the code you received by email.' => '', + 'Insert the mobile phone number on which to receive text message.' => '', 'Invalid login or password' => '', 'Invalid or expired link' => '', 'Invalid password' => '', @@ -135,6 +140,9 @@ return [ 'Login' => '', 'Logout' => '', 'Manage users' => '', + 'Mobile phone number' => '', + 'Mobile phone number not registered.' => '', + 'Mobile phone number successfully enabled.' => '', 'Name' => '', 'Networks' => '', 'Never' => '', @@ -155,6 +163,8 @@ return [ 'Please be certain' => '', 'Please click the link below to complete your password reset' => '', 'Please fix following errors:' => '', + 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please click on \'Cancel\' and repeat the login request.' => '', + 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please close this window and repeat the enabling request.' => '', 'Privacy' => '', 'Privacy settings' => '', 'Profile' => '', @@ -191,6 +201,7 @@ return [ 'Something went wrong' => '', 'Submit' => '', 'Switch identities is disabled.' => '', + 'Text message' => '', 'Thank you for signing up on {0}' => '', 'Thank you, registration is now complete.' => '', 'The "recaptcha" component must be configured.' => '', @@ -200,6 +211,7 @@ return [ 'There was an error in saving user' => '', 'This account has already been connected to another user' => '', 'This email address has already been taken' => '', + 'This is the code to insert to enable two factor authentication' => '', 'This username has already been taken' => '', 'This will disable two factor authentication. Are you sure?' => '', 'This will remove your personal data from this site. You will no longer be able to sign in.' => '', @@ -207,6 +219,8 @@ return [ 'Time zone is not valid' => '', 'Two Factor Authentication (2FA)' => '', 'Two factor authentication code' => '', + 'Two factor authentication code by SMS' => '', + 'Two factor authentication code by email' => '', 'Two factor authentication has been disabled.' => '', 'Two factor authentication protects you in case of stolen credentials' => '', 'Two factor authentication successfully enabled.' => '', diff --git a/src/User/resources/i18n/nl/usuario.php b/src/User/resources/i18n/nl/usuario.php index e5c3d96..c56e36f 100644 --- a/src/User/resources/i18n/nl/usuario.php +++ b/src/User/resources/i18n/nl/usuario.php @@ -272,9 +272,24 @@ return [ 'According to the European General Data Protection Regulation (GDPR) we need your consent to work with your personal data.' => '', 'An email with instructions to create a new password has been sent to {email} if it is associated with an {appName} account. Your existing password has not been changed.' => '', 'Data privacy' => '', + 'Every user having your role has two factor authentication mandatory, you must enable it' => '', + 'Google Authenticator' => '', + 'Insert' => '', + 'Insert the code you received by SMS.' => '', + 'Insert the code you received by email.' => '', + 'Insert the mobile phone number on which to receive text message.' => '', + 'Mobile phone number' => '', + 'Mobile phone number not registered.' => '', + 'Mobile phone number successfully enabled.' => '', + 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please click on \'Cancel\' and repeat the login request.' => '', + 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please close this window and repeat the enabling request.' => '', 'Rule class name' => '', 'Select rule...' => '', 'Submit' => '', + 'Text message' => '', + 'This is the code to insert to enable two factor authentication' => '', + 'Two factor authentication code by SMS' => '', + 'Two factor authentication code by email' => '', 'Two factor authentication protects you in case of stolen credentials' => '', 'Unfortunately, you can not work with this site without giving us consent to process your data.' => '', 'Your consent is required to work with this site' => '', diff --git a/src/User/resources/i18n/pl/usuario.php b/src/User/resources/i18n/pl/usuario.php index e1e29a2..cbe7fdd 100644 --- a/src/User/resources/i18n/pl/usuario.php +++ b/src/User/resources/i18n/pl/usuario.php @@ -272,9 +272,24 @@ return [ 'According to the European General Data Protection Regulation (GDPR) we need your consent to work with your personal data.' => '', 'An email with instructions to create a new password has been sent to {email} if it is associated with an {appName} account. Your existing password has not been changed.' => '', 'Data privacy' => '', + 'Every user having your role has two factor authentication mandatory, you must enable it' => '', + 'Google Authenticator' => '', + 'Insert' => '', + 'Insert the code you received by SMS.' => '', + 'Insert the code you received by email.' => '', + 'Insert the mobile phone number on which to receive text message.' => '', + 'Mobile phone number' => '', + 'Mobile phone number not registered.' => '', + 'Mobile phone number successfully enabled.' => '', + 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please click on \'Cancel\' and repeat the login request.' => '', + 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please close this window and repeat the enabling request.' => '', 'Rule class name' => '', 'Select rule...' => '', 'Submit' => '', + 'Text message' => '', + 'This is the code to insert to enable two factor authentication' => '', + 'Two factor authentication code by SMS' => '', + 'Two factor authentication code by email' => '', 'Two factor authentication protects you in case of stolen credentials' => '', 'Unfortunately, you can not work with this site without giving us consent to process your data.' => '', 'Your consent is required to work with this site' => '', diff --git a/src/User/resources/i18n/pt-BR/usuario.php b/src/User/resources/i18n/pt-BR/usuario.php index 2de3773..40e1188 100644 --- a/src/User/resources/i18n/pt-BR/usuario.php +++ b/src/User/resources/i18n/pt-BR/usuario.php @@ -272,9 +272,24 @@ return [ 'According to the European General Data Protection Regulation (GDPR) we need your consent to work with your personal data.' => '', 'An email with instructions to create a new password has been sent to {email} if it is associated with an {appName} account. Your existing password has not been changed.' => '', 'Data privacy' => '', + 'Every user having your role has two factor authentication mandatory, you must enable it' => '', + 'Google Authenticator' => '', + 'Insert' => '', + 'Insert the code you received by SMS.' => '', + 'Insert the code you received by email.' => '', + 'Insert the mobile phone number on which to receive text message.' => '', + 'Mobile phone number' => '', + 'Mobile phone number not registered.' => '', + 'Mobile phone number successfully enabled.' => '', + 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please click on \'Cancel\' and repeat the login request.' => '', + 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please close this window and repeat the enabling request.' => '', 'Rule class name' => '', 'Select rule...' => '', 'Submit' => '', + 'Text message' => '', + 'This is the code to insert to enable two factor authentication' => '', + 'Two factor authentication code by SMS' => '', + 'Two factor authentication code by email' => '', 'Two factor authentication protects you in case of stolen credentials' => '', 'Unfortunately, you can not work with this site without giving us consent to process your data.' => '', 'Your consent is required to work with this site' => '', diff --git a/src/User/resources/i18n/pt-PT/usuario.php b/src/User/resources/i18n/pt-PT/usuario.php index 3164616..53e6010 100644 --- a/src/User/resources/i18n/pt-PT/usuario.php +++ b/src/User/resources/i18n/pt-PT/usuario.php @@ -264,12 +264,27 @@ return [ 'Class' => '', 'Data privacy' => '', 'Email' => '', + 'Every user having your role has two factor authentication mandatory, you must enable it' => '', + 'Google Authenticator' => '', 'Gravatar email' => '', + 'Insert' => '', + 'Insert the code you received by SMS.' => '', + 'Insert the code you received by email.' => '', + 'Insert the mobile phone number on which to receive text message.' => '', 'Items' => '', + 'Mobile phone number' => '', + 'Mobile phone number not registered.' => '', + 'Mobile phone number successfully enabled.' => '', 'Password' => '', + 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please click on \'Cancel\' and repeat the login request.' => '', + 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please close this window and repeat the enabling request.' => '', 'Rule class name' => '', 'Select rule...' => '', 'Submit' => '', + 'Text message' => '', + 'This is the code to insert to enable two factor authentication' => '', + 'Two factor authentication code by SMS' => '', + 'Two factor authentication code by email' => '', 'Two factor authentication protects you in case of stolen credentials' => '', 'Unfortunately, you can not work with this site without giving us consent to process your data.' => '', 'VKontakte' => '', diff --git a/src/User/resources/i18n/ro/usuario.php b/src/User/resources/i18n/ro/usuario.php index 0527b1e..e8b9d5c 100644 --- a/src/User/resources/i18n/ro/usuario.php +++ b/src/User/resources/i18n/ro/usuario.php @@ -272,9 +272,24 @@ return [ 'According to the European General Data Protection Regulation (GDPR) we need your consent to work with your personal data.' => '', 'An email with instructions to create a new password has been sent to {email} if it is associated with an {appName} account. Your existing password has not been changed.' => '', 'Data privacy' => '', + 'Every user having your role has two factor authentication mandatory, you must enable it' => '', + 'Google Authenticator' => '', + 'Insert' => '', + 'Insert the code you received by SMS.' => '', + 'Insert the code you received by email.' => '', + 'Insert the mobile phone number on which to receive text message.' => '', + 'Mobile phone number' => '', + 'Mobile phone number not registered.' => '', + 'Mobile phone number successfully enabled.' => '', + 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please click on \'Cancel\' and repeat the login request.' => '', + 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please close this window and repeat the enabling request.' => '', 'Rule class name' => '', 'Select rule...' => '', 'Submit' => '', + 'Text message' => '', + 'This is the code to insert to enable two factor authentication' => '', + 'Two factor authentication code by SMS' => '', + 'Two factor authentication code by email' => '', 'Two factor authentication protects you in case of stolen credentials' => '', 'Unfortunately, you can not work with this site without giving us consent to process your data.' => '', 'Your consent is required to work with this site' => '', diff --git a/src/User/resources/i18n/ru/usuario.php b/src/User/resources/i18n/ru/usuario.php index ab62d8b..b3fbbd4 100644 --- a/src/User/resources/i18n/ru/usuario.php +++ b/src/User/resources/i18n/ru/usuario.php @@ -275,7 +275,22 @@ return [ '{0} cannot be blank.' => '{0} не может быть пустым.', 'According to the European General Data Protection Regulation (GDPR) we need your consent to work with your personal data.' => '', 'Data privacy' => '', + 'Every user having your role has two factor authentication mandatory, you must enable it' => '', + 'Google Authenticator' => '', + 'Insert' => '', + 'Insert the code you received by SMS.' => '', + 'Insert the code you received by email.' => '', + 'Insert the mobile phone number on which to receive text message.' => '', + 'Mobile phone number' => '', + 'Mobile phone number not registered.' => '', + 'Mobile phone number successfully enabled.' => '', + 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please click on \'Cancel\' and repeat the login request.' => '', + 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please close this window and repeat the enabling request.' => '', 'Submit' => '', + 'Text message' => '', + 'This is the code to insert to enable two factor authentication' => '', + 'Two factor authentication code by SMS' => '', + 'Two factor authentication code by email' => '', 'Unfortunately, you can not work with this site without giving us consent to process your data.' => '', 'Your consent is required to work with this site' => '', 'A message has been sent to your email address. ' => '@@Сообщение было отправлено на вашу электронную почту@@', diff --git a/src/User/resources/i18n/th/usuario.php b/src/User/resources/i18n/th/usuario.php index 0776a37..843098b 100644 --- a/src/User/resources/i18n/th/usuario.php +++ b/src/User/resources/i18n/th/usuario.php @@ -109,6 +109,7 @@ return [ 'Finish' => '', 'Force password change at next login' => '', 'Forgot password?' => '', + 'Google Authenticator' => '', 'Gravatar email' => '', 'Hello' => '', 'Here you can download your personal data in a comma separated values format.' => '', @@ -120,6 +121,10 @@ return [ 'In order to complete your request, please click the link below' => '', 'In order to finish your registration, we need you to enter following fields' => '', 'Information' => '', + 'Insert' => '', + 'Insert the code you received by SMS.' => '', + 'Insert the code you received by email.' => '', + 'Insert the mobile phone number on which to receive text message.' => '', 'Invalid login or password' => '', 'Invalid or expired link' => '', 'Invalid password' => '', @@ -135,6 +140,9 @@ return [ 'Login' => '', 'Logout' => '', 'Manage users' => '', + 'Mobile phone number' => '', + 'Mobile phone number not registered.' => '', + 'Mobile phone number successfully enabled.' => '', 'Name' => '', 'Networks' => '', 'Never' => '', @@ -155,6 +163,8 @@ return [ 'Please be certain' => '', 'Please click the link below to complete your password reset' => '', 'Please fix following errors:' => '', + 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please click on \'Cancel\' and repeat the login request.' => '', + 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please close this window and repeat the enabling request.' => '', 'Privacy' => '', 'Privacy settings' => '', 'Profile' => '', @@ -191,6 +201,7 @@ return [ 'Something went wrong' => '', 'Submit' => '', 'Switch identities is disabled.' => '', + 'Text message' => '', 'Thank you for signing up on {0}' => '', 'Thank you, registration is now complete.' => '', 'The "recaptcha" component must be configured.' => '', @@ -200,6 +211,7 @@ return [ 'There was an error in saving user' => '', 'This account has already been connected to another user' => '', 'This email address has already been taken' => '', + 'This is the code to insert to enable two factor authentication' => '', 'This username has already been taken' => '', 'This will disable two factor authentication. Are you sure?' => '', 'This will remove your personal data from this site. You will no longer be able to sign in.' => '', @@ -207,6 +219,8 @@ return [ 'Time zone is not valid' => '', 'Two Factor Authentication (2FA)' => '', 'Two factor authentication code' => '', + 'Two factor authentication code by SMS' => '', + 'Two factor authentication code by email' => '', 'Two factor authentication has been disabled.' => '', 'Two factor authentication protects you in case of stolen credentials' => '', 'Two factor authentication successfully enabled.' => '', diff --git a/src/User/resources/i18n/tr-TR/usuario.php b/src/User/resources/i18n/tr-TR/usuario.php index 0776a37..843098b 100644 --- a/src/User/resources/i18n/tr-TR/usuario.php +++ b/src/User/resources/i18n/tr-TR/usuario.php @@ -109,6 +109,7 @@ return [ 'Finish' => '', 'Force password change at next login' => '', 'Forgot password?' => '', + 'Google Authenticator' => '', 'Gravatar email' => '', 'Hello' => '', 'Here you can download your personal data in a comma separated values format.' => '', @@ -120,6 +121,10 @@ return [ 'In order to complete your request, please click the link below' => '', 'In order to finish your registration, we need you to enter following fields' => '', 'Information' => '', + 'Insert' => '', + 'Insert the code you received by SMS.' => '', + 'Insert the code you received by email.' => '', + 'Insert the mobile phone number on which to receive text message.' => '', 'Invalid login or password' => '', 'Invalid or expired link' => '', 'Invalid password' => '', @@ -135,6 +140,9 @@ return [ 'Login' => '', 'Logout' => '', 'Manage users' => '', + 'Mobile phone number' => '', + 'Mobile phone number not registered.' => '', + 'Mobile phone number successfully enabled.' => '', 'Name' => '', 'Networks' => '', 'Never' => '', @@ -155,6 +163,8 @@ return [ 'Please be certain' => '', 'Please click the link below to complete your password reset' => '', 'Please fix following errors:' => '', + 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please click on \'Cancel\' and repeat the login request.' => '', + 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please close this window and repeat the enabling request.' => '', 'Privacy' => '', 'Privacy settings' => '', 'Profile' => '', @@ -191,6 +201,7 @@ return [ 'Something went wrong' => '', 'Submit' => '', 'Switch identities is disabled.' => '', + 'Text message' => '', 'Thank you for signing up on {0}' => '', 'Thank you, registration is now complete.' => '', 'The "recaptcha" component must be configured.' => '', @@ -200,6 +211,7 @@ return [ 'There was an error in saving user' => '', 'This account has already been connected to another user' => '', 'This email address has already been taken' => '', + 'This is the code to insert to enable two factor authentication' => '', 'This username has already been taken' => '', 'This will disable two factor authentication. Are you sure?' => '', 'This will remove your personal data from this site. You will no longer be able to sign in.' => '', @@ -207,6 +219,8 @@ return [ 'Time zone is not valid' => '', 'Two Factor Authentication (2FA)' => '', 'Two factor authentication code' => '', + 'Two factor authentication code by SMS' => '', + 'Two factor authentication code by email' => '', 'Two factor authentication has been disabled.' => '', 'Two factor authentication protects you in case of stolen credentials' => '', 'Two factor authentication successfully enabled.' => '', diff --git a/src/User/resources/i18n/uk/usuario.php b/src/User/resources/i18n/uk/usuario.php index f533081..1dd1a2e 100644 --- a/src/User/resources/i18n/uk/usuario.php +++ b/src/User/resources/i18n/uk/usuario.php @@ -274,8 +274,23 @@ return [ '{0} cannot be blank.' => '{0} не може бути порожнім.', 'According to the European General Data Protection Regulation (GDPR) we need your consent to work with your personal data.' => '', 'Data privacy' => '', + 'Every user having your role has two factor authentication mandatory, you must enable it' => '', + 'Google Authenticator' => '', + 'Insert' => '', + 'Insert the code you received by SMS.' => '', + 'Insert the code you received by email.' => '', + 'Insert the mobile phone number on which to receive text message.' => '', + 'Mobile phone number' => '', + 'Mobile phone number not registered.' => '', + 'Mobile phone number successfully enabled.' => '', + 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please click on \'Cancel\' and repeat the login request.' => '', + 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please close this window and repeat the enabling request.' => '', 'Recovery message sent' => '', 'Submit' => '', + 'Text message' => '', + 'This is the code to insert to enable two factor authentication' => '', + 'Two factor authentication code by SMS' => '', + 'Two factor authentication code by email' => '', 'Unfortunately, you can not work with this site without giving us consent to process your data.' => '', 'Your consent is required to work with this site' => '', 'A message has been sent to your email address. ' => '@@На вашу електронну адресу надіслано повідомлення@@', diff --git a/src/User/resources/i18n/vi/usuario.php b/src/User/resources/i18n/vi/usuario.php index 0776a37..843098b 100644 --- a/src/User/resources/i18n/vi/usuario.php +++ b/src/User/resources/i18n/vi/usuario.php @@ -109,6 +109,7 @@ return [ 'Finish' => '', 'Force password change at next login' => '', 'Forgot password?' => '', + 'Google Authenticator' => '', 'Gravatar email' => '', 'Hello' => '', 'Here you can download your personal data in a comma separated values format.' => '', @@ -120,6 +121,10 @@ return [ 'In order to complete your request, please click the link below' => '', 'In order to finish your registration, we need you to enter following fields' => '', 'Information' => '', + 'Insert' => '', + 'Insert the code you received by SMS.' => '', + 'Insert the code you received by email.' => '', + 'Insert the mobile phone number on which to receive text message.' => '', 'Invalid login or password' => '', 'Invalid or expired link' => '', 'Invalid password' => '', @@ -135,6 +140,9 @@ return [ 'Login' => '', 'Logout' => '', 'Manage users' => '', + 'Mobile phone number' => '', + 'Mobile phone number not registered.' => '', + 'Mobile phone number successfully enabled.' => '', 'Name' => '', 'Networks' => '', 'Never' => '', @@ -155,6 +163,8 @@ return [ 'Please be certain' => '', 'Please click the link below to complete your password reset' => '', 'Please fix following errors:' => '', + 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please click on \'Cancel\' and repeat the login request.' => '', + 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please close this window and repeat the enabling request.' => '', 'Privacy' => '', 'Privacy settings' => '', 'Profile' => '', @@ -191,6 +201,7 @@ return [ 'Something went wrong' => '', 'Submit' => '', 'Switch identities is disabled.' => '', + 'Text message' => '', 'Thank you for signing up on {0}' => '', 'Thank you, registration is now complete.' => '', 'The "recaptcha" component must be configured.' => '', @@ -200,6 +211,7 @@ return [ 'There was an error in saving user' => '', 'This account has already been connected to another user' => '', 'This email address has already been taken' => '', + 'This is the code to insert to enable two factor authentication' => '', 'This username has already been taken' => '', 'This will disable two factor authentication. Are you sure?' => '', 'This will remove your personal data from this site. You will no longer be able to sign in.' => '', @@ -207,6 +219,8 @@ return [ 'Time zone is not valid' => '', 'Two Factor Authentication (2FA)' => '', 'Two factor authentication code' => '', + 'Two factor authentication code by SMS' => '', + 'Two factor authentication code by email' => '', 'Two factor authentication has been disabled.' => '', 'Two factor authentication protects you in case of stolen credentials' => '', 'Two factor authentication successfully enabled.' => '', diff --git a/src/User/resources/i18n/zh-CN/usuario.php b/src/User/resources/i18n/zh-CN/usuario.php index 0776a37..843098b 100644 --- a/src/User/resources/i18n/zh-CN/usuario.php +++ b/src/User/resources/i18n/zh-CN/usuario.php @@ -109,6 +109,7 @@ return [ 'Finish' => '', 'Force password change at next login' => '', 'Forgot password?' => '', + 'Google Authenticator' => '', 'Gravatar email' => '', 'Hello' => '', 'Here you can download your personal data in a comma separated values format.' => '', @@ -120,6 +121,10 @@ return [ 'In order to complete your request, please click the link below' => '', 'In order to finish your registration, we need you to enter following fields' => '', 'Information' => '', + 'Insert' => '', + 'Insert the code you received by SMS.' => '', + 'Insert the code you received by email.' => '', + 'Insert the mobile phone number on which to receive text message.' => '', 'Invalid login or password' => '', 'Invalid or expired link' => '', 'Invalid password' => '', @@ -135,6 +140,9 @@ return [ 'Login' => '', 'Logout' => '', 'Manage users' => '', + 'Mobile phone number' => '', + 'Mobile phone number not registered.' => '', + 'Mobile phone number successfully enabled.' => '', 'Name' => '', 'Networks' => '', 'Never' => '', @@ -155,6 +163,8 @@ return [ 'Please be certain' => '', 'Please click the link below to complete your password reset' => '', 'Please fix following errors:' => '', + 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please click on \'Cancel\' and repeat the login request.' => '', + 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please close this window and repeat the enabling request.' => '', 'Privacy' => '', 'Privacy settings' => '', 'Profile' => '', @@ -191,6 +201,7 @@ return [ 'Something went wrong' => '', 'Submit' => '', 'Switch identities is disabled.' => '', + 'Text message' => '', 'Thank you for signing up on {0}' => '', 'Thank you, registration is now complete.' => '', 'The "recaptcha" component must be configured.' => '', @@ -200,6 +211,7 @@ return [ 'There was an error in saving user' => '', 'This account has already been connected to another user' => '', 'This email address has already been taken' => '', + 'This is the code to insert to enable two factor authentication' => '', 'This username has already been taken' => '', 'This will disable two factor authentication. Are you sure?' => '', 'This will remove your personal data from this site. You will no longer be able to sign in.' => '', @@ -207,6 +219,8 @@ return [ 'Time zone is not valid' => '', 'Two Factor Authentication (2FA)' => '', 'Two factor authentication code' => '', + 'Two factor authentication code by SMS' => '', + 'Two factor authentication code by email' => '', 'Two factor authentication has been disabled.' => '', 'Two factor authentication protects you in case of stolen credentials' => '', 'Two factor authentication successfully enabled.' => '', diff --git a/src/User/resources/views/mail/text/twofactorcode.php b/src/User/resources/views/mail/text/twofactorcode.php new file mode 100644 index 0000000..0a9eaf4 --- /dev/null +++ b/src/User/resources/views/mail/text/twofactorcode.php @@ -0,0 +1,22 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +/** + * @var String $code + */ +?> +, + +. + + + +. diff --git a/src/User/resources/views/mail/twofactorcode.php b/src/User/resources/views/mail/twofactorcode.php new file mode 100644 index 0000000..a1f0ea0 --- /dev/null +++ b/src/User/resources/views/mail/twofactorcode.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +use yii\helpers\Html; + +/** + * @var String $code + * @var \Da\User\Model\Token $token + */ +?> +

+ , +

+

+ +

+

+ . +

diff --git a/src/User/resources/views/security/confirm.php b/src/User/resources/views/security/confirm.php index dfc465f..ed06474 100644 --- a/src/User/resources/views/security/confirm.php +++ b/src/User/resources/views/security/confirm.php @@ -47,7 +47,6 @@ $this->params['breadcrumbs'][] = $this->title; 'twoFactorAuthenticationCode', ['inputOptions' => ['autofocus' => 'autofocus', 'class' => 'form-control', 'tabindex' => '1']] ) ?> -
getModule('user'); - @@ -102,6 +102,21 @@ $module = Yii::$app->getModule('user');

.

+ enableTwoFactorAuthentication && !$model->getUser()->auth_tf_enabled): + $validators = $module->twoFactorAuthenticationValidators; + foreach( $validators as $name => $validator ) { + $description = $validator[ "description" ]; + $checked = $name=='google-authenticator'?'checked':''; + ?> +
+ > + +
+
getModule('user'); // consider overriding this view and include your very own approach $uri = Url::to(['two-factor', 'id' => $model->getUser()->id]); $verify = Url::to(['two-factor-enable', 'id' => $model->getUser()->id]); + $mobilePhoneRegistration = Url::to(['two-factor-mobile-phone', 'id' => $model->getUser()->id]); $js = <<registerJs($js); diff --git a/src/User/resources/views/settings/two-factor-email.php b/src/User/resources/views/settings/two-factor-email.php new file mode 100644 index 0000000..41c72e6 --- /dev/null +++ b/src/User/resources/views/settings/two-factor-email.php @@ -0,0 +1,35 @@ + +* +* For the full copyright and license information, please view +* the LICENSE file that was distributed with this source code. +*/ + +/** @var string $id */ +/** @var string $uri */ +?> + +
+

+ +

+
+ +
+
+
+ + + + +
+
+
diff --git a/src/User/resources/views/settings/two-factor-sms.php b/src/User/resources/views/settings/two-factor-sms.php new file mode 100644 index 0000000..166f99a --- /dev/null +++ b/src/User/resources/views/settings/two-factor-sms.php @@ -0,0 +1,68 @@ + +* +* For the full copyright and license information, please view +* the LICENSE file that was distributed with this source code. +*/ + +/** @var string $id */ +/** @var string $uri */ +/** @var string $mobilePhoneRegistration */ +?> + +
+
+

+ +

+
+ +
+
+
+ + + + +
+
+
+
+ +
+
+
+

+ +

+
+ +
+
+
+
+
+
+
+
+ + + + +
+
+
+
\ No newline at end of file From 1ea46e9952f42feeefa61a3902e82294a0e953e6 Mon Sep 17 00:00:00 2001 From: Antonio Cordeddu Date: Mon, 18 Jul 2022 14:54:01 +0200 Subject: [PATCH 02/10] refinements and documentation on 2fa in yii2-usuario via other channels --- CHANGELOG.md | 1 + docs/installation/configuration-options.md | 32 +++++++++++++++++++ src/User/Bootstrap.php | 2 +- src/User/Controller/SecurityController.php | 5 +-- src/User/Controller/SettingsController.php | 7 ++-- ...tf_mobile_phone_columns_to_user_table.php} | 7 ++-- ...h_tf_mobile_phone_column_to_user_table.php | 25 --------------- src/User/Module.php | 6 +--- src/User/resources/i18n/ca/usuario.php | 10 ++++-- src/User/resources/i18n/da/usuario.php | 10 ++++-- src/User/resources/i18n/de-DU/usuario.php | 9 ++++-- src/User/resources/i18n/de/usuario.php | 19 ++++++----- src/User/resources/i18n/es/usuario.php | 9 ++++-- src/User/resources/i18n/et/usuario.php | 13 +++++--- src/User/resources/i18n/fa-IR/usuario.php | 10 ++++-- src/User/resources/i18n/fi/usuario.php | 10 ++++-- src/User/resources/i18n/fr/usuario.php | 13 +++++--- src/User/resources/i18n/hr/usuario.php | 10 ++++-- src/User/resources/i18n/hu/usuario.php | 9 ++++-- src/User/resources/i18n/it/usuario.php | 7 ++-- src/User/resources/i18n/kk/usuario.php | 10 ++++-- src/User/resources/i18n/lt/usuario.php | 10 ++++-- src/User/resources/i18n/nl/usuario.php | 9 ++++-- src/User/resources/i18n/pl/usuario.php | 9 ++++-- src/User/resources/i18n/pt-BR/usuario.php | 9 ++++-- src/User/resources/i18n/pt-PT/usuario.php | 10 ++++-- src/User/resources/i18n/ro/usuario.php | 9 ++++-- src/User/resources/i18n/ru/usuario.php | 9 ++++-- src/User/resources/i18n/th/usuario.php | 10 ++++-- src/User/resources/i18n/tr-TR/usuario.php | 10 ++++-- src/User/resources/i18n/uk/usuario.php | 9 ++++-- src/User/resources/i18n/vi/usuario.php | 10 ++++-- src/User/resources/i18n/zh-CN/usuario.php | 10 ++++-- .../views/mail/text/twofactorcode.php | 2 +- .../resources/views/mail/twofactorcode.php | 3 ++ .../views/settings/two-factor-sms.php | 2 +- 36 files changed, 232 insertions(+), 113 deletions(-) rename src/User/Migration/{m000000_000010_add_auth_tf_type_column_to_user_table.php => m000000_000010_add_auth_tf_type_auth_tf_mobile_phone_columns_to_user_table.php} (55%) delete mode 100644 src/User/Migration/m000000_000011_add_auth_tf_mobile_phone_column_to_user_table.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 0007c1f..c46bc40 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ - Enh: Added SK translations (snickom) - Fix: allow password_changed_at to be saved when reseting password (p4blojf) - Fix #430: Moved EVENT_BEFORE_PROFILE_UPDATE to correct place (eluhr) + - ## 1.5.1 April 5, 2020 - Fix #370: Extending view fix (effsoft) diff --git a/docs/installation/configuration-options.md b/docs/installation/configuration-options.md index e95f165..29c6a3a 100644 --- a/docs/installation/configuration-options.md +++ b/docs/installation/configuration-options.md @@ -12,6 +12,38 @@ Setting this attribute will allow users to configure their login process with tw By default, Google Authenticator App for two-factor authentication cycles in periods of 30 seconds. In order to allow a bigger period so to avoid out of sync issues. +#### twoFactorAuthenticationValidators (type: `array`) + +An array of arrays of channels availables for two factor authentication. The keys in the arrays have the following meaning: +class: it will be the validator class with namespace +name: the name that will be displayed in the section to the user +configurationUrl: the url to the action that will dispaly the configuration form for the validator +codeDurationTime: time duration of the code in session in seconds (not applicable for Google authenticator) +smsSender: the reference to SmsSenderInterface for managing SMS send. + +The following is the deafult configuration: + +'google-authenticator'=>[ + 'class'=>\Da\User\Validator\TwoFactorCodeValidator::class, + 'description'=>Yii::t('usuario', 'Google Authenticator'), + 'configurationUrl'=>'user/settings/two-factor' +], +'email'=>[ + 'class'=>\Da\User\Validator\TwoFactorEmailValidator::class, + 'description'=>Yii::t('usuario', 'Email'), + 'configurationUrl'=>'user/settings/two-factor-email', + 'codeDurationTime'=>300 +], +'sms'=>[ + 'class'=>\Da\User\Validator\TwoFactorTextMessageValidator::class, + 'description'=>Yii::t('usuario', 'Text message'), + 'configurationUrl'=>'user/settings/two-factor-sms', + 'codeDurationTime'=>300, + 'smsSender'=>'smsSender' +] + +For instructions about implementation of SMS sending see at the following link: https://www.yiiframework.com/extension/yetopen/yii2-sms-aruba + #### enableGdprCompliance (type: `boolean`, default: `false`) Setting this attribute enables a serie of measures to comply with EU GDPR regulation, like data consent, right to be forgotten and data portability. diff --git a/src/User/Bootstrap.php b/src/User/Bootstrap.php index 3bfcc41..22e0a04 100644 --- a/src/User/Bootstrap.php +++ b/src/User/Bootstrap.php @@ -131,7 +131,7 @@ class Bootstrap implements BootstrapInterface if (in_array($name, ['User', 'Profile', 'Token', 'SocialNetworkAccount'])) { $di->set( "Da\\User\\Query\\{$name}Query", - function () use ($model) { + function() use($model) { return $model::find(); } ); diff --git a/src/User/Controller/SecurityController.php b/src/User/Controller/SecurityController.php index d995bd2..1af964e 100644 --- a/src/User/Controller/SecurityController.php +++ b/src/User/Controller/SecurityController.php @@ -217,13 +217,14 @@ class SecurityController extends Controller $credentials=Yii::$app->session->get('credentials'); $login= $credentials['login']; $user = User::findOne(['email'=>$login]); - if( $user==null) + if( $user==null){ $user = User::findOne(['username'=>$login]); + } $tfType = $user->getAuthTfType(); $class = ArrayHelper::getValue($validators,$tfType.'.class'); $object = $this - ->make($class, [$user, null, $this->module->twoFactorAuthenticationCycles]); + ->make($class, [$user, null, $this->module->twoFactorAuthenticationCycles]); $object->generateCode(); diff --git a/src/User/Controller/SettingsController.php b/src/User/Controller/SettingsController.php index 764389d..baccb1b 100644 --- a/src/User/Controller/SettingsController.php +++ b/src/User/Controller/SettingsController.php @@ -453,11 +453,10 @@ class SettingsController extends Controller $class = ArrayHelper::getValue($validators,$choice.'.class'); $object = $this - ->make($class, [$user, $code, $this->module->twoFactorAuthenticationCycles]); + ->make($class, [$user, $code, $this->module->twoFactorAuthenticationCycles]); $success = $object->validate(); $success = $success && $user->updateAttributes(['auth_tf_enabled' => '1','auth_tf_type' => $choice]); - $message = $success - ? $object->getSuccessMessage():$object->getUnsuccessMessage($codeDurationTime); + $message = $success? $object->getSuccessMessage():$object->getUnsuccessMessage($codeDurationTime); return [ 'success' => $success, @@ -544,7 +543,7 @@ class SettingsController extends Controller 'success' => $success, 'message' => $success ? Yii::t('usuario', 'Mobile phone number successfully enabled.') - : Yii::t('usuario', 'Mobile phone number not registered.'), + : Yii::t('usuario', 'Error while enabling SMS two factor authentication.'), ]; } } diff --git a/src/User/Migration/m000000_000010_add_auth_tf_type_column_to_user_table.php b/src/User/Migration/m000000_000010_add_auth_tf_type_auth_tf_mobile_phone_columns_to_user_table.php similarity index 55% rename from src/User/Migration/m000000_000010_add_auth_tf_type_column_to_user_table.php rename to src/User/Migration/m000000_000010_add_auth_tf_type_auth_tf_mobile_phone_columns_to_user_table.php index 57e8161..b64c146 100644 --- a/src/User/Migration/m000000_000010_add_auth_tf_type_column_to_user_table.php +++ b/src/User/Migration/m000000_000010_add_auth_tf_type_auth_tf_mobile_phone_columns_to_user_table.php @@ -7,14 +7,16 @@ use yii\db\Migration; /** * Handles adding columns to table `{{%user}}`. */ -class m000000_000010_add_auth_tf_type_column_to_user_table extends Migration +class m000000_000010_add_auth_tf_type_auth_tf_mobile_phone_columns_to_user_table extends Migration { /** * {@inheritdoc} */ public function safeUp() { - $this->addColumn('{{%user}}', 'auth_tf_type', $this->string(20)->after('auth_tf_enabled')); + $this->addColumn('{{%user}}', 'auth_tf_type', $this->string(20)->after('auth_tf_enabled')->null()); + $this->addColumn('{{%user}}', 'auth_tf_mobile_phone', $this->string(20)->after('auth_tf_type')->null()); + } /** @@ -23,5 +25,6 @@ class m000000_000010_add_auth_tf_type_column_to_user_table extends Migration public function safeDown() { $this->dropColumn('{{%user}}', 'auth_tf_type'); + $this->dropColumn('{{%user}}', 'auth_tf_mobile_phone'); } } diff --git a/src/User/Migration/m000000_000011_add_auth_tf_mobile_phone_column_to_user_table.php b/src/User/Migration/m000000_000011_add_auth_tf_mobile_phone_column_to_user_table.php deleted file mode 100644 index e35cf33..0000000 --- a/src/User/Migration/m000000_000011_add_auth_tf_mobile_phone_column_to_user_table.php +++ /dev/null @@ -1,25 +0,0 @@ -addColumn('{{%user}}', 'auth_tf_mobile_phone', $this->string(20)->after('auth_tf_type')); - } - - /** - * {@inheritdoc} - */ - public function safeDown() - { - $this->dropColumn('{{%user}}', 'auth_tf_mobile_phone'); - } -} diff --git a/src/User/Module.php b/src/User/Module.php index 2162085..7dbe44a 100644 --- a/src/User/Module.php +++ b/src/User/Module.php @@ -82,7 +82,7 @@ class Module extends BaseModule */ public $enableTwoFactorAuthentication = false; /** - * @var array list of channel for two factor authentication availables + * @var array list of channels for two factor authentication availables */ public $twoFactorAuthenticationValidators = null; /** @@ -90,10 +90,6 @@ class Module extends BaseModule * @see http://2fa-library.readthedocs.io/en/latest/ */ public $twoFactorAuthenticationCycles = 1; - /** - * @var int the number of seconds for which the code sent by email or by mobile phone is valid - * */ - public $twoFactorEmailAuthenticationValidity = 300; /** * @var bool whether to allow auto login or not */ diff --git a/src/User/resources/i18n/ca/usuario.php b/src/User/resources/i18n/ca/usuario.php index 843098b..8d6dd3f 100644 --- a/src/User/resources/i18n/ca/usuario.php +++ b/src/User/resources/i18n/ca/usuario.php @@ -105,6 +105,7 @@ return [ 'Error occurred while deleting user' => '', 'Error sending registration message to "{email}". Please try again later.' => '', 'Error sending welcome message to "{email}". Please try again later.' => '', + 'Error while enabling SMS two factor authentication.' => '', 'Export my data' => '', 'Finish' => '', 'Force password change at next login' => '', @@ -113,6 +114,7 @@ return [ 'Gravatar email' => '', 'Hello' => '', 'Here you can download your personal data in a comma separated values format.' => '', + 'I agree processing of my personal data and the use of cookies to facilitate the operation of this site. For more information read our {privacyPolicy}' => '', 'If you already registered, sign in and connect this account on settings page' => '', 'If you cannot click the link, please try pasting the text into your browser' => '', 'If you did not make this request you can ignore this email' => '', @@ -124,7 +126,7 @@ return [ 'Insert' => '', 'Insert the code you received by SMS.' => '', 'Insert the code you received by email.' => '', - 'Insert the mobile phone number on which to receive text message.' => '', + 'Insert the mobile phone number where you want to receive text message in international format' => '', 'Invalid login or password' => '', 'Invalid or expired link' => '', 'Invalid password' => '', @@ -141,7 +143,6 @@ return [ 'Logout' => '', 'Manage users' => '', 'Mobile phone number' => '', - 'Mobile phone number not registered.' => '', 'Mobile phone number successfully enabled.' => '', 'Name' => '', 'Networks' => '', @@ -287,6 +288,11 @@ return [ 'Your password has expired, you must change it now' => '', 'Your personal information has been removed' => '', 'Your profile has been updated' => '', + 'privacy policy' => '', + '{0, date, MMM dd, YYYY HH:mm}' => '', '{0, date, MMMM dd, YYYY HH:mm}' => '', '{0} cannot be blank.' => '', + 'Insert the mobile phone number on which to receive text message.' => '@@@@', + 'Insert the mobile phone number where you want to receive text message.' => '@@@@', + 'Mobile phone number not registered.' => '@@@@', ]; diff --git a/src/User/resources/i18n/da/usuario.php b/src/User/resources/i18n/da/usuario.php index 843098b..8d6dd3f 100644 --- a/src/User/resources/i18n/da/usuario.php +++ b/src/User/resources/i18n/da/usuario.php @@ -105,6 +105,7 @@ return [ 'Error occurred while deleting user' => '', 'Error sending registration message to "{email}". Please try again later.' => '', 'Error sending welcome message to "{email}". Please try again later.' => '', + 'Error while enabling SMS two factor authentication.' => '', 'Export my data' => '', 'Finish' => '', 'Force password change at next login' => '', @@ -113,6 +114,7 @@ return [ 'Gravatar email' => '', 'Hello' => '', 'Here you can download your personal data in a comma separated values format.' => '', + 'I agree processing of my personal data and the use of cookies to facilitate the operation of this site. For more information read our {privacyPolicy}' => '', 'If you already registered, sign in and connect this account on settings page' => '', 'If you cannot click the link, please try pasting the text into your browser' => '', 'If you did not make this request you can ignore this email' => '', @@ -124,7 +126,7 @@ return [ 'Insert' => '', 'Insert the code you received by SMS.' => '', 'Insert the code you received by email.' => '', - 'Insert the mobile phone number on which to receive text message.' => '', + 'Insert the mobile phone number where you want to receive text message in international format' => '', 'Invalid login or password' => '', 'Invalid or expired link' => '', 'Invalid password' => '', @@ -141,7 +143,6 @@ return [ 'Logout' => '', 'Manage users' => '', 'Mobile phone number' => '', - 'Mobile phone number not registered.' => '', 'Mobile phone number successfully enabled.' => '', 'Name' => '', 'Networks' => '', @@ -287,6 +288,11 @@ return [ 'Your password has expired, you must change it now' => '', 'Your personal information has been removed' => '', 'Your profile has been updated' => '', + 'privacy policy' => '', + '{0, date, MMM dd, YYYY HH:mm}' => '', '{0, date, MMMM dd, YYYY HH:mm}' => '', '{0} cannot be blank.' => '', + 'Insert the mobile phone number on which to receive text message.' => '@@@@', + 'Insert the mobile phone number where you want to receive text message.' => '@@@@', + 'Mobile phone number not registered.' => '@@@@', ]; diff --git a/src/User/resources/i18n/de-DU/usuario.php b/src/User/resources/i18n/de-DU/usuario.php index db98447..68b45a6 100644 --- a/src/User/resources/i18n/de-DU/usuario.php +++ b/src/User/resources/i18n/de-DU/usuario.php @@ -275,14 +275,13 @@ return [ '{0} cannot be blank.' => '{0} darf nicht leer sein.', 'According to the European General Data Protection Regulation (GDPR) we need your consent to work with your personal data.' => '', 'Data privacy' => '', - 'Every user having your role has two factor authentication mandatory, you must enable it' => '', + 'Error while enabling SMS two factor authentication.' => '', 'Google Authenticator' => '', 'Insert' => '', 'Insert the code you received by SMS.' => '', 'Insert the code you received by email.' => '', - 'Insert the mobile phone number on which to receive text message.' => '', + 'Insert the mobile phone number where you want to receive text message in international format' => '', 'Mobile phone number' => '', - 'Mobile phone number not registered.' => '', 'Mobile phone number successfully enabled.' => '', 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please click on \'Cancel\' and repeat the login request.' => '', 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please close this window and repeat the enabling request.' => '', @@ -294,4 +293,8 @@ return [ 'Unfortunately, you can not work with this site without giving us consent to process your data.' => '', 'Your consent is required to work with this site' => '', 'A message has been sent to your email address. ' => '@@Eine Nachricht wurde an Deine E-Mail Adresse gesendet@@', + 'Every user having your role has two factor authentication mandatory, you must enable it' => '@@@@', + 'Insert the mobile phone number on which to receive text message.' => '@@@@', + 'Insert the mobile phone number where you want to receive text message.' => '@@@@', + 'Mobile phone number not registered.' => '@@@@', ]; diff --git a/src/User/resources/i18n/de/usuario.php b/src/User/resources/i18n/de/usuario.php index 91f2e2b..0564503 100644 --- a/src/User/resources/i18n/de/usuario.php +++ b/src/User/resources/i18n/de/usuario.php @@ -22,6 +22,7 @@ return [ 'A message has been sent to your email address. It contains a confirmation link that you must click to complete registration.' => 'Eine Nachricht wurde an Ihre E-Mail-Adresse gesendet. Sie enthält einen Bestätigungslink, den Sie anklicken müssen, um die Registrierung abzuschließen.', 'A new confirmation link has been sent' => 'Ein neuer Bestätigungslink wurde versendet', 'A password will be generated automatically if not provided' => 'Leer lassen, um automatisch ein Passwort zu generieren', + 'According to the European General Data Protection Regulation (GDPR) we need your consent to work with your personal data.' => 'Gemäß der europäischen Datenschutzgrundverordnung (DSGVO) benötigen wir Ihre Zustimmung, um mit Ihren personenbezogenen Daten zu arbeiten.', 'Account' => 'Konto', 'Account confirmation' => 'Kontobestätigung', 'Account details' => 'Kontodetails', @@ -82,6 +83,7 @@ return [ 'Credentials will be sent to the user by email' => 'Die Zugangsdaten werden dem Nutzer per E-Mail versendet', 'Current password' => 'Aktuelles Passwort', 'Current password is not valid' => 'Das aktuelle Passwort ist nicht korrekt', + 'Data privacy' => 'Datenschutz', 'Data processing consent' => 'Zustimmung zur Datenverarbeitung', 'Delete' => 'Löschen', 'Delete account' => 'Konto Löschen', @@ -187,6 +189,7 @@ return [ 'Sign in' => 'Anmelden', 'Sign up' => 'Registrieren', 'Something went wrong' => 'Etwas ist schief gelaufen', + 'Submit' => 'Absenden', 'Switch identities is disabled.' => 'Identitäten wechseln ist deaktiviert.', 'Thank you for signing up on {0}' => 'Danke für ihre Registrierung auf {0}', 'Thank you, registration is now complete.' => 'Danke, ihre Registrierung ist nun abgeschlossen.', @@ -221,6 +224,7 @@ return [ 'Unable to update block status.' => 'Konnte den Block-Status nicht ändern', 'Unblock' => 'Freischalten', 'Unconfirmed' => 'Unbestätigt', + 'Unfortunately, you can not work with this site without giving us consent to process your data.' => 'Leider können Sie nicht mit dieser Seite arbeiten, ohne uns die Zustimmung zur Verarbeitung Ihrer Daten zu geben.', 'Update' => 'Bearbeiten', 'Update assignments' => 'Zuweisung ändern', 'Update permission' => 'Berechtigung ändern', @@ -264,6 +268,7 @@ return [ 'Your account on {0} has been created' => 'Ihr Konto auf {0} wurde erstellt', 'Your confirmation token is invalid or expired' => 'Ihr Bestätigungstoken ist falsch oder abgelaufen', 'Your consent is required to register' => 'Sie müssen Ihre Zustimmung registrieren', + 'Your consent is required to work with this site' => 'Ihre Zustimmung ist erforderlich, um mit dieser Website zu arbeiten', 'Your email address has been changed' => 'Ihre E-Mail-Adresse wurde geändert', 'Your password has expired, you must change it now' => 'Ihr Passwort ist abgelaufen, Sie müssen es jetzt ändern', 'Your personal information has been removed' => 'Ihre persönlichen Daten wurden gelöscht', @@ -272,20 +277,14 @@ return [ '{0, date, MMM dd, YYYY HH:mm}' => '{0, date, dd. MMM YYYY, HH:mm}', '{0, date, MMMM dd, YYYY HH:mm}' => '{0, date, dd. MMMM YYYY, HH:mm}', '{0} cannot be blank.' => '{0} darf nicht leer sein.', - 'According to the European General Data Protection Regulation (GDPR) we need your consent to work with your personal data.' => 'Gemäß der europäischen Datenschutzgrundverordnung (DSGVO) benötigen wir Ihre Zustimmung, um mit Ihren personenbezogenen Daten zu arbeiten.', - 'Data privacy' => 'Datenschutz', - 'Submit' => 'Absenden', - 'Unfortunately, you can not work with this site without giving us consent to process your data.' => 'Leider können Sie nicht mit dieser Seite arbeiten, ohne uns die Zustimmung zur Verarbeitung Ihrer Daten zu geben.', - 'Your consent is required to work with this site' => 'Ihre Zustimmung ist erforderlich, um mit dieser Website zu arbeiten', - 'Every user having your role has two factor authentication mandatory, you must enable it' => '', + 'Error while enabling SMS two factor authentication.' => '', 'Google Authenticator' => '', 'Information' => '', 'Insert' => '', 'Insert the code you received by SMS.' => '', 'Insert the code you received by email.' => '', - 'Insert the mobile phone number on which to receive text message.' => '', + 'Insert the mobile phone number where you want to receive text message in international format' => '', 'Mobile phone number' => '', - 'Mobile phone number not registered.' => '', 'Mobile phone number successfully enabled.' => '', 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please click on \'Cancel\' and repeat the login request.' => '', 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please close this window and repeat the enabling request.' => '', @@ -293,5 +292,9 @@ return [ 'This is the code to insert to enable two factor authentication' => '', 'Two factor authentication code by SMS' => '', 'Two factor authentication code by email' => '', + 'Every user having your role has two factor authentication mandatory, you must enable it' => '@@@@', + 'Insert the mobile phone number on which to receive text message.' => '@@@@', + 'Insert the mobile phone number where you want to receive text message.' => '@@@@', + 'Mobile phone number not registered.' => '@@@@', 'Now you can resume the login process' => '@@@@', ]; diff --git a/src/User/resources/i18n/es/usuario.php b/src/User/resources/i18n/es/usuario.php index 2cb4750..1d90550 100644 --- a/src/User/resources/i18n/es/usuario.php +++ b/src/User/resources/i18n/es/usuario.php @@ -276,14 +276,13 @@ return [ 'privacy policy' => 'política de privacidad', '{0, date, MMMM dd, YYYY HH:mm}' => '{0, date, dd MMMM, YYYY HH:mm}', '{0} cannot be blank.' => '{0} no puede estar vacío.', - 'Every user having your role has two factor authentication mandatory, you must enable it' => '', + 'Error while enabling SMS two factor authentication.' => '', 'Google Authenticator' => '', 'Insert' => '', 'Insert the code you received by SMS.' => '', 'Insert the code you received by email.' => '', - 'Insert the mobile phone number on which to receive text message.' => '', + 'Insert the mobile phone number where you want to receive text message in international format' => '', 'Mobile phone number' => '', - 'Mobile phone number not registered.' => '', 'Mobile phone number successfully enabled.' => '', 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please click on \'Cancel\' and repeat the login request.' => '', 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please close this window and repeat the enabling request.' => '', @@ -294,5 +293,9 @@ return [ 'Your consent is required to work with this site' => '', '{0, date, MMM dd, YYYY HH:mm}' => '', 'An email has been sent with instructions for resetting your password' => '@@Se ha enviado un correo electrónico con instrucciones para restablecer su contraseña@@', + 'Every user having your role has two factor authentication mandatory, you must enable it' => '@@@@', + 'Insert the mobile phone number on which to receive text message.' => '@@@@', + 'Insert the mobile phone number where you want to receive text message.' => '@@@@', + 'Mobile phone number not registered.' => '@@@@', 'Two factor authentication protects you against stolen credentials' => '@@La autenticación de dos factores le protege del robo de credenciales@@', ]; diff --git a/src/User/resources/i18n/et/usuario.php b/src/User/resources/i18n/et/usuario.php index 86bcfb7..fe54eb2 100644 --- a/src/User/resources/i18n/et/usuario.php +++ b/src/User/resources/i18n/et/usuario.php @@ -109,6 +109,7 @@ return [ 'Gravatar email' => 'Gravatari e-posti aadress', 'Hello' => 'Tere', 'Here you can download your personal data in a comma separated values format.' => 'Siit saad alla laadida sinuga seotud andmed CSV formaadis.', + 'I agree processing of my personal data and the use of cookies to facilitate the operation of this site. For more information read our {privacyPolicy}' => 'Nõusutn oma isikuandmete töötlemise ning küpsiste kasutamisega, et selle lehe kasutamiset hõlbustada. Lisainfot loe lehelt {privacyPolicy}.', 'If you already registered, sign in and connect this account on settings page' => 'Kui oled juba registreerunud, logi sisse ja ühenda see konto oma seadete lehel', 'If you cannot click the link, please try pasting the text into your browser' => 'Kui sa ei saa lingil klikkida, proovi see kleepida oma brausri aadressireale', 'If you did not make this request you can ignore this email' => 'Kui sa ei ole seda päringut tellinud, siis võid seda kirja ignoreerida', @@ -264,18 +265,18 @@ return [ 'Your password has expired, you must change it now' => 'Sinu parool on aegunud, pead seda uuendama.', 'Your personal information has been removed' => 'Sinu isiklikud andmed on kustutatud', 'Your profile has been updated' => 'Sinu profiil on uuendatud', + 'privacy policy' => 'privaatsuspoliitika', '{0} cannot be blank.' => '{0} ei või olla tühi.', 'According to the European General Data Protection Regulation (GDPR) we need your consent to work with your personal data.' => '', 'Authentication rule class {0} can not be instantiated' => '', 'Data privacy' => '', - 'Every user having your role has two factor authentication mandatory, you must enable it' => '', + 'Error while enabling SMS two factor authentication.' => '', 'Google Authenticator' => '', 'Insert' => '', 'Insert the code you received by SMS.' => '', 'Insert the code you received by email.' => '', - 'Insert the mobile phone number on which to receive text message.' => '', + 'Insert the mobile phone number where you want to receive text message in international format' => '', 'Mobile phone number' => '', - 'Mobile phone number not registered.' => '', 'Mobile phone number successfully enabled.' => '', 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please click on \'Cancel\' and repeat the login request.' => '', 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please close this window and repeat the enabling request.' => '', @@ -291,6 +292,8 @@ return [ 'Your consent is required to work with this site' => '', '{0, date, MMM dd, YYYY HH:mm}' => '', '{0, date, MMMM dd, YYYY HH:mm}' => '', - 'I agree processing of my personal data and the use of cookies to facilitate the operation of this site. For more information read our {privacyPolicy}' => 'Nõusutn oma isikuandmete töötlemise ning küpsiste kasutamisega, et selle lehe kasutamiset hõlbustada. Lisainfot loe lehelt {privacyPolicy}.', - 'privacy policy' => 'privaatsuspoliitika', + 'Every user having your role has two factor authentication mandatory, you must enable it' => '@@@@', + 'Insert the mobile phone number on which to receive text message.' => '@@@@', + 'Insert the mobile phone number where you want to receive text message.' => '@@@@', + 'Mobile phone number not registered.' => '@@@@', ]; diff --git a/src/User/resources/i18n/fa-IR/usuario.php b/src/User/resources/i18n/fa-IR/usuario.php index c93ed9a..6cb7a29 100644 --- a/src/User/resources/i18n/fa-IR/usuario.php +++ b/src/User/resources/i18n/fa-IR/usuario.php @@ -190,16 +190,18 @@ return [ 'Enable two factor authentication' => '', 'Error sending registration message to "{email}". Please try again later.' => '', 'Error sending welcome message to "{email}". Please try again later.' => '', + 'Error while enabling SMS two factor authentication.' => '', 'Export my data' => '', 'Force password change at next login' => '', 'Google Authenticator' => '', 'Here you can download your personal data in a comma separated values format.' => '', + 'I agree processing of my personal data and the use of cookies to facilitate the operation of this site. For more information read our {privacyPolicy}' => '', 'Impersonate this user' => '', 'In order to finish your registration, we need you to enter following fields' => '', 'Insert' => '', 'Insert the code you received by SMS.' => '', 'Insert the code you received by email.' => '', - 'Insert the mobile phone number on which to receive text message.' => '', + 'Insert the mobile phone number where you want to receive text message in international format' => '', 'Invalid password' => '', 'Invalid two factor authentication code' => '', 'Invalid value' => '', @@ -209,7 +211,6 @@ return [ 'Last login time' => '', 'Last password change' => '', 'Mobile phone number' => '', - 'Mobile phone number not registered.' => '', 'Mobile phone number successfully enabled.' => '', 'Never' => '', 'New rule' => '', @@ -288,7 +289,12 @@ return [ 'Your consent is required to work with this site' => '', 'Your password has expired, you must change it now' => '', 'Your personal information has been removed' => '', + 'privacy policy' => '', + '{0, date, MMM dd, YYYY HH:mm}' => '', '{0} cannot be blank.' => '', 'An email has been sent with instructions for resetting your password' => '@@ایمیلی حاوی راهنمایی برای تنظیم مجدد رمز عبور به شما ارسال شد@@', + 'Insert the mobile phone number on which to receive text message.' => '@@@@', + 'Insert the mobile phone number where you want to receive text message.' => '@@@@', + 'Mobile phone number not registered.' => '@@@@', 'Registration ip' => '@@ای پی ثبت نام@@', ]; diff --git a/src/User/resources/i18n/fi/usuario.php b/src/User/resources/i18n/fi/usuario.php index 843098b..8d6dd3f 100644 --- a/src/User/resources/i18n/fi/usuario.php +++ b/src/User/resources/i18n/fi/usuario.php @@ -105,6 +105,7 @@ return [ 'Error occurred while deleting user' => '', 'Error sending registration message to "{email}". Please try again later.' => '', 'Error sending welcome message to "{email}". Please try again later.' => '', + 'Error while enabling SMS two factor authentication.' => '', 'Export my data' => '', 'Finish' => '', 'Force password change at next login' => '', @@ -113,6 +114,7 @@ return [ 'Gravatar email' => '', 'Hello' => '', 'Here you can download your personal data in a comma separated values format.' => '', + 'I agree processing of my personal data and the use of cookies to facilitate the operation of this site. For more information read our {privacyPolicy}' => '', 'If you already registered, sign in and connect this account on settings page' => '', 'If you cannot click the link, please try pasting the text into your browser' => '', 'If you did not make this request you can ignore this email' => '', @@ -124,7 +126,7 @@ return [ 'Insert' => '', 'Insert the code you received by SMS.' => '', 'Insert the code you received by email.' => '', - 'Insert the mobile phone number on which to receive text message.' => '', + 'Insert the mobile phone number where you want to receive text message in international format' => '', 'Invalid login or password' => '', 'Invalid or expired link' => '', 'Invalid password' => '', @@ -141,7 +143,6 @@ return [ 'Logout' => '', 'Manage users' => '', 'Mobile phone number' => '', - 'Mobile phone number not registered.' => '', 'Mobile phone number successfully enabled.' => '', 'Name' => '', 'Networks' => '', @@ -287,6 +288,11 @@ return [ 'Your password has expired, you must change it now' => '', 'Your personal information has been removed' => '', 'Your profile has been updated' => '', + 'privacy policy' => '', + '{0, date, MMM dd, YYYY HH:mm}' => '', '{0, date, MMMM dd, YYYY HH:mm}' => '', '{0} cannot be blank.' => '', + 'Insert the mobile phone number on which to receive text message.' => '@@@@', + 'Insert the mobile phone number where you want to receive text message.' => '@@@@', + 'Mobile phone number not registered.' => '@@@@', ]; diff --git a/src/User/resources/i18n/fr/usuario.php b/src/User/resources/i18n/fr/usuario.php index 12bf6b8..a204e9e 100644 --- a/src/User/resources/i18n/fr/usuario.php +++ b/src/User/resources/i18n/fr/usuario.php @@ -110,6 +110,7 @@ return [ 'Gravatar email' => 'Email gravatar', 'Hello' => 'Bonjour', 'Here you can download your personal data in a comma separated values format.' => 'Ici vous pouvez télécharger vos données personnelles dans un format avec les données séparées par des virgules', + 'I agree processing of my personal data and the use of cookies to facilitate the operation of this site. For more information read our {privacyPolicy}' => 'J\'accepte le traitement de mes données personnelles et l\'utilisation de cookies pour faciliter le fonctionnement de ce site. Pour plus d\'information, lisez notre {privacyPolicy}', 'If you already registered, sign in and connect this account on settings page' => 'Si vous êtes déjà inscrit, connectez-vous et liez ce compte dans la page des réglages', 'If you cannot click the link, please try pasting the text into your browser' => 'Si vous ne parvenez pas à cliquer sur le lien, veuillez essayer de coller le texte dans votre navigateur', 'If you did not make this request you can ignore this email' => 'Si vous n\'avez pas fait cette demande, vous pouvez ignorer cet email', @@ -268,18 +269,18 @@ return [ 'Your password has expired, you must change it now' => 'Votre mot de passe a expiré, vous devez le renouveler maintenant', 'Your personal information has been removed' => 'Vos données personnelles ont été supprimées', 'Your profile has been updated' => 'Votre profil a été mis à jour', + 'privacy policy' => 'politique de confidentialité', '{0, date, MMMM dd, YYYY HH:mm}' => '{0, date, dd MMMM YYYY HH:mm}', '{0} cannot be blank.' => '{0} ne peut être vide.', 'According to the European General Data Protection Regulation (GDPR) we need your consent to work with your personal data.' => '', 'Data privacy' => '', - 'Every user having your role has two factor authentication mandatory, you must enable it' => '', + 'Error while enabling SMS two factor authentication.' => '', 'Google Authenticator' => '', 'Insert' => '', 'Insert the code you received by SMS.' => '', 'Insert the code you received by email.' => '', - 'Insert the mobile phone number on which to receive text message.' => '', + 'Insert the mobile phone number where you want to receive text message in international format' => '', 'Mobile phone number' => '', - 'Mobile phone number not registered.' => '', 'Mobile phone number successfully enabled.' => '', 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please click on \'Cancel\' and repeat the login request.' => '', 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please close this window and repeat the enabling request.' => '', @@ -291,6 +292,8 @@ return [ 'Unfortunately, you can not work with this site without giving us consent to process your data.' => '', 'Your consent is required to work with this site' => '', '{0, date, MMM dd, YYYY HH:mm}' => '', - 'I agree processing of my personal data and the use of cookies to facilitate the operation of this site. For more information read our {privacyPolicy}' => 'J\'accepte le traitement de mes données personnelles et l\'utilisation de cookies pour faciliter le fonctionnement de ce site. Pour plus d\'information, lisez notre {privacyPolicy}', - 'privacy policy' => 'politique de confidentialité', + 'Every user having your role has two factor authentication mandatory, you must enable it' => '@@@@', + 'Insert the mobile phone number on which to receive text message.' => '@@@@', + 'Insert the mobile phone number where you want to receive text message.' => '@@@@', + 'Mobile phone number not registered.' => '@@@@', ]; diff --git a/src/User/resources/i18n/hr/usuario.php b/src/User/resources/i18n/hr/usuario.php index 843098b..8d6dd3f 100644 --- a/src/User/resources/i18n/hr/usuario.php +++ b/src/User/resources/i18n/hr/usuario.php @@ -105,6 +105,7 @@ return [ 'Error occurred while deleting user' => '', 'Error sending registration message to "{email}". Please try again later.' => '', 'Error sending welcome message to "{email}". Please try again later.' => '', + 'Error while enabling SMS two factor authentication.' => '', 'Export my data' => '', 'Finish' => '', 'Force password change at next login' => '', @@ -113,6 +114,7 @@ return [ 'Gravatar email' => '', 'Hello' => '', 'Here you can download your personal data in a comma separated values format.' => '', + 'I agree processing of my personal data and the use of cookies to facilitate the operation of this site. For more information read our {privacyPolicy}' => '', 'If you already registered, sign in and connect this account on settings page' => '', 'If you cannot click the link, please try pasting the text into your browser' => '', 'If you did not make this request you can ignore this email' => '', @@ -124,7 +126,7 @@ return [ 'Insert' => '', 'Insert the code you received by SMS.' => '', 'Insert the code you received by email.' => '', - 'Insert the mobile phone number on which to receive text message.' => '', + 'Insert the mobile phone number where you want to receive text message in international format' => '', 'Invalid login or password' => '', 'Invalid or expired link' => '', 'Invalid password' => '', @@ -141,7 +143,6 @@ return [ 'Logout' => '', 'Manage users' => '', 'Mobile phone number' => '', - 'Mobile phone number not registered.' => '', 'Mobile phone number successfully enabled.' => '', 'Name' => '', 'Networks' => '', @@ -287,6 +288,11 @@ return [ 'Your password has expired, you must change it now' => '', 'Your personal information has been removed' => '', 'Your profile has been updated' => '', + 'privacy policy' => '', + '{0, date, MMM dd, YYYY HH:mm}' => '', '{0, date, MMMM dd, YYYY HH:mm}' => '', '{0} cannot be blank.' => '', + 'Insert the mobile phone number on which to receive text message.' => '@@@@', + 'Insert the mobile phone number where you want to receive text message.' => '@@@@', + 'Mobile phone number not registered.' => '@@@@', ]; diff --git a/src/User/resources/i18n/hu/usuario.php b/src/User/resources/i18n/hu/usuario.php index 6670a01..7d33fdd 100644 --- a/src/User/resources/i18n/hu/usuario.php +++ b/src/User/resources/i18n/hu/usuario.php @@ -272,14 +272,13 @@ return [ 'According to the European General Data Protection Regulation (GDPR) we need your consent to work with your personal data.' => '', 'An email with instructions to create a new password has been sent to {email} if it is associated with an {appName} account. Your existing password has not been changed.' => '', 'Data privacy' => '', - 'Every user having your role has two factor authentication mandatory, you must enable it' => '', + 'Error while enabling SMS two factor authentication.' => '', 'Google Authenticator' => '', 'Insert' => '', 'Insert the code you received by SMS.' => '', 'Insert the code you received by email.' => '', - 'Insert the mobile phone number on which to receive text message.' => '', + 'Insert the mobile phone number where you want to receive text message in international format' => '', 'Mobile phone number' => '', - 'Mobile phone number not registered.' => '', 'Mobile phone number successfully enabled.' => '', 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please click on \'Cancel\' and repeat the login request.' => '', 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please close this window and repeat the enabling request.' => '', @@ -298,9 +297,13 @@ return [ 'Awesome, almost there. ' => '@@Hurrá, majdnem kész.@@', 'Disable Two-Factor Auth' => '@@Letiltja a kétütemű hitelesítést@@', 'Enable Two-factor auth' => '@@Engedélyezze a kétütemű hitelesítést@@', + 'Every user having your role has two factor authentication mandatory, you must enable it' => '@@@@', 'I aggree processing of my personal data and the use of cookies to facilitate the operation of this site. For more information read our {privacyPolicy}' => '@@Aggregálom a személyes adataim feldolgozását és a cookie-k használatát a webhely működésének megkönnyítése érdekében. További információért olvassa el a {privacyPolicy}@@', + 'Insert the mobile phone number on which to receive text message.' => '@@@@', + 'Insert the mobile phone number where you want to receive text message.' => '@@@@', 'Invalid two-factor code' => '@@Érvénytelen kétütemű kód@@', 'Last login' => '@@Utolsó bejelentkezés@@', + 'Mobile phone number not registered.' => '@@@@', 'This will disable two-factor auth. Are you sure?' => '@@Ez letiltja a kétütemű hitelesítést. biztos vagy ebben?@@', 'Two Factor Authentication' => '@@Két tényező hitelesítés@@', 'Two factor authentication protects you against stolen credentials' => '@@Két tényező-hitelesítés megvédi az ellopott hitelesítő adatokat@@', diff --git a/src/User/resources/i18n/it/usuario.php b/src/User/resources/i18n/it/usuario.php index d884e27..8295187 100644 --- a/src/User/resources/i18n/it/usuario.php +++ b/src/User/resources/i18n/it/usuario.php @@ -105,6 +105,7 @@ return [ 'Error occurred while deleting user' => 'Si è verificato un errore durante l\'eliminazione dell\'utente', 'Error sending registration message to "{email}". Please try again later.' => 'C\'è stato un errore nell\'invio del messaggio di registrazione all\'indirizzo "{email}". Per favore ritenta più tardi.', 'Error sending welcome message to "{email}". Please try again later.' => 'C\'è stato un errore nell\'invio del messaggio di benvenuto all\'indirizzo "{email}". Per favore ritenta più tardi.', + 'Error while enabling SMS two factor authentication.' => 'Errore in fase di attivazione dell\'autenticazione a due fattori tramite SMS', 'Export my data' => 'Esporta i miei dati', 'Finish' => 'Completa', 'Force password change at next login' => 'Forza il cambio password al prossimo accesso', @@ -125,7 +126,6 @@ return [ 'Insert' => 'Inserisci', 'Insert the code you received by SMS.' => 'Inserisci il codice ricevuto tramite SMS.', 'Insert the code you received by email.' => 'Inserisci il codice ricevuto tramite email.', - 'Insert the mobile phone number on which to receive text message.' => 'Inserisci il numero del cellulare sul quale ricevere i codici.', 'Invalid login or password' => 'Utente o password non validi', 'Invalid or expired link' => 'Collegamento non valido o scaduto', 'Invalid password' => 'Password non valida', @@ -142,7 +142,6 @@ return [ 'Logout' => 'Esci', 'Manage users' => 'Gestisci gli utenti', 'Mobile phone number' => 'Numero di cellulare', - 'Mobile phone number not registered.' => 'L\'attivazione del numero di cellulare non è riuscita', 'Mobile phone number successfully enabled.' => 'Il numero di cellulare è stato abilitato', 'Name' => 'Nome', 'Networks' => 'Rete', @@ -291,8 +290,12 @@ return [ '{0, date, MMM dd, YYYY HH:mm}' => '{0, date, MMM dd, YYYY HH:mm}', '{0, date, MMMM dd, YYYY HH:mm}' => '{0, date, dd MMMM YYYY HH:mm}', '{0} cannot be blank.' => '{0} non può essere vuoto.', + 'Insert the mobile phone number where you want to receive text message in international format' => '', 'This is the code to insert to enable two factor authentication' => '', 'An email has been sent with instructions for resetting your password' => '@@È stata inviata un\'email con le istruzioni per azzerare la tua password@@', + 'Insert the mobile phone number where you want to receive text message in international format.' => '@@@@', + 'Insert the mobile phone number where you want to receive the SMS.' => '@@Inserisci il numero del cellulare sul quale ricevere l\'SMS.@@', + 'Mobile phone number not registered.' => '@@L\'attivazione del numero di cellulare non è riuscita@@', 'Now you can resume the login process' => '@@Ora puoi riprendere il processo di autenticazione@@', 'Send new code' => '@@Invia un nuovo codice@@', ]; diff --git a/src/User/resources/i18n/kk/usuario.php b/src/User/resources/i18n/kk/usuario.php index 843098b..8d6dd3f 100644 --- a/src/User/resources/i18n/kk/usuario.php +++ b/src/User/resources/i18n/kk/usuario.php @@ -105,6 +105,7 @@ return [ 'Error occurred while deleting user' => '', 'Error sending registration message to "{email}". Please try again later.' => '', 'Error sending welcome message to "{email}". Please try again later.' => '', + 'Error while enabling SMS two factor authentication.' => '', 'Export my data' => '', 'Finish' => '', 'Force password change at next login' => '', @@ -113,6 +114,7 @@ return [ 'Gravatar email' => '', 'Hello' => '', 'Here you can download your personal data in a comma separated values format.' => '', + 'I agree processing of my personal data and the use of cookies to facilitate the operation of this site. For more information read our {privacyPolicy}' => '', 'If you already registered, sign in and connect this account on settings page' => '', 'If you cannot click the link, please try pasting the text into your browser' => '', 'If you did not make this request you can ignore this email' => '', @@ -124,7 +126,7 @@ return [ 'Insert' => '', 'Insert the code you received by SMS.' => '', 'Insert the code you received by email.' => '', - 'Insert the mobile phone number on which to receive text message.' => '', + 'Insert the mobile phone number where you want to receive text message in international format' => '', 'Invalid login or password' => '', 'Invalid or expired link' => '', 'Invalid password' => '', @@ -141,7 +143,6 @@ return [ 'Logout' => '', 'Manage users' => '', 'Mobile phone number' => '', - 'Mobile phone number not registered.' => '', 'Mobile phone number successfully enabled.' => '', 'Name' => '', 'Networks' => '', @@ -287,6 +288,11 @@ return [ 'Your password has expired, you must change it now' => '', 'Your personal information has been removed' => '', 'Your profile has been updated' => '', + 'privacy policy' => '', + '{0, date, MMM dd, YYYY HH:mm}' => '', '{0, date, MMMM dd, YYYY HH:mm}' => '', '{0} cannot be blank.' => '', + 'Insert the mobile phone number on which to receive text message.' => '@@@@', + 'Insert the mobile phone number where you want to receive text message.' => '@@@@', + 'Mobile phone number not registered.' => '@@@@', ]; diff --git a/src/User/resources/i18n/lt/usuario.php b/src/User/resources/i18n/lt/usuario.php index 843098b..8d6dd3f 100644 --- a/src/User/resources/i18n/lt/usuario.php +++ b/src/User/resources/i18n/lt/usuario.php @@ -105,6 +105,7 @@ return [ 'Error occurred while deleting user' => '', 'Error sending registration message to "{email}". Please try again later.' => '', 'Error sending welcome message to "{email}". Please try again later.' => '', + 'Error while enabling SMS two factor authentication.' => '', 'Export my data' => '', 'Finish' => '', 'Force password change at next login' => '', @@ -113,6 +114,7 @@ return [ 'Gravatar email' => '', 'Hello' => '', 'Here you can download your personal data in a comma separated values format.' => '', + 'I agree processing of my personal data and the use of cookies to facilitate the operation of this site. For more information read our {privacyPolicy}' => '', 'If you already registered, sign in and connect this account on settings page' => '', 'If you cannot click the link, please try pasting the text into your browser' => '', 'If you did not make this request you can ignore this email' => '', @@ -124,7 +126,7 @@ return [ 'Insert' => '', 'Insert the code you received by SMS.' => '', 'Insert the code you received by email.' => '', - 'Insert the mobile phone number on which to receive text message.' => '', + 'Insert the mobile phone number where you want to receive text message in international format' => '', 'Invalid login or password' => '', 'Invalid or expired link' => '', 'Invalid password' => '', @@ -141,7 +143,6 @@ return [ 'Logout' => '', 'Manage users' => '', 'Mobile phone number' => '', - 'Mobile phone number not registered.' => '', 'Mobile phone number successfully enabled.' => '', 'Name' => '', 'Networks' => '', @@ -287,6 +288,11 @@ return [ 'Your password has expired, you must change it now' => '', 'Your personal information has been removed' => '', 'Your profile has been updated' => '', + 'privacy policy' => '', + '{0, date, MMM dd, YYYY HH:mm}' => '', '{0, date, MMMM dd, YYYY HH:mm}' => '', '{0} cannot be blank.' => '', + 'Insert the mobile phone number on which to receive text message.' => '@@@@', + 'Insert the mobile phone number where you want to receive text message.' => '@@@@', + 'Mobile phone number not registered.' => '@@@@', ]; diff --git a/src/User/resources/i18n/nl/usuario.php b/src/User/resources/i18n/nl/usuario.php index c56e36f..21fa7d8 100644 --- a/src/User/resources/i18n/nl/usuario.php +++ b/src/User/resources/i18n/nl/usuario.php @@ -272,14 +272,13 @@ return [ 'According to the European General Data Protection Regulation (GDPR) we need your consent to work with your personal data.' => '', 'An email with instructions to create a new password has been sent to {email} if it is associated with an {appName} account. Your existing password has not been changed.' => '', 'Data privacy' => '', - 'Every user having your role has two factor authentication mandatory, you must enable it' => '', + 'Error while enabling SMS two factor authentication.' => '', 'Google Authenticator' => '', 'Insert' => '', 'Insert the code you received by SMS.' => '', 'Insert the code you received by email.' => '', - 'Insert the mobile phone number on which to receive text message.' => '', + 'Insert the mobile phone number where you want to receive text message in international format' => '', 'Mobile phone number' => '', - 'Mobile phone number not registered.' => '', 'Mobile phone number successfully enabled.' => '', 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please click on \'Cancel\' and repeat the login request.' => '', 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please close this window and repeat the enabling request.' => '', @@ -299,11 +298,15 @@ return [ 'Class "{0}" does not exist' => '@@Class "{0} bestaat niet@@', 'Disable Two-Factor Auth' => '@@Tweetraps authenticatie uitschakelen@@', 'Enable Two-factor auth' => '@@Tweetraps authenticatie inschakelen@@', + 'Every user having your role has two factor authentication mandatory, you must enable it' => '@@@@', 'I aggree processing of my personal data and the use of cookies to facilitate the operation of this site. For more information read our {privacyPolicy}' => '@@Ik ga akkoord dat mijn persoonlijke data en cookies worden verwerkt voor het gebruik van deze website. Voor meer informatie lees onze {privacyPolicy}@@', 'I aggree processing of my personal data and the use of cookies to facilitate the operation of this site. For more information read our {privacyPolicy}' => '@@Ik ga akkoord dat mijn persoonlijke data en cookies worden verwerkt voor het gebruik van deze website. Voor meer informatie lees onze {privacyPolicy}@@', + 'Insert the mobile phone number on which to receive text message.' => '@@@@', + 'Insert the mobile phone number where you want to receive text message.' => '@@@@', 'Invalid two-factor code' => '@@Ongeldige tweetraps authenticatie code@@', 'Last login' => '@@Laatste login@@', + 'Mobile phone number not registered.' => '@@@@', 'Registration ip' => '@@Registratie IP@@', 'Rule class can not be instantiated' => '@@Registratie IP@@', 'Rule class must extend "yii\\rbac\\Rule"' => '@@Regel klasse moet worden uitgebreid met "yii\\rbac\\Rule"@@', diff --git a/src/User/resources/i18n/pl/usuario.php b/src/User/resources/i18n/pl/usuario.php index cbe7fdd..77f2c38 100644 --- a/src/User/resources/i18n/pl/usuario.php +++ b/src/User/resources/i18n/pl/usuario.php @@ -272,14 +272,13 @@ return [ 'According to the European General Data Protection Regulation (GDPR) we need your consent to work with your personal data.' => '', 'An email with instructions to create a new password has been sent to {email} if it is associated with an {appName} account. Your existing password has not been changed.' => '', 'Data privacy' => '', - 'Every user having your role has two factor authentication mandatory, you must enable it' => '', + 'Error while enabling SMS two factor authentication.' => '', 'Google Authenticator' => '', 'Insert' => '', 'Insert the code you received by SMS.' => '', 'Insert the code you received by email.' => '', - 'Insert the mobile phone number on which to receive text message.' => '', + 'Insert the mobile phone number where you want to receive text message in international format' => '', 'Mobile phone number' => '', - 'Mobile phone number not registered.' => '', 'Mobile phone number successfully enabled.' => '', 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please click on \'Cancel\' and repeat the login request.' => '', 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please close this window and repeat the enabling request.' => '', @@ -296,8 +295,12 @@ return [ 'An email has been sent with instructions for resetting your password' => '@@Email z instrukcją resetowania hasła został wysłany@@', 'Disable Two-Factor Auth' => '@@Wyłącz uwierzytelnianie dwuetapowe@@', 'Enable Two-factor auth' => '@@Włącz uwierzytelnianie dwuetapowe@@', + 'Every user having your role has two factor authentication mandatory, you must enable it' => '@@@@', + 'Insert the mobile phone number on which to receive text message.' => '@@@@', + 'Insert the mobile phone number where you want to receive text message.' => '@@@@', 'Invalid two-factor code' => '@@Nieprawidłowy kod uwierzytelniania dwuetapowego@@', 'Last login' => '@@Data ostatniego logowania@@', + 'Mobile phone number not registered.' => '@@@@', 'This will disable two-factor auth. Are you sure?' => '@@To wyłączy uwierzytelnianie dwuetapowe. Czy jesteś pewny?@@', 'Two Factor Authentication' => '@@Uwierzytelnianie dwuetapowe@@', 'Two factor authentication protects you against stolen credentials' => '@@Uwierzytelnianie dwuetapowe chroni Cię przed kradzieżą danych logowania@@', diff --git a/src/User/resources/i18n/pt-BR/usuario.php b/src/User/resources/i18n/pt-BR/usuario.php index 40e1188..d6988ea 100644 --- a/src/User/resources/i18n/pt-BR/usuario.php +++ b/src/User/resources/i18n/pt-BR/usuario.php @@ -272,14 +272,13 @@ return [ 'According to the European General Data Protection Regulation (GDPR) we need your consent to work with your personal data.' => '', 'An email with instructions to create a new password has been sent to {email} if it is associated with an {appName} account. Your existing password has not been changed.' => '', 'Data privacy' => '', - 'Every user having your role has two factor authentication mandatory, you must enable it' => '', + 'Error while enabling SMS two factor authentication.' => '', 'Google Authenticator' => '', 'Insert' => '', 'Insert the code you received by SMS.' => '', 'Insert the code you received by email.' => '', - 'Insert the mobile phone number on which to receive text message.' => '', + 'Insert the mobile phone number where you want to receive text message in international format' => '', 'Mobile phone number' => '', - 'Mobile phone number not registered.' => '', 'Mobile phone number successfully enabled.' => '', 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please click on \'Cancel\' and repeat the login request.' => '', 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please close this window and repeat the enabling request.' => '', @@ -299,11 +298,15 @@ return [ 'Class "{0}" does not exist' => '@@A classe "{0}" não existe@@', 'Disable Two-Factor Auth' => '@@Desabilitar autenticação em dois fatores@@', 'Enable Two-factor auth' => '@@Habilitar autenticação em dois fatores@@', + 'Every user having your role has two factor authentication mandatory, you must enable it' => '@@@@', 'I aggree processing of my personal data and the use of cookies to facilitate the operation of this site. For more information read our {privacyPolicy}' => '@@Concordo com o processamento de meus dados pessoais e o uso de cookies para facilitar a operação deste site. Para mais informações, leia nosso {privacyPolicy}@@', 'I aggree processing of my personal data and the use of cookies to facilitate the operation of this site. For more information read our {privacyPolicy}' => '@@Concordo com o processamento de meus dados pessoais e o uso de cookies para facilitar a operação deste site. Para mais informações, leia nosso {privacyPolicy}@@', + 'Insert the mobile phone number on which to receive text message.' => '@@@@', + 'Insert the mobile phone number where you want to receive text message.' => '@@@@', 'Invalid two-factor code' => '@@Código de dois fatores inválido@@', 'Last login' => '@@Último login@@', + 'Mobile phone number not registered.' => '@@@@', 'Registration ip' => '@@IP de registro@@', 'Rule class can not be instantiated' => '@@A classe de regras não pode ser instanciada@@', 'Rule class must extend "yii\\rbac\\Rule"' => '@@A classe de regras deve estender de "yii\\rbac\\Rule"@@', diff --git a/src/User/resources/i18n/pt-PT/usuario.php b/src/User/resources/i18n/pt-PT/usuario.php index 53e6010..57af028 100644 --- a/src/User/resources/i18n/pt-PT/usuario.php +++ b/src/User/resources/i18n/pt-PT/usuario.php @@ -264,16 +264,15 @@ return [ 'Class' => '', 'Data privacy' => '', 'Email' => '', - 'Every user having your role has two factor authentication mandatory, you must enable it' => '', + 'Error while enabling SMS two factor authentication.' => '', 'Google Authenticator' => '', 'Gravatar email' => '', 'Insert' => '', 'Insert the code you received by SMS.' => '', 'Insert the code you received by email.' => '', - 'Insert the mobile phone number on which to receive text message.' => '', + 'Insert the mobile phone number where you want to receive text message in international format' => '', 'Items' => '', 'Mobile phone number' => '', - 'Mobile phone number not registered.' => '', 'Mobile phone number successfully enabled.' => '', 'Password' => '', 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please click on \'Cancel\' and repeat the login request.' => '', @@ -291,5 +290,10 @@ return [ 'Website' => '', 'Yandex' => '', 'Your consent is required to work with this site' => '', + '{0, date, MMM dd, YYYY HH:mm}' => '', '{0, date, MMMM dd, YYYY HH:mm}' => '', + 'Every user having your role has two factor authentication mandatory, you must enable it' => '@@@@', + 'Insert the mobile phone number on which to receive text message.' => '@@@@', + 'Insert the mobile phone number where you want to receive text message.' => '@@@@', + 'Mobile phone number not registered.' => '@@@@', ]; diff --git a/src/User/resources/i18n/ro/usuario.php b/src/User/resources/i18n/ro/usuario.php index e8b9d5c..8689ce1 100644 --- a/src/User/resources/i18n/ro/usuario.php +++ b/src/User/resources/i18n/ro/usuario.php @@ -272,14 +272,13 @@ return [ 'According to the European General Data Protection Regulation (GDPR) we need your consent to work with your personal data.' => '', 'An email with instructions to create a new password has been sent to {email} if it is associated with an {appName} account. Your existing password has not been changed.' => '', 'Data privacy' => '', - 'Every user having your role has two factor authentication mandatory, you must enable it' => '', + 'Error while enabling SMS two factor authentication.' => '', 'Google Authenticator' => '', 'Insert' => '', 'Insert the code you received by SMS.' => '', 'Insert the code you received by email.' => '', - 'Insert the mobile phone number on which to receive text message.' => '', + 'Insert the mobile phone number where you want to receive text message in international format' => '', 'Mobile phone number' => '', - 'Mobile phone number not registered.' => '', 'Mobile phone number successfully enabled.' => '', 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please click on \'Cancel\' and repeat the login request.' => '', 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please close this window and repeat the enabling request.' => '', @@ -298,11 +297,15 @@ return [ 'Awesome, almost there. ' => '@@Minunat, aproape gata.@@', 'Disable Two-Factor Auth' => '@@Dezactivați autentificarea cu două factori@@', 'Enable Two-factor auth' => '@@Activați Auth@@', + 'Every user having your role has two factor authentication mandatory, you must enable it' => '@@@@', 'I aggree processing of my personal data and the use of cookies to facilitate the operation of this site. For more information read our {privacyPolicy}' => '@@Am agregat prelucrarea datelor mele personale și utilizarea cookie-urilor pentru a facilita funcționarea acestui site. Pentru mai multe informații, citiți {privacyPolicy}@@', 'I aggree processing of my personal data and the use of cookies to facilitate the operation of this site. For more information read our {privacyPolicy}' => '@@Am agregat prelucrarea datelor mele personale și utilizarea cookie-urilor pentru a facilita funcționarea acestui site. Pentru mai multe informații, citiți {privacyPolicy}@@', + 'Insert the mobile phone number on which to receive text message.' => '@@@@', + 'Insert the mobile phone number where you want to receive text message.' => '@@@@', 'Invalid two-factor code' => '@@Cod de două factori nevalid@@', 'Last login' => '@@Ultima logare@@', + 'Mobile phone number not registered.' => '@@@@', 'This will disable two-factor auth. Are you sure?' => '@@Aceasta va dezactiva auth-ul cu două factori. Esti sigur?@@', 'Two Factor Authentication' => '@@Două autentificare cu factori@@', 'Two factor authentication protects you against stolen credentials' => '@@Autentificarea cu două factori vă protejează împotriva acreditărilor furate@@', diff --git a/src/User/resources/i18n/ru/usuario.php b/src/User/resources/i18n/ru/usuario.php index b3fbbd4..69ffb3e 100644 --- a/src/User/resources/i18n/ru/usuario.php +++ b/src/User/resources/i18n/ru/usuario.php @@ -275,14 +275,13 @@ return [ '{0} cannot be blank.' => '{0} не может быть пустым.', 'According to the European General Data Protection Regulation (GDPR) we need your consent to work with your personal data.' => '', 'Data privacy' => '', - 'Every user having your role has two factor authentication mandatory, you must enable it' => '', + 'Error while enabling SMS two factor authentication.' => '', 'Google Authenticator' => '', 'Insert' => '', 'Insert the code you received by SMS.' => '', 'Insert the code you received by email.' => '', - 'Insert the mobile phone number on which to receive text message.' => '', + 'Insert the mobile phone number where you want to receive text message in international format' => '', 'Mobile phone number' => '', - 'Mobile phone number not registered.' => '', 'Mobile phone number successfully enabled.' => '', 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please click on \'Cancel\' and repeat the login request.' => '', 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please close this window and repeat the enabling request.' => '', @@ -299,8 +298,12 @@ return [ 'Class "{0}" does not exist' => '@@Класс "{0}" не найден@@', 'Disable Two-Factor Auth' => '@@Отключить двухфакторную авторизацию@@', 'Enable Two-factor auth' => '@@Включить двухфакторную авторизацию@@', + 'Every user having your role has two factor authentication mandatory, you must enable it' => '@@@@', + 'Insert the mobile phone number on which to receive text message.' => '@@@@', + 'Insert the mobile phone number where you want to receive text message.' => '@@@@', 'Invalid two-factor code' => '@@Неверный код двухфакторной авторизации@@', 'Last login' => '@@Последний вход@@', + 'Mobile phone number not registered.' => '@@@@', 'Registration ip' => '@@IP при регистрации@@', 'Rule class can not be instantiated' => '@@Класс правила не может быть создан@@', 'Rule class must extend "yii\\rbac\\Rule"' => '@@Класс правила должен наследоваться от "yii\\rbac\\Rule"@@', diff --git a/src/User/resources/i18n/th/usuario.php b/src/User/resources/i18n/th/usuario.php index 843098b..8d6dd3f 100644 --- a/src/User/resources/i18n/th/usuario.php +++ b/src/User/resources/i18n/th/usuario.php @@ -105,6 +105,7 @@ return [ 'Error occurred while deleting user' => '', 'Error sending registration message to "{email}". Please try again later.' => '', 'Error sending welcome message to "{email}". Please try again later.' => '', + 'Error while enabling SMS two factor authentication.' => '', 'Export my data' => '', 'Finish' => '', 'Force password change at next login' => '', @@ -113,6 +114,7 @@ return [ 'Gravatar email' => '', 'Hello' => '', 'Here you can download your personal data in a comma separated values format.' => '', + 'I agree processing of my personal data and the use of cookies to facilitate the operation of this site. For more information read our {privacyPolicy}' => '', 'If you already registered, sign in and connect this account on settings page' => '', 'If you cannot click the link, please try pasting the text into your browser' => '', 'If you did not make this request you can ignore this email' => '', @@ -124,7 +126,7 @@ return [ 'Insert' => '', 'Insert the code you received by SMS.' => '', 'Insert the code you received by email.' => '', - 'Insert the mobile phone number on which to receive text message.' => '', + 'Insert the mobile phone number where you want to receive text message in international format' => '', 'Invalid login or password' => '', 'Invalid or expired link' => '', 'Invalid password' => '', @@ -141,7 +143,6 @@ return [ 'Logout' => '', 'Manage users' => '', 'Mobile phone number' => '', - 'Mobile phone number not registered.' => '', 'Mobile phone number successfully enabled.' => '', 'Name' => '', 'Networks' => '', @@ -287,6 +288,11 @@ return [ 'Your password has expired, you must change it now' => '', 'Your personal information has been removed' => '', 'Your profile has been updated' => '', + 'privacy policy' => '', + '{0, date, MMM dd, YYYY HH:mm}' => '', '{0, date, MMMM dd, YYYY HH:mm}' => '', '{0} cannot be blank.' => '', + 'Insert the mobile phone number on which to receive text message.' => '@@@@', + 'Insert the mobile phone number where you want to receive text message.' => '@@@@', + 'Mobile phone number not registered.' => '@@@@', ]; diff --git a/src/User/resources/i18n/tr-TR/usuario.php b/src/User/resources/i18n/tr-TR/usuario.php index 843098b..8d6dd3f 100644 --- a/src/User/resources/i18n/tr-TR/usuario.php +++ b/src/User/resources/i18n/tr-TR/usuario.php @@ -105,6 +105,7 @@ return [ 'Error occurred while deleting user' => '', 'Error sending registration message to "{email}". Please try again later.' => '', 'Error sending welcome message to "{email}". Please try again later.' => '', + 'Error while enabling SMS two factor authentication.' => '', 'Export my data' => '', 'Finish' => '', 'Force password change at next login' => '', @@ -113,6 +114,7 @@ return [ 'Gravatar email' => '', 'Hello' => '', 'Here you can download your personal data in a comma separated values format.' => '', + 'I agree processing of my personal data and the use of cookies to facilitate the operation of this site. For more information read our {privacyPolicy}' => '', 'If you already registered, sign in and connect this account on settings page' => '', 'If you cannot click the link, please try pasting the text into your browser' => '', 'If you did not make this request you can ignore this email' => '', @@ -124,7 +126,7 @@ return [ 'Insert' => '', 'Insert the code you received by SMS.' => '', 'Insert the code you received by email.' => '', - 'Insert the mobile phone number on which to receive text message.' => '', + 'Insert the mobile phone number where you want to receive text message in international format' => '', 'Invalid login or password' => '', 'Invalid or expired link' => '', 'Invalid password' => '', @@ -141,7 +143,6 @@ return [ 'Logout' => '', 'Manage users' => '', 'Mobile phone number' => '', - 'Mobile phone number not registered.' => '', 'Mobile phone number successfully enabled.' => '', 'Name' => '', 'Networks' => '', @@ -287,6 +288,11 @@ return [ 'Your password has expired, you must change it now' => '', 'Your personal information has been removed' => '', 'Your profile has been updated' => '', + 'privacy policy' => '', + '{0, date, MMM dd, YYYY HH:mm}' => '', '{0, date, MMMM dd, YYYY HH:mm}' => '', '{0} cannot be blank.' => '', + 'Insert the mobile phone number on which to receive text message.' => '@@@@', + 'Insert the mobile phone number where you want to receive text message.' => '@@@@', + 'Mobile phone number not registered.' => '@@@@', ]; diff --git a/src/User/resources/i18n/uk/usuario.php b/src/User/resources/i18n/uk/usuario.php index 1dd1a2e..11c0c0d 100644 --- a/src/User/resources/i18n/uk/usuario.php +++ b/src/User/resources/i18n/uk/usuario.php @@ -274,14 +274,13 @@ return [ '{0} cannot be blank.' => '{0} не може бути порожнім.', 'According to the European General Data Protection Regulation (GDPR) we need your consent to work with your personal data.' => '', 'Data privacy' => '', - 'Every user having your role has two factor authentication mandatory, you must enable it' => '', + 'Error while enabling SMS two factor authentication.' => '', 'Google Authenticator' => '', 'Insert' => '', 'Insert the code you received by SMS.' => '', 'Insert the code you received by email.' => '', - 'Insert the mobile phone number on which to receive text message.' => '', + 'Insert the mobile phone number where you want to receive text message in international format' => '', 'Mobile phone number' => '', - 'Mobile phone number not registered.' => '', 'Mobile phone number successfully enabled.' => '', 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please click on \'Cancel\' and repeat the login request.' => '', 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please close this window and repeat the enabling request.' => '', @@ -299,9 +298,13 @@ return [ 'Class "{0}" does not exist' => '@@Клас "{0}" не існує@@', 'Disable Two-Factor Auth' => '@@Вимкнути двофакторну аутентифікацію@@', 'Enable Two-factor auth' => '@@Увімкнути двофакторну аутентифікацію@@', + 'Every user having your role has two factor authentication mandatory, you must enable it' => '@@@@', 'I aggree processing of my personal data and the use of cookies to facilitate the operation of this site. For more information read our {privacyPolicy}' => '@@Я даю згоду на обробку моїх персональних даних та на використання cookie даним сайтом. Для більш детальної інформації ознайомтесь з {privacyPolicy}@@', + 'Insert the mobile phone number on which to receive text message.' => '@@@@', + 'Insert the mobile phone number where you want to receive text message.' => '@@@@', 'Invalid two-factor code' => '@@Невірний код двофакторної авторизації@@', 'Last login' => '@@Останній вхід@@', + 'Mobile phone number not registered.' => '@@@@', 'Registration ip' => '@@IP реєстрації@@', 'Rule class can not be instantiated' => '@@Клас Правила не може бути ініційований@@', 'Rule class must extend "yii\\rbac\\Rule"' => '@@Клас Правила має розширювати "yii\\rbac\\Rule"@@', diff --git a/src/User/resources/i18n/vi/usuario.php b/src/User/resources/i18n/vi/usuario.php index 843098b..8d6dd3f 100644 --- a/src/User/resources/i18n/vi/usuario.php +++ b/src/User/resources/i18n/vi/usuario.php @@ -105,6 +105,7 @@ return [ 'Error occurred while deleting user' => '', 'Error sending registration message to "{email}". Please try again later.' => '', 'Error sending welcome message to "{email}". Please try again later.' => '', + 'Error while enabling SMS two factor authentication.' => '', 'Export my data' => '', 'Finish' => '', 'Force password change at next login' => '', @@ -113,6 +114,7 @@ return [ 'Gravatar email' => '', 'Hello' => '', 'Here you can download your personal data in a comma separated values format.' => '', + 'I agree processing of my personal data and the use of cookies to facilitate the operation of this site. For more information read our {privacyPolicy}' => '', 'If you already registered, sign in and connect this account on settings page' => '', 'If you cannot click the link, please try pasting the text into your browser' => '', 'If you did not make this request you can ignore this email' => '', @@ -124,7 +126,7 @@ return [ 'Insert' => '', 'Insert the code you received by SMS.' => '', 'Insert the code you received by email.' => '', - 'Insert the mobile phone number on which to receive text message.' => '', + 'Insert the mobile phone number where you want to receive text message in international format' => '', 'Invalid login or password' => '', 'Invalid or expired link' => '', 'Invalid password' => '', @@ -141,7 +143,6 @@ return [ 'Logout' => '', 'Manage users' => '', 'Mobile phone number' => '', - 'Mobile phone number not registered.' => '', 'Mobile phone number successfully enabled.' => '', 'Name' => '', 'Networks' => '', @@ -287,6 +288,11 @@ return [ 'Your password has expired, you must change it now' => '', 'Your personal information has been removed' => '', 'Your profile has been updated' => '', + 'privacy policy' => '', + '{0, date, MMM dd, YYYY HH:mm}' => '', '{0, date, MMMM dd, YYYY HH:mm}' => '', '{0} cannot be blank.' => '', + 'Insert the mobile phone number on which to receive text message.' => '@@@@', + 'Insert the mobile phone number where you want to receive text message.' => '@@@@', + 'Mobile phone number not registered.' => '@@@@', ]; diff --git a/src/User/resources/i18n/zh-CN/usuario.php b/src/User/resources/i18n/zh-CN/usuario.php index 843098b..8d6dd3f 100644 --- a/src/User/resources/i18n/zh-CN/usuario.php +++ b/src/User/resources/i18n/zh-CN/usuario.php @@ -105,6 +105,7 @@ return [ 'Error occurred while deleting user' => '', 'Error sending registration message to "{email}". Please try again later.' => '', 'Error sending welcome message to "{email}". Please try again later.' => '', + 'Error while enabling SMS two factor authentication.' => '', 'Export my data' => '', 'Finish' => '', 'Force password change at next login' => '', @@ -113,6 +114,7 @@ return [ 'Gravatar email' => '', 'Hello' => '', 'Here you can download your personal data in a comma separated values format.' => '', + 'I agree processing of my personal data and the use of cookies to facilitate the operation of this site. For more information read our {privacyPolicy}' => '', 'If you already registered, sign in and connect this account on settings page' => '', 'If you cannot click the link, please try pasting the text into your browser' => '', 'If you did not make this request you can ignore this email' => '', @@ -124,7 +126,7 @@ return [ 'Insert' => '', 'Insert the code you received by SMS.' => '', 'Insert the code you received by email.' => '', - 'Insert the mobile phone number on which to receive text message.' => '', + 'Insert the mobile phone number where you want to receive text message in international format' => '', 'Invalid login or password' => '', 'Invalid or expired link' => '', 'Invalid password' => '', @@ -141,7 +143,6 @@ return [ 'Logout' => '', 'Manage users' => '', 'Mobile phone number' => '', - 'Mobile phone number not registered.' => '', 'Mobile phone number successfully enabled.' => '', 'Name' => '', 'Networks' => '', @@ -287,6 +288,11 @@ return [ 'Your password has expired, you must change it now' => '', 'Your personal information has been removed' => '', 'Your profile has been updated' => '', + 'privacy policy' => '', + '{0, date, MMM dd, YYYY HH:mm}' => '', '{0, date, MMMM dd, YYYY HH:mm}' => '', '{0} cannot be blank.' => '', + 'Insert the mobile phone number on which to receive text message.' => '@@@@', + 'Insert the mobile phone number where you want to receive text message.' => '@@@@', + 'Mobile phone number not registered.' => '@@@@', ]; diff --git a/src/User/resources/views/mail/text/twofactorcode.php b/src/User/resources/views/mail/text/twofactorcode.php index 0a9eaf4..1725566 100644 --- a/src/User/resources/views/mail/text/twofactorcode.php +++ b/src/User/resources/views/mail/text/twofactorcode.php @@ -15,7 +15,7 @@ ?> , -. +: diff --git a/src/User/resources/views/mail/twofactorcode.php b/src/User/resources/views/mail/twofactorcode.php index a1f0ea0..210f84c 100644 --- a/src/User/resources/views/mail/twofactorcode.php +++ b/src/User/resources/views/mail/twofactorcode.php @@ -19,6 +19,9 @@ use yii\helpers\Html;

,

+

+ : +

diff --git a/src/User/resources/views/settings/two-factor-sms.php b/src/User/resources/views/settings/two-factor-sms.php index 166f99a..17823aa 100644 --- a/src/User/resources/views/settings/two-factor-sms.php +++ b/src/User/resources/views/settings/two-factor-sms.php @@ -18,7 +18,7 @@

From 97a2de2f48995260e31a24125cbb5319f79c95f4 Mon Sep 17 00:00:00 2001 From: Antonio Cordeddu Date: Tue, 9 Aug 2022 12:21:34 +0200 Subject: [PATCH 03/10] PR #458 - fix and improvement required by @mp1509 --- composer.json | 3 + docs/installation/configuration-options.md | 22 ++--- src/User/Bootstrap.php | 20 +++-- src/User/Controller/SettingsController.php | 2 +- src/User/Form/LoginForm.php | 2 +- .../TwoFactorEmailCodeGeneratorService.php | 14 ++-- .../TwoFactorSmsCodeGeneratorService.php | 22 +++-- .../Validator/TwoFactorEmailValidator.php | 4 +- .../TwoFactorTextMessageValidator.php | 4 +- src/User/resources/i18n/ca/usuario.php | 7 ++ src/User/resources/i18n/da/usuario.php | 7 ++ src/User/resources/i18n/de-DU/usuario.php | 7 ++ src/User/resources/i18n/de/usuario.php | 7 ++ src/User/resources/i18n/es/usuario.php | 7 ++ src/User/resources/i18n/et/usuario.php | 7 ++ src/User/resources/i18n/fa-IR/usuario.php | 7 ++ src/User/resources/i18n/fi/usuario.php | 7 ++ src/User/resources/i18n/fr/usuario.php | 7 ++ src/User/resources/i18n/hr/usuario.php | 7 ++ src/User/resources/i18n/hu/usuario.php | 7 ++ src/User/resources/i18n/it/usuario.php | 8 +- src/User/resources/i18n/kk/usuario.php | 7 ++ src/User/resources/i18n/lt/usuario.php | 7 ++ src/User/resources/i18n/nl/usuario.php | 7 ++ src/User/resources/i18n/pl/usuario.php | 7 ++ src/User/resources/i18n/pt-BR/usuario.php | 7 ++ src/User/resources/i18n/pt-PT/usuario.php | 7 ++ src/User/resources/i18n/ro/usuario.php | 7 ++ src/User/resources/i18n/ru/usuario.php | 7 ++ src/User/resources/i18n/th/usuario.php | 7 ++ src/User/resources/i18n/tr-TR/usuario.php | 7 ++ src/User/resources/i18n/uk/usuario.php | 7 ++ src/User/resources/i18n/vi/usuario.php | 7 ++ src/User/resources/i18n/zh-CN/usuario.php | 7 ++ src/User/resources/views/settings/account.php | 80 +++++++++++++------ 35 files changed, 287 insertions(+), 62 deletions(-) diff --git a/composer.json b/composer.json index d7f1639..204a5f1 100644 --- a/composer.json +++ b/composer.json @@ -80,6 +80,9 @@ }, "fxp-asset": { "enabled": false + }, + "allow-plugins": { + "yiisoft/yii2-composer": true } }, "conflict": { diff --git a/docs/installation/configuration-options.md b/docs/installation/configuration-options.md index 29c6a3a..689f42b 100644 --- a/docs/installation/configuration-options.md +++ b/docs/installation/configuration-options.md @@ -15,31 +15,35 @@ a bigger period so to avoid out of sync issues. #### twoFactorAuthenticationValidators (type: `array`) An array of arrays of channels availables for two factor authentication. The keys in the arrays have the following meaning: -class: it will be the validator class with namespace -name: the name that will be displayed in the section to the user -configurationUrl: the url to the action that will dispaly the configuration form for the validator -codeDurationTime: time duration of the code in session in seconds (not applicable for Google authenticator) -smsSender: the reference to SmsSenderInterface for managing SMS send. +class: it will be the validator class with namespace; +name: the name that will be displayed in the section to the user; +configurationUrl: the url to the action that will dispaly the configuration form for the validator; +codeDurationTime: time duration of the code in session in seconds (not applicable for Google authenticator); +smsSender: the reference to SmsSenderInterface for managing SMS send; +enabled: true if you want to enable the channel, false otherwise. -The following is the deafult configuration: +The following is the default configuration: 'google-authenticator'=>[ 'class'=>\Da\User\Validator\TwoFactorCodeValidator::class, 'description'=>Yii::t('usuario', 'Google Authenticator'), - 'configurationUrl'=>'user/settings/two-factor' + 'configurationUrl'=>'user/settings/two-factor', + 'enabled'=>true ], 'email'=>[ 'class'=>\Da\User\Validator\TwoFactorEmailValidator::class, 'description'=>Yii::t('usuario', 'Email'), 'configurationUrl'=>'user/settings/two-factor-email', - 'codeDurationTime'=>300 + 'codeDurationTime'=>300, + 'enabled'=>true ], 'sms'=>[ 'class'=>\Da\User\Validator\TwoFactorTextMessageValidator::class, 'description'=>Yii::t('usuario', 'Text message'), 'configurationUrl'=>'user/settings/two-factor-sms', 'codeDurationTime'=>300, - 'smsSender'=>'smsSender' + 'smsSender'=>'smsSender', + 'enabled'=>true ] For instructions about implementation of SMS sending see at the following link: https://www.yiiframework.com/extension/yetopen/yii2-sms-aruba diff --git a/src/User/Bootstrap.php b/src/User/Bootstrap.php index 22e0a04..9f5bd3a 100644 --- a/src/User/Bootstrap.php +++ b/src/User/Bootstrap.php @@ -27,6 +27,7 @@ use yii\base\InvalidConfigException; use yii\console\Application as ConsoleApplication; use yii\i18n\PhpMessageSource; use yii\web\Application as WebApplication; +use yii\helpers\ArrayHelper; /** * Bootstrap class of the yii2-usuario extension. Configures container services, initializes translations, @@ -163,19 +164,21 @@ class Bootstrap implements BootstrapInterface } // Initialize array of two factor authentication validators available - if(is_null(Yii::$app->getModule('user')->twoFactorAuthenticationValidators)){ - Yii::$app->getModule('user')->twoFactorAuthenticationValidators=[ + $defaultTwoFactorAuthenticationValidators = + [ 'google-authenticator'=>[ 'class'=>\Da\User\Validator\TwoFactorCodeValidator::class, 'description'=>Yii::t('usuario', 'Google Authenticator'), - 'configurationUrl'=>'user/settings/two-factor' + 'configurationUrl'=>'user/settings/two-factor', + 'enabled'=>true ], 'email'=>[ 'class'=>\Da\User\Validator\TwoFactorEmailValidator::class, 'description'=>Yii::t('usuario', 'Email'), 'configurationUrl'=>'user/settings/two-factor-email', // Time duration of the code in seconds - 'codeDurationTime'=>300 + 'codeDurationTime'=>300, + 'enabled'=>true ], 'sms'=>[ 'class'=>\Da\User\Validator\TwoFactorTextMessageValidator::class, @@ -184,13 +187,14 @@ class Bootstrap implements BootstrapInterface // component for sending sms 'smsSender'=>'smsSender', // Time duration of the code in seconds - 'codeDurationTime'=>300 + 'codeDurationTime'=>300, + 'enabled'=>true ] ]; - } - - + $app->getModule('user')->twoFactorAuthenticationValidators = + ArrayHelper::merge($app->getModule('user')->twoFactorAuthenticationValidators, $defaultTwoFactorAuthenticationValidators); + if ($app instanceof WebApplication) { diff --git a/src/User/Controller/SettingsController.php b/src/User/Controller/SettingsController.php index baccb1b..95aee85 100644 --- a/src/User/Controller/SettingsController.php +++ b/src/User/Controller/SettingsController.php @@ -449,7 +449,7 @@ class SettingsController extends Controller $module = Yii::$app->getModule('user'); $validators = $module->twoFactorAuthenticationValidators; $choice = Yii::$app->request->get('choice'); - $codeDurationTime = ArrayHelper::getValue($validators,$choice.'.codeDurationTime', 0); + $codeDurationTime = ArrayHelper::getValue($validators,$choice.'.codeDurationTime', 300); $class = ArrayHelper::getValue($validators,$choice.'.class'); $object = $this diff --git a/src/User/Form/LoginForm.php b/src/User/Form/LoginForm.php index c3bbf7f..c1cd3f7 100644 --- a/src/User/Form/LoginForm.php +++ b/src/User/Form/LoginForm.php @@ -120,7 +120,7 @@ class LoginForm extends Model $validators = $module->twoFactorAuthenticationValidators; $type = $this->user->auth_tf_type; $class = ArrayHelper::getValue($validators,$type.'.class'); - $codeDurationTime = ArrayHelper::getValue($validators,$type.'.codeDurationTime', 0); + $codeDurationTime = ArrayHelper::getValue($validators,$type.'.codeDurationTime', 300); $validator = $this ->make($class, [$this->user, $this->twoFactorAuthenticationCode, $this->module->twoFactorAuthenticationCycles]); $success = $validator->validate(); diff --git a/src/User/Service/TwoFactorEmailCodeGeneratorService.php b/src/User/Service/TwoFactorEmailCodeGeneratorService.php index d946e2a..cb15c88 100644 --- a/src/User/Service/TwoFactorEmailCodeGeneratorService.php +++ b/src/User/Service/TwoFactorEmailCodeGeneratorService.php @@ -50,12 +50,14 @@ class TwoFactorEmailCodeGeneratorService implements ServiceInterface $code = str_pad($code, 6, 0, STR_PAD_LEFT); // send email $mailService = MailFactory::makeTwoFactorCodeMailerService($user, $code); - $mailService->run(); - - // put key in session - Yii::$app->session->set("email_code_time", date('Y-m-d H:i:s')); - Yii::$app->session->set("email_code", $code); - + // check the sending emailYii::t( + if(!$mailService->run()){ + Yii::$app->session->addFlash('error', Yii::t('usuario','The email sending failed, please check your configuration.')); + }else{ + // put key in session + Yii::$app->session->set("email_code_time", date('Y-m-d H:i:s')); + Yii::$app->session->set("email_code", $code); + } return $code; } } diff --git a/src/User/Service/TwoFactorSmsCodeGeneratorService.php b/src/User/Service/TwoFactorSmsCodeGeneratorService.php index 1bb63e1..7768b6c 100644 --- a/src/User/Service/TwoFactorSmsCodeGeneratorService.php +++ b/src/User/Service/TwoFactorSmsCodeGeneratorService.php @@ -67,13 +67,19 @@ class TwoFactorSmsCodeGeneratorService implements ServiceInterface if( !(null===$mobilePhone) && $mobilePhone!='' ){ // send sms - $this->smsSender->send($mobilePhone, $code); - // put key in session - Yii::$app->session->set("sms_code_time", date('Y-m-d H:i:s')); - Yii::$app->session->set("sms_code", $code); - } - - return $code; - + $success = $this->smsSender->send($mobilePhone, $code); + if($success){ + // put key in session + Yii::$app->session->set("sms_code_time", date('Y-m-d H:i:s')); + Yii::$app->session->set("sms_code", $code); + }else{ + Yii::$app->session->addFlash('error', Yii::t('usuario','The sms sending failed, please check your configuration.')); + return false; + } + } else{ + Yii::$app->session->addFlash('error', Yii::t('usuario','Mobile phone not found, please check your profile')); + return false; + } + return true; } } diff --git a/src/User/Validator/TwoFactorEmailValidator.php b/src/User/Validator/TwoFactorEmailValidator.php index 95d7238..ac10cd6 100644 --- a/src/User/Validator/TwoFactorEmailValidator.php +++ b/src/User/Validator/TwoFactorEmailValidator.php @@ -50,13 +50,15 @@ class TwoFactorEmailValidator extends TwoFactorCodeValidator */ public function validate() { + if(is_null($this->code) || $this->code == '' ) + return false; $emailCodeTime = new \DateTime(Yii::$app->session->get("email_code_time")); $currentTime = new \DateTime('now'); $interval = $currentTime->getTimestamp()-$emailCodeTime->getTimestamp(); $module = Yii::$app->getModule('user'); $validators = $module->twoFactorAuthenticationValidators; - $codeDurationTime = ArrayHelper::getValue($validators,$this->type.'.codeDurationTime', 0); + $codeDurationTime = ArrayHelper::getValue($validators,$this->type.'.codeDurationTime', 300); if($interval > $codeDurationTime ) return false; diff --git a/src/User/Validator/TwoFactorTextMessageValidator.php b/src/User/Validator/TwoFactorTextMessageValidator.php index 4455b41..9af30fa 100644 --- a/src/User/Validator/TwoFactorTextMessageValidator.php +++ b/src/User/Validator/TwoFactorTextMessageValidator.php @@ -50,12 +50,14 @@ class TwoFactorTextMessageValidator extends TwoFactorCodeValidator */ public function validate() { + if(is_null($this->code) || $this->code == '' ) + return false; $smsCodeTime = new \DateTime(Yii::$app->session->get("sms_code_time")); $currentTime = new \DateTime('now'); $interval = $currentTime->getTimestamp()-$smsCodeTime->getTimestamp(); $module = Yii::$app->getModule('user'); $validators = $module->twoFactorAuthenticationValidators; - $codeDurationTime = ArrayHelper::getValue($validators,$this->type.'.codeDurationTime', 0); + $codeDurationTime = ArrayHelper::getValue($validators,$this->type.'.codeDurationTime', 300); if($interval > $codeDurationTime ) return false; diff --git a/src/User/resources/i18n/ca/usuario.php b/src/User/resources/i18n/ca/usuario.php index 8d6dd3f..dbdf95f 100644 --- a/src/User/resources/i18n/ca/usuario.php +++ b/src/User/resources/i18n/ca/usuario.php @@ -142,6 +142,7 @@ return [ 'Login' => '', 'Logout' => '', 'Manage users' => '', + 'Mobile phone not found, please check your profile' => '', 'Mobile phone number' => '', 'Mobile phone number successfully enabled.' => '', 'Name' => '', @@ -207,6 +208,10 @@ return [ 'Thank you, registration is now complete.' => '', 'The "recaptcha" component must be configured.' => '', 'The confirmation link is invalid or expired. Please try requesting a new one.' => '', + 'The email address set is: "{0}".' => '', + 'The email sending failed, please check your configuration.' => '', + 'The phone number set is: "{0}".' => '', + 'The sms sending failed, please check your configuration.' => '', 'The verification code is incorrect.' => '', 'There is neither role nor permission with name "{0}"' => '', 'There was an error in saving user' => '', @@ -288,11 +293,13 @@ return [ 'Your password has expired, you must change it now' => '', 'Your personal information has been removed' => '', 'Your profile has been updated' => '', + 'Your two factor authentication method is based on "{0}".' => '', 'privacy policy' => '', '{0, date, MMM dd, YYYY HH:mm}' => '', '{0, date, MMMM dd, YYYY HH:mm}' => '', '{0} cannot be blank.' => '', 'Insert the mobile phone number on which to receive text message.' => '@@@@', + 'Insert the mobile phone number where you want to receive text message in international format.' => '@@@@', 'Insert the mobile phone number where you want to receive text message.' => '@@@@', 'Mobile phone number not registered.' => '@@@@', ]; diff --git a/src/User/resources/i18n/da/usuario.php b/src/User/resources/i18n/da/usuario.php index 8d6dd3f..dbdf95f 100644 --- a/src/User/resources/i18n/da/usuario.php +++ b/src/User/resources/i18n/da/usuario.php @@ -142,6 +142,7 @@ return [ 'Login' => '', 'Logout' => '', 'Manage users' => '', + 'Mobile phone not found, please check your profile' => '', 'Mobile phone number' => '', 'Mobile phone number successfully enabled.' => '', 'Name' => '', @@ -207,6 +208,10 @@ return [ 'Thank you, registration is now complete.' => '', 'The "recaptcha" component must be configured.' => '', 'The confirmation link is invalid or expired. Please try requesting a new one.' => '', + 'The email address set is: "{0}".' => '', + 'The email sending failed, please check your configuration.' => '', + 'The phone number set is: "{0}".' => '', + 'The sms sending failed, please check your configuration.' => '', 'The verification code is incorrect.' => '', 'There is neither role nor permission with name "{0}"' => '', 'There was an error in saving user' => '', @@ -288,11 +293,13 @@ return [ 'Your password has expired, you must change it now' => '', 'Your personal information has been removed' => '', 'Your profile has been updated' => '', + 'Your two factor authentication method is based on "{0}".' => '', 'privacy policy' => '', '{0, date, MMM dd, YYYY HH:mm}' => '', '{0, date, MMMM dd, YYYY HH:mm}' => '', '{0} cannot be blank.' => '', 'Insert the mobile phone number on which to receive text message.' => '@@@@', + 'Insert the mobile phone number where you want to receive text message in international format.' => '@@@@', 'Insert the mobile phone number where you want to receive text message.' => '@@@@', 'Mobile phone number not registered.' => '@@@@', ]; diff --git a/src/User/resources/i18n/de-DU/usuario.php b/src/User/resources/i18n/de-DU/usuario.php index 68b45a6..b24930d 100644 --- a/src/User/resources/i18n/de-DU/usuario.php +++ b/src/User/resources/i18n/de-DU/usuario.php @@ -281,20 +281,27 @@ return [ 'Insert the code you received by SMS.' => '', 'Insert the code you received by email.' => '', 'Insert the mobile phone number where you want to receive text message in international format' => '', + 'Mobile phone not found, please check your profile' => '', 'Mobile phone number' => '', 'Mobile phone number successfully enabled.' => '', 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please click on \'Cancel\' and repeat the login request.' => '', 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please close this window and repeat the enabling request.' => '', 'Submit' => '', 'Text message' => '', + 'The email address set is: "{0}".' => '', + 'The email sending failed, please check your configuration.' => '', + 'The phone number set is: "{0}".' => '', + 'The sms sending failed, please check your configuration.' => '', 'This is the code to insert to enable two factor authentication' => '', 'Two factor authentication code by SMS' => '', 'Two factor authentication code by email' => '', 'Unfortunately, you can not work with this site without giving us consent to process your data.' => '', 'Your consent is required to work with this site' => '', + 'Your two factor authentication method is based on "{0}".' => '', 'A message has been sent to your email address. ' => '@@Eine Nachricht wurde an Deine E-Mail Adresse gesendet@@', 'Every user having your role has two factor authentication mandatory, you must enable it' => '@@@@', 'Insert the mobile phone number on which to receive text message.' => '@@@@', + 'Insert the mobile phone number where you want to receive text message in international format.' => '@@@@', 'Insert the mobile phone number where you want to receive text message.' => '@@@@', 'Mobile phone number not registered.' => '@@@@', ]; diff --git a/src/User/resources/i18n/de/usuario.php b/src/User/resources/i18n/de/usuario.php index 0564503..67c5368 100644 --- a/src/User/resources/i18n/de/usuario.php +++ b/src/User/resources/i18n/de/usuario.php @@ -284,16 +284,23 @@ return [ 'Insert the code you received by SMS.' => '', 'Insert the code you received by email.' => '', 'Insert the mobile phone number where you want to receive text message in international format' => '', + 'Mobile phone not found, please check your profile' => '', 'Mobile phone number' => '', 'Mobile phone number successfully enabled.' => '', 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please click on \'Cancel\' and repeat the login request.' => '', 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please close this window and repeat the enabling request.' => '', 'Text message' => '', + 'The email address set is: "{0}".' => '', + 'The email sending failed, please check your configuration.' => '', + 'The phone number set is: "{0}".' => '', + 'The sms sending failed, please check your configuration.' => '', 'This is the code to insert to enable two factor authentication' => '', 'Two factor authentication code by SMS' => '', 'Two factor authentication code by email' => '', + 'Your two factor authentication method is based on "{0}".' => '', 'Every user having your role has two factor authentication mandatory, you must enable it' => '@@@@', 'Insert the mobile phone number on which to receive text message.' => '@@@@', + 'Insert the mobile phone number where you want to receive text message in international format.' => '@@@@', 'Insert the mobile phone number where you want to receive text message.' => '@@@@', 'Mobile phone number not registered.' => '@@@@', 'Now you can resume the login process' => '@@@@', diff --git a/src/User/resources/i18n/es/usuario.php b/src/User/resources/i18n/es/usuario.php index 1d90550..19a51a7 100644 --- a/src/User/resources/i18n/es/usuario.php +++ b/src/User/resources/i18n/es/usuario.php @@ -282,19 +282,26 @@ return [ 'Insert the code you received by SMS.' => '', 'Insert the code you received by email.' => '', 'Insert the mobile phone number where you want to receive text message in international format' => '', + 'Mobile phone not found, please check your profile' => '', 'Mobile phone number' => '', 'Mobile phone number successfully enabled.' => '', 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please click on \'Cancel\' and repeat the login request.' => '', 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please close this window and repeat the enabling request.' => '', 'Text message' => '', + 'The email address set is: "{0}".' => '', + 'The email sending failed, please check your configuration.' => '', + 'The phone number set is: "{0}".' => '', + 'The sms sending failed, please check your configuration.' => '', 'This is the code to insert to enable two factor authentication' => '', 'Two factor authentication code by SMS' => '', 'Two factor authentication code by email' => '', 'Your consent is required to work with this site' => '', + 'Your two factor authentication method is based on "{0}".' => '', '{0, date, MMM dd, YYYY HH:mm}' => '', 'An email has been sent with instructions for resetting your password' => '@@Se ha enviado un correo electrónico con instrucciones para restablecer su contraseña@@', 'Every user having your role has two factor authentication mandatory, you must enable it' => '@@@@', 'Insert the mobile phone number on which to receive text message.' => '@@@@', + 'Insert the mobile phone number where you want to receive text message in international format.' => '@@@@', 'Insert the mobile phone number where you want to receive text message.' => '@@@@', 'Mobile phone number not registered.' => '@@@@', 'Two factor authentication protects you against stolen credentials' => '@@La autenticación de dos factores le protege del robo de credenciales@@', diff --git a/src/User/resources/i18n/et/usuario.php b/src/User/resources/i18n/et/usuario.php index fe54eb2..c4af3b5 100644 --- a/src/User/resources/i18n/et/usuario.php +++ b/src/User/resources/i18n/et/usuario.php @@ -276,6 +276,7 @@ return [ 'Insert the code you received by SMS.' => '', 'Insert the code you received by email.' => '', 'Insert the mobile phone number where you want to receive text message in international format' => '', + 'Mobile phone not found, please check your profile' => '', 'Mobile phone number' => '', 'Mobile phone number successfully enabled.' => '', 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please click on \'Cancel\' and repeat the login request.' => '', @@ -283,6 +284,10 @@ return [ 'Rule class must extend "yii\\rbac\\Rule".' => '', 'Submit' => '', 'Text message' => '', + 'The email address set is: "{0}".' => '', + 'The email sending failed, please check your configuration.' => '', + 'The phone number set is: "{0}".' => '', + 'The sms sending failed, please check your configuration.' => '', 'This is the code to insert to enable two factor authentication' => '', 'Two factor authentication code by SMS' => '', 'Two factor authentication code by email' => '', @@ -290,10 +295,12 @@ return [ 'VKontakte' => '', 'Yandex' => '', 'Your consent is required to work with this site' => '', + 'Your two factor authentication method is based on "{0}".' => '', '{0, date, MMM dd, YYYY HH:mm}' => '', '{0, date, MMMM dd, YYYY HH:mm}' => '', 'Every user having your role has two factor authentication mandatory, you must enable it' => '@@@@', 'Insert the mobile phone number on which to receive text message.' => '@@@@', + 'Insert the mobile phone number where you want to receive text message in international format.' => '@@@@', 'Insert the mobile phone number where you want to receive text message.' => '@@@@', 'Mobile phone number not registered.' => '@@@@', ]; diff --git a/src/User/resources/i18n/fa-IR/usuario.php b/src/User/resources/i18n/fa-IR/usuario.php index 6cb7a29..bc49f9a 100644 --- a/src/User/resources/i18n/fa-IR/usuario.php +++ b/src/User/resources/i18n/fa-IR/usuario.php @@ -210,6 +210,7 @@ return [ 'Last login IP' => '', 'Last login time' => '', 'Last password change' => '', + 'Mobile phone not found, please check your profile' => '', 'Mobile phone number' => '', 'Mobile phone number successfully enabled.' => '', 'Never' => '', @@ -242,6 +243,10 @@ return [ 'Switch identities is disabled.' => '', 'Text message' => '', 'The "recaptcha" component must be configured.' => '', + 'The email address set is: "{0}".' => '', + 'The email sending failed, please check your configuration.' => '', + 'The phone number set is: "{0}".' => '', + 'The sms sending failed, please check your configuration.' => '', 'The verification code is incorrect.' => '', 'There is neither role nor permission with name "{0}"' => '', 'There was an error in saving user' => '', @@ -289,11 +294,13 @@ return [ 'Your consent is required to work with this site' => '', 'Your password has expired, you must change it now' => '', 'Your personal information has been removed' => '', + 'Your two factor authentication method is based on "{0}".' => '', 'privacy policy' => '', '{0, date, MMM dd, YYYY HH:mm}' => '', '{0} cannot be blank.' => '', 'An email has been sent with instructions for resetting your password' => '@@ایمیلی حاوی راهنمایی برای تنظیم مجدد رمز عبور به شما ارسال شد@@', 'Insert the mobile phone number on which to receive text message.' => '@@@@', + 'Insert the mobile phone number where you want to receive text message in international format.' => '@@@@', 'Insert the mobile phone number where you want to receive text message.' => '@@@@', 'Mobile phone number not registered.' => '@@@@', 'Registration ip' => '@@ای پی ثبت نام@@', diff --git a/src/User/resources/i18n/fi/usuario.php b/src/User/resources/i18n/fi/usuario.php index 8d6dd3f..dbdf95f 100644 --- a/src/User/resources/i18n/fi/usuario.php +++ b/src/User/resources/i18n/fi/usuario.php @@ -142,6 +142,7 @@ return [ 'Login' => '', 'Logout' => '', 'Manage users' => '', + 'Mobile phone not found, please check your profile' => '', 'Mobile phone number' => '', 'Mobile phone number successfully enabled.' => '', 'Name' => '', @@ -207,6 +208,10 @@ return [ 'Thank you, registration is now complete.' => '', 'The "recaptcha" component must be configured.' => '', 'The confirmation link is invalid or expired. Please try requesting a new one.' => '', + 'The email address set is: "{0}".' => '', + 'The email sending failed, please check your configuration.' => '', + 'The phone number set is: "{0}".' => '', + 'The sms sending failed, please check your configuration.' => '', 'The verification code is incorrect.' => '', 'There is neither role nor permission with name "{0}"' => '', 'There was an error in saving user' => '', @@ -288,11 +293,13 @@ return [ 'Your password has expired, you must change it now' => '', 'Your personal information has been removed' => '', 'Your profile has been updated' => '', + 'Your two factor authentication method is based on "{0}".' => '', 'privacy policy' => '', '{0, date, MMM dd, YYYY HH:mm}' => '', '{0, date, MMMM dd, YYYY HH:mm}' => '', '{0} cannot be blank.' => '', 'Insert the mobile phone number on which to receive text message.' => '@@@@', + 'Insert the mobile phone number where you want to receive text message in international format.' => '@@@@', 'Insert the mobile phone number where you want to receive text message.' => '@@@@', 'Mobile phone number not registered.' => '@@@@', ]; diff --git a/src/User/resources/i18n/fr/usuario.php b/src/User/resources/i18n/fr/usuario.php index a204e9e..0f74b58 100644 --- a/src/User/resources/i18n/fr/usuario.php +++ b/src/User/resources/i18n/fr/usuario.php @@ -280,20 +280,27 @@ return [ 'Insert the code you received by SMS.' => '', 'Insert the code you received by email.' => '', 'Insert the mobile phone number where you want to receive text message in international format' => '', + 'Mobile phone not found, please check your profile' => '', 'Mobile phone number' => '', 'Mobile phone number successfully enabled.' => '', 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please click on \'Cancel\' and repeat the login request.' => '', 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please close this window and repeat the enabling request.' => '', 'Submit' => '', 'Text message' => '', + 'The email address set is: "{0}".' => '', + 'The email sending failed, please check your configuration.' => '', + 'The phone number set is: "{0}".' => '', + 'The sms sending failed, please check your configuration.' => '', 'This is the code to insert to enable two factor authentication' => '', 'Two factor authentication code by SMS' => '', 'Two factor authentication code by email' => '', 'Unfortunately, you can not work with this site without giving us consent to process your data.' => '', 'Your consent is required to work with this site' => '', + 'Your two factor authentication method is based on "{0}".' => '', '{0, date, MMM dd, YYYY HH:mm}' => '', 'Every user having your role has two factor authentication mandatory, you must enable it' => '@@@@', 'Insert the mobile phone number on which to receive text message.' => '@@@@', + 'Insert the mobile phone number where you want to receive text message in international format.' => '@@@@', 'Insert the mobile phone number where you want to receive text message.' => '@@@@', 'Mobile phone number not registered.' => '@@@@', ]; diff --git a/src/User/resources/i18n/hr/usuario.php b/src/User/resources/i18n/hr/usuario.php index 8d6dd3f..dbdf95f 100644 --- a/src/User/resources/i18n/hr/usuario.php +++ b/src/User/resources/i18n/hr/usuario.php @@ -142,6 +142,7 @@ return [ 'Login' => '', 'Logout' => '', 'Manage users' => '', + 'Mobile phone not found, please check your profile' => '', 'Mobile phone number' => '', 'Mobile phone number successfully enabled.' => '', 'Name' => '', @@ -207,6 +208,10 @@ return [ 'Thank you, registration is now complete.' => '', 'The "recaptcha" component must be configured.' => '', 'The confirmation link is invalid or expired. Please try requesting a new one.' => '', + 'The email address set is: "{0}".' => '', + 'The email sending failed, please check your configuration.' => '', + 'The phone number set is: "{0}".' => '', + 'The sms sending failed, please check your configuration.' => '', 'The verification code is incorrect.' => '', 'There is neither role nor permission with name "{0}"' => '', 'There was an error in saving user' => '', @@ -288,11 +293,13 @@ return [ 'Your password has expired, you must change it now' => '', 'Your personal information has been removed' => '', 'Your profile has been updated' => '', + 'Your two factor authentication method is based on "{0}".' => '', 'privacy policy' => '', '{0, date, MMM dd, YYYY HH:mm}' => '', '{0, date, MMMM dd, YYYY HH:mm}' => '', '{0} cannot be blank.' => '', 'Insert the mobile phone number on which to receive text message.' => '@@@@', + 'Insert the mobile phone number where you want to receive text message in international format.' => '@@@@', 'Insert the mobile phone number where you want to receive text message.' => '@@@@', 'Mobile phone number not registered.' => '@@@@', ]; diff --git a/src/User/resources/i18n/hu/usuario.php b/src/User/resources/i18n/hu/usuario.php index 7d33fdd..d96938a 100644 --- a/src/User/resources/i18n/hu/usuario.php +++ b/src/User/resources/i18n/hu/usuario.php @@ -278,6 +278,7 @@ return [ 'Insert the code you received by SMS.' => '', 'Insert the code you received by email.' => '', 'Insert the mobile phone number where you want to receive text message in international format' => '', + 'Mobile phone not found, please check your profile' => '', 'Mobile phone number' => '', 'Mobile phone number successfully enabled.' => '', 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please click on \'Cancel\' and repeat the login request.' => '', @@ -286,12 +287,17 @@ return [ 'Select rule...' => '', 'Submit' => '', 'Text message' => '', + 'The email address set is: "{0}".' => '', + 'The email sending failed, please check your configuration.' => '', + 'The phone number set is: "{0}".' => '', + 'The sms sending failed, please check your configuration.' => '', 'This is the code to insert to enable two factor authentication' => '', 'Two factor authentication code by SMS' => '', 'Two factor authentication code by email' => '', 'Two factor authentication protects you in case of stolen credentials' => '', 'Unfortunately, you can not work with this site without giving us consent to process your data.' => '', 'Your consent is required to work with this site' => '', + 'Your two factor authentication method is based on "{0}".' => '', 'A message has been sent to your email address. ' => '@@Üzenet érkezett az e-mail címedre.@@', 'An email has been sent with instructions for resetting your password' => '@@E-mailt küldtek a jelszó visszaállításával kapcsolatos utasításokkal@@', 'Awesome, almost there. ' => '@@Hurrá, majdnem kész.@@', @@ -300,6 +306,7 @@ return [ 'Every user having your role has two factor authentication mandatory, you must enable it' => '@@@@', 'I aggree processing of my personal data and the use of cookies to facilitate the operation of this site. For more information read our {privacyPolicy}' => '@@Aggregálom a személyes adataim feldolgozását és a cookie-k használatát a webhely működésének megkönnyítése érdekében. További információért olvassa el a {privacyPolicy}@@', 'Insert the mobile phone number on which to receive text message.' => '@@@@', + 'Insert the mobile phone number where you want to receive text message in international format.' => '@@@@', 'Insert the mobile phone number where you want to receive text message.' => '@@@@', 'Invalid two-factor code' => '@@Érvénytelen kétütemű kód@@', 'Last login' => '@@Utolsó bejelentkezés@@', diff --git a/src/User/resources/i18n/it/usuario.php b/src/User/resources/i18n/it/usuario.php index 8295187..a6ef150 100644 --- a/src/User/resources/i18n/it/usuario.php +++ b/src/User/resources/i18n/it/usuario.php @@ -206,6 +206,10 @@ return [ 'Thank you, registration is now complete.' => 'Grazie, la tua registrazione è completa.', 'The "recaptcha" component must be configured.' => 'Occorre configurare il componente "recaptcha".', 'The confirmation link is invalid or expired. Please try requesting a new one.' => 'Il link di conferma non è valido o scaduto. Per favore prova a richiederne uno nuovo', + 'The email address set is: "{0}".' => 'L\'indirizzo email impostato è: "{0}".', + 'The email sending failed, please check your configuration.' => 'L\'invio della email non è riuscito, verifica la configurazione', + 'The phone number set is: "{0}".' => 'Il numero di telefono impostato è: "{0}".', + 'The sms sending failed, please check your configuration.' => 'L\'invio del messaggio di testo non è riuscito, verifica la configurazione', 'The verification code is incorrect.' => 'Il codice di verifica non è corretto.', 'There is neither role nor permission with name "{0}"' => 'Non esiste un ruolo o permesso di nome "{0}', 'There was an error in saving user' => 'Errore in salvataggio utente', @@ -286,14 +290,16 @@ return [ 'Your password has expired, you must change it now' => 'La tua password è scaduta, devi cambiarla', 'Your personal information has been removed' => 'I tuoi dati personali sono stati rimossi', 'Your profile has been updated' => 'Il tuo profilo è stato aggiornato', + 'Your two factor authentication method is based on "{0}".' => 'La tua autenticazione a due fattori è basata su "{0}".', 'privacy policy' => 'politica della privacy', '{0, date, MMM dd, YYYY HH:mm}' => '{0, date, MMM dd, YYYY HH:mm}', '{0, date, MMMM dd, YYYY HH:mm}' => '{0, date, dd MMMM YYYY HH:mm}', '{0} cannot be blank.' => '{0} non può essere vuoto.', 'Insert the mobile phone number where you want to receive text message in international format' => '', + 'Mobile phone not found, please check your profile' => '', 'This is the code to insert to enable two factor authentication' => '', 'An email has been sent with instructions for resetting your password' => '@@È stata inviata un\'email con le istruzioni per azzerare la tua password@@', - 'Insert the mobile phone number where you want to receive text message in international format.' => '@@@@', + 'Insert the mobile phone number where you want to receive text message in international format.' => '@@Inserisci il numero di telefono sul quale ricevere il messaggio di testo nel formato internazionale@@', 'Insert the mobile phone number where you want to receive the SMS.' => '@@Inserisci il numero del cellulare sul quale ricevere l\'SMS.@@', 'Mobile phone number not registered.' => '@@L\'attivazione del numero di cellulare non è riuscita@@', 'Now you can resume the login process' => '@@Ora puoi riprendere il processo di autenticazione@@', diff --git a/src/User/resources/i18n/kk/usuario.php b/src/User/resources/i18n/kk/usuario.php index 8d6dd3f..dbdf95f 100644 --- a/src/User/resources/i18n/kk/usuario.php +++ b/src/User/resources/i18n/kk/usuario.php @@ -142,6 +142,7 @@ return [ 'Login' => '', 'Logout' => '', 'Manage users' => '', + 'Mobile phone not found, please check your profile' => '', 'Mobile phone number' => '', 'Mobile phone number successfully enabled.' => '', 'Name' => '', @@ -207,6 +208,10 @@ return [ 'Thank you, registration is now complete.' => '', 'The "recaptcha" component must be configured.' => '', 'The confirmation link is invalid or expired. Please try requesting a new one.' => '', + 'The email address set is: "{0}".' => '', + 'The email sending failed, please check your configuration.' => '', + 'The phone number set is: "{0}".' => '', + 'The sms sending failed, please check your configuration.' => '', 'The verification code is incorrect.' => '', 'There is neither role nor permission with name "{0}"' => '', 'There was an error in saving user' => '', @@ -288,11 +293,13 @@ return [ 'Your password has expired, you must change it now' => '', 'Your personal information has been removed' => '', 'Your profile has been updated' => '', + 'Your two factor authentication method is based on "{0}".' => '', 'privacy policy' => '', '{0, date, MMM dd, YYYY HH:mm}' => '', '{0, date, MMMM dd, YYYY HH:mm}' => '', '{0} cannot be blank.' => '', 'Insert the mobile phone number on which to receive text message.' => '@@@@', + 'Insert the mobile phone number where you want to receive text message in international format.' => '@@@@', 'Insert the mobile phone number where you want to receive text message.' => '@@@@', 'Mobile phone number not registered.' => '@@@@', ]; diff --git a/src/User/resources/i18n/lt/usuario.php b/src/User/resources/i18n/lt/usuario.php index 8d6dd3f..dbdf95f 100644 --- a/src/User/resources/i18n/lt/usuario.php +++ b/src/User/resources/i18n/lt/usuario.php @@ -142,6 +142,7 @@ return [ 'Login' => '', 'Logout' => '', 'Manage users' => '', + 'Mobile phone not found, please check your profile' => '', 'Mobile phone number' => '', 'Mobile phone number successfully enabled.' => '', 'Name' => '', @@ -207,6 +208,10 @@ return [ 'Thank you, registration is now complete.' => '', 'The "recaptcha" component must be configured.' => '', 'The confirmation link is invalid or expired. Please try requesting a new one.' => '', + 'The email address set is: "{0}".' => '', + 'The email sending failed, please check your configuration.' => '', + 'The phone number set is: "{0}".' => '', + 'The sms sending failed, please check your configuration.' => '', 'The verification code is incorrect.' => '', 'There is neither role nor permission with name "{0}"' => '', 'There was an error in saving user' => '', @@ -288,11 +293,13 @@ return [ 'Your password has expired, you must change it now' => '', 'Your personal information has been removed' => '', 'Your profile has been updated' => '', + 'Your two factor authentication method is based on "{0}".' => '', 'privacy policy' => '', '{0, date, MMM dd, YYYY HH:mm}' => '', '{0, date, MMMM dd, YYYY HH:mm}' => '', '{0} cannot be blank.' => '', 'Insert the mobile phone number on which to receive text message.' => '@@@@', + 'Insert the mobile phone number where you want to receive text message in international format.' => '@@@@', 'Insert the mobile phone number where you want to receive text message.' => '@@@@', 'Mobile phone number not registered.' => '@@@@', ]; diff --git a/src/User/resources/i18n/nl/usuario.php b/src/User/resources/i18n/nl/usuario.php index 21fa7d8..94caf95 100644 --- a/src/User/resources/i18n/nl/usuario.php +++ b/src/User/resources/i18n/nl/usuario.php @@ -278,6 +278,7 @@ return [ 'Insert the code you received by SMS.' => '', 'Insert the code you received by email.' => '', 'Insert the mobile phone number where you want to receive text message in international format' => '', + 'Mobile phone not found, please check your profile' => '', 'Mobile phone number' => '', 'Mobile phone number successfully enabled.' => '', 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please click on \'Cancel\' and repeat the login request.' => '', @@ -286,12 +287,17 @@ return [ 'Select rule...' => '', 'Submit' => '', 'Text message' => '', + 'The email address set is: "{0}".' => '', + 'The email sending failed, please check your configuration.' => '', + 'The phone number set is: "{0}".' => '', + 'The sms sending failed, please check your configuration.' => '', 'This is the code to insert to enable two factor authentication' => '', 'Two factor authentication code by SMS' => '', 'Two factor authentication code by email' => '', 'Two factor authentication protects you in case of stolen credentials' => '', 'Unfortunately, you can not work with this site without giving us consent to process your data.' => '', 'Your consent is required to work with this site' => '', + 'Your two factor authentication method is based on "{0}".' => '', 'A message has been sent to your email address. ' => '@@Een bericht werd naar jouw emailadres verzonden@@', 'An email has been sent with instructions for resetting your password' => '@@Er werd een email verstuurd met instructies om jouw wachtwoord te resetten@@', 'Awesome, almost there. ' => '@@Super, bijna klaar.@@', @@ -303,6 +309,7 @@ return [ to facilitate the operation of this site. For more information read our {privacyPolicy}' => '@@Ik ga akkoord dat mijn persoonlijke data en cookies worden verwerkt voor het gebruik van deze website. Voor meer informatie lees onze {privacyPolicy}@@', 'I aggree processing of my personal data and the use of cookies to facilitate the operation of this site. For more information read our {privacyPolicy}' => '@@Ik ga akkoord dat mijn persoonlijke data en cookies worden verwerkt voor het gebruik van deze website. Voor meer informatie lees onze {privacyPolicy}@@', 'Insert the mobile phone number on which to receive text message.' => '@@@@', + 'Insert the mobile phone number where you want to receive text message in international format.' => '@@@@', 'Insert the mobile phone number where you want to receive text message.' => '@@@@', 'Invalid two-factor code' => '@@Ongeldige tweetraps authenticatie code@@', 'Last login' => '@@Laatste login@@', diff --git a/src/User/resources/i18n/pl/usuario.php b/src/User/resources/i18n/pl/usuario.php index 77f2c38..690ac0e 100644 --- a/src/User/resources/i18n/pl/usuario.php +++ b/src/User/resources/i18n/pl/usuario.php @@ -278,6 +278,7 @@ return [ 'Insert the code you received by SMS.' => '', 'Insert the code you received by email.' => '', 'Insert the mobile phone number where you want to receive text message in international format' => '', + 'Mobile phone not found, please check your profile' => '', 'Mobile phone number' => '', 'Mobile phone number successfully enabled.' => '', 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please click on \'Cancel\' and repeat the login request.' => '', @@ -286,17 +287,23 @@ return [ 'Select rule...' => '', 'Submit' => '', 'Text message' => '', + 'The email address set is: "{0}".' => '', + 'The email sending failed, please check your configuration.' => '', + 'The phone number set is: "{0}".' => '', + 'The sms sending failed, please check your configuration.' => '', 'This is the code to insert to enable two factor authentication' => '', 'Two factor authentication code by SMS' => '', 'Two factor authentication code by email' => '', 'Two factor authentication protects you in case of stolen credentials' => '', 'Unfortunately, you can not work with this site without giving us consent to process your data.' => '', 'Your consent is required to work with this site' => '', + 'Your two factor authentication method is based on "{0}".' => '', 'An email has been sent with instructions for resetting your password' => '@@Email z instrukcją resetowania hasła został wysłany@@', 'Disable Two-Factor Auth' => '@@Wyłącz uwierzytelnianie dwuetapowe@@', 'Enable Two-factor auth' => '@@Włącz uwierzytelnianie dwuetapowe@@', 'Every user having your role has two factor authentication mandatory, you must enable it' => '@@@@', 'Insert the mobile phone number on which to receive text message.' => '@@@@', + 'Insert the mobile phone number where you want to receive text message in international format.' => '@@@@', 'Insert the mobile phone number where you want to receive text message.' => '@@@@', 'Invalid two-factor code' => '@@Nieprawidłowy kod uwierzytelniania dwuetapowego@@', 'Last login' => '@@Data ostatniego logowania@@', diff --git a/src/User/resources/i18n/pt-BR/usuario.php b/src/User/resources/i18n/pt-BR/usuario.php index d6988ea..4d34641 100644 --- a/src/User/resources/i18n/pt-BR/usuario.php +++ b/src/User/resources/i18n/pt-BR/usuario.php @@ -278,6 +278,7 @@ return [ 'Insert the code you received by SMS.' => '', 'Insert the code you received by email.' => '', 'Insert the mobile phone number where you want to receive text message in international format' => '', + 'Mobile phone not found, please check your profile' => '', 'Mobile phone number' => '', 'Mobile phone number successfully enabled.' => '', 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please click on \'Cancel\' and repeat the login request.' => '', @@ -286,12 +287,17 @@ return [ 'Select rule...' => '', 'Submit' => '', 'Text message' => '', + 'The email address set is: "{0}".' => '', + 'The email sending failed, please check your configuration.' => '', + 'The phone number set is: "{0}".' => '', + 'The sms sending failed, please check your configuration.' => '', 'This is the code to insert to enable two factor authentication' => '', 'Two factor authentication code by SMS' => '', 'Two factor authentication code by email' => '', 'Two factor authentication protects you in case of stolen credentials' => '', 'Unfortunately, you can not work with this site without giving us consent to process your data.' => '', 'Your consent is required to work with this site' => '', + 'Your two factor authentication method is based on "{0}".' => '', 'A message has been sent to your email address. ' => '@@Uma mensagem foi enviada para o seu endereço de e-mail.@@', 'An email has been sent with instructions for resetting your password' => '@@Um e-mail foi enviado com instruções para redefinir sua senha@@', 'Awesome, almost there. ' => '@@Incrível, quase lá.@@', @@ -303,6 +309,7 @@ return [ to facilitate the operation of this site. For more information read our {privacyPolicy}' => '@@Concordo com o processamento de meus dados pessoais e o uso de cookies para facilitar a operação deste site. Para mais informações, leia nosso {privacyPolicy}@@', 'I aggree processing of my personal data and the use of cookies to facilitate the operation of this site. For more information read our {privacyPolicy}' => '@@Concordo com o processamento de meus dados pessoais e o uso de cookies para facilitar a operação deste site. Para mais informações, leia nosso {privacyPolicy}@@', 'Insert the mobile phone number on which to receive text message.' => '@@@@', + 'Insert the mobile phone number where you want to receive text message in international format.' => '@@@@', 'Insert the mobile phone number where you want to receive text message.' => '@@@@', 'Invalid two-factor code' => '@@Código de dois fatores inválido@@', 'Last login' => '@@Último login@@', diff --git a/src/User/resources/i18n/pt-PT/usuario.php b/src/User/resources/i18n/pt-PT/usuario.php index 57af028..a709254 100644 --- a/src/User/resources/i18n/pt-PT/usuario.php +++ b/src/User/resources/i18n/pt-PT/usuario.php @@ -272,6 +272,7 @@ return [ 'Insert the code you received by email.' => '', 'Insert the mobile phone number where you want to receive text message in international format' => '', 'Items' => '', + 'Mobile phone not found, please check your profile' => '', 'Mobile phone number' => '', 'Mobile phone number successfully enabled.' => '', 'Password' => '', @@ -281,6 +282,10 @@ return [ 'Select rule...' => '', 'Submit' => '', 'Text message' => '', + 'The email address set is: "{0}".' => '', + 'The email sending failed, please check your configuration.' => '', + 'The phone number set is: "{0}".' => '', + 'The sms sending failed, please check your configuration.' => '', 'This is the code to insert to enable two factor authentication' => '', 'Two factor authentication code by SMS' => '', 'Two factor authentication code by email' => '', @@ -290,10 +295,12 @@ return [ 'Website' => '', 'Yandex' => '', 'Your consent is required to work with this site' => '', + 'Your two factor authentication method is based on "{0}".' => '', '{0, date, MMM dd, YYYY HH:mm}' => '', '{0, date, MMMM dd, YYYY HH:mm}' => '', 'Every user having your role has two factor authentication mandatory, you must enable it' => '@@@@', 'Insert the mobile phone number on which to receive text message.' => '@@@@', + 'Insert the mobile phone number where you want to receive text message in international format.' => '@@@@', 'Insert the mobile phone number where you want to receive text message.' => '@@@@', 'Mobile phone number not registered.' => '@@@@', ]; diff --git a/src/User/resources/i18n/ro/usuario.php b/src/User/resources/i18n/ro/usuario.php index 8689ce1..662d059 100644 --- a/src/User/resources/i18n/ro/usuario.php +++ b/src/User/resources/i18n/ro/usuario.php @@ -278,6 +278,7 @@ return [ 'Insert the code you received by SMS.' => '', 'Insert the code you received by email.' => '', 'Insert the mobile phone number where you want to receive text message in international format' => '', + 'Mobile phone not found, please check your profile' => '', 'Mobile phone number' => '', 'Mobile phone number successfully enabled.' => '', 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please click on \'Cancel\' and repeat the login request.' => '', @@ -286,12 +287,17 @@ return [ 'Select rule...' => '', 'Submit' => '', 'Text message' => '', + 'The email address set is: "{0}".' => '', + 'The email sending failed, please check your configuration.' => '', + 'The phone number set is: "{0}".' => '', + 'The sms sending failed, please check your configuration.' => '', 'This is the code to insert to enable two factor authentication' => '', 'Two factor authentication code by SMS' => '', 'Two factor authentication code by email' => '', 'Two factor authentication protects you in case of stolen credentials' => '', 'Unfortunately, you can not work with this site without giving us consent to process your data.' => '', 'Your consent is required to work with this site' => '', + 'Your two factor authentication method is based on "{0}".' => '', 'A message has been sent to your email address. ' => '@@A fost trimis un mesaj la adresa dvs. de e-mail.@@', 'An email has been sent with instructions for resetting your password' => '@@A fost trimis un e-mail cu instrucțiuni pentru resetarea parolei@@', 'Awesome, almost there. ' => '@@Minunat, aproape gata.@@', @@ -302,6 +308,7 @@ return [ to facilitate the operation of this site. For more information read our {privacyPolicy}' => '@@Am agregat prelucrarea datelor mele personale și utilizarea cookie-urilor pentru a facilita funcționarea acestui site. Pentru mai multe informații, citiți {privacyPolicy}@@', 'I aggree processing of my personal data and the use of cookies to facilitate the operation of this site. For more information read our {privacyPolicy}' => '@@Am agregat prelucrarea datelor mele personale și utilizarea cookie-urilor pentru a facilita funcționarea acestui site. Pentru mai multe informații, citiți {privacyPolicy}@@', 'Insert the mobile phone number on which to receive text message.' => '@@@@', + 'Insert the mobile phone number where you want to receive text message in international format.' => '@@@@', 'Insert the mobile phone number where you want to receive text message.' => '@@@@', 'Invalid two-factor code' => '@@Cod de două factori nevalid@@', 'Last login' => '@@Ultima logare@@', diff --git a/src/User/resources/i18n/ru/usuario.php b/src/User/resources/i18n/ru/usuario.php index 69ffb3e..ec535ab 100644 --- a/src/User/resources/i18n/ru/usuario.php +++ b/src/User/resources/i18n/ru/usuario.php @@ -281,17 +281,23 @@ return [ 'Insert the code you received by SMS.' => '', 'Insert the code you received by email.' => '', 'Insert the mobile phone number where you want to receive text message in international format' => '', + 'Mobile phone not found, please check your profile' => '', 'Mobile phone number' => '', 'Mobile phone number successfully enabled.' => '', 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please click on \'Cancel\' and repeat the login request.' => '', 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please close this window and repeat the enabling request.' => '', 'Submit' => '', 'Text message' => '', + 'The email address set is: "{0}".' => '', + 'The email sending failed, please check your configuration.' => '', + 'The phone number set is: "{0}".' => '', + 'The sms sending failed, please check your configuration.' => '', 'This is the code to insert to enable two factor authentication' => '', 'Two factor authentication code by SMS' => '', 'Two factor authentication code by email' => '', 'Unfortunately, you can not work with this site without giving us consent to process your data.' => '', 'Your consent is required to work with this site' => '', + 'Your two factor authentication method is based on "{0}".' => '', 'A message has been sent to your email address. ' => '@@Сообщение было отправлено на вашу электронную почту@@', 'An email has been sent with instructions for resetting your password' => '@@Вам отправлено письмо с инструкциями по смене пароля@@', 'Awesome, almost there. ' => '@@Замечательно, почти готово!@@', @@ -300,6 +306,7 @@ return [ 'Enable Two-factor auth' => '@@Включить двухфакторную авторизацию@@', 'Every user having your role has two factor authentication mandatory, you must enable it' => '@@@@', 'Insert the mobile phone number on which to receive text message.' => '@@@@', + 'Insert the mobile phone number where you want to receive text message in international format.' => '@@@@', 'Insert the mobile phone number where you want to receive text message.' => '@@@@', 'Invalid two-factor code' => '@@Неверный код двухфакторной авторизации@@', 'Last login' => '@@Последний вход@@', diff --git a/src/User/resources/i18n/th/usuario.php b/src/User/resources/i18n/th/usuario.php index 8d6dd3f..dbdf95f 100644 --- a/src/User/resources/i18n/th/usuario.php +++ b/src/User/resources/i18n/th/usuario.php @@ -142,6 +142,7 @@ return [ 'Login' => '', 'Logout' => '', 'Manage users' => '', + 'Mobile phone not found, please check your profile' => '', 'Mobile phone number' => '', 'Mobile phone number successfully enabled.' => '', 'Name' => '', @@ -207,6 +208,10 @@ return [ 'Thank you, registration is now complete.' => '', 'The "recaptcha" component must be configured.' => '', 'The confirmation link is invalid or expired. Please try requesting a new one.' => '', + 'The email address set is: "{0}".' => '', + 'The email sending failed, please check your configuration.' => '', + 'The phone number set is: "{0}".' => '', + 'The sms sending failed, please check your configuration.' => '', 'The verification code is incorrect.' => '', 'There is neither role nor permission with name "{0}"' => '', 'There was an error in saving user' => '', @@ -288,11 +293,13 @@ return [ 'Your password has expired, you must change it now' => '', 'Your personal information has been removed' => '', 'Your profile has been updated' => '', + 'Your two factor authentication method is based on "{0}".' => '', 'privacy policy' => '', '{0, date, MMM dd, YYYY HH:mm}' => '', '{0, date, MMMM dd, YYYY HH:mm}' => '', '{0} cannot be blank.' => '', 'Insert the mobile phone number on which to receive text message.' => '@@@@', + 'Insert the mobile phone number where you want to receive text message in international format.' => '@@@@', 'Insert the mobile phone number where you want to receive text message.' => '@@@@', 'Mobile phone number not registered.' => '@@@@', ]; diff --git a/src/User/resources/i18n/tr-TR/usuario.php b/src/User/resources/i18n/tr-TR/usuario.php index 8d6dd3f..dbdf95f 100644 --- a/src/User/resources/i18n/tr-TR/usuario.php +++ b/src/User/resources/i18n/tr-TR/usuario.php @@ -142,6 +142,7 @@ return [ 'Login' => '', 'Logout' => '', 'Manage users' => '', + 'Mobile phone not found, please check your profile' => '', 'Mobile phone number' => '', 'Mobile phone number successfully enabled.' => '', 'Name' => '', @@ -207,6 +208,10 @@ return [ 'Thank you, registration is now complete.' => '', 'The "recaptcha" component must be configured.' => '', 'The confirmation link is invalid or expired. Please try requesting a new one.' => '', + 'The email address set is: "{0}".' => '', + 'The email sending failed, please check your configuration.' => '', + 'The phone number set is: "{0}".' => '', + 'The sms sending failed, please check your configuration.' => '', 'The verification code is incorrect.' => '', 'There is neither role nor permission with name "{0}"' => '', 'There was an error in saving user' => '', @@ -288,11 +293,13 @@ return [ 'Your password has expired, you must change it now' => '', 'Your personal information has been removed' => '', 'Your profile has been updated' => '', + 'Your two factor authentication method is based on "{0}".' => '', 'privacy policy' => '', '{0, date, MMM dd, YYYY HH:mm}' => '', '{0, date, MMMM dd, YYYY HH:mm}' => '', '{0} cannot be blank.' => '', 'Insert the mobile phone number on which to receive text message.' => '@@@@', + 'Insert the mobile phone number where you want to receive text message in international format.' => '@@@@', 'Insert the mobile phone number where you want to receive text message.' => '@@@@', 'Mobile phone number not registered.' => '@@@@', ]; diff --git a/src/User/resources/i18n/uk/usuario.php b/src/User/resources/i18n/uk/usuario.php index 11c0c0d..b4df57c 100644 --- a/src/User/resources/i18n/uk/usuario.php +++ b/src/User/resources/i18n/uk/usuario.php @@ -280,6 +280,7 @@ return [ 'Insert the code you received by SMS.' => '', 'Insert the code you received by email.' => '', 'Insert the mobile phone number where you want to receive text message in international format' => '', + 'Mobile phone not found, please check your profile' => '', 'Mobile phone number' => '', 'Mobile phone number successfully enabled.' => '', 'Please, enter the right code. The code is valid for {0} seconds. If you want to get a new code, please click on \'Cancel\' and repeat the login request.' => '', @@ -287,11 +288,16 @@ return [ 'Recovery message sent' => '', 'Submit' => '', 'Text message' => '', + 'The email address set is: "{0}".' => '', + 'The email sending failed, please check your configuration.' => '', + 'The phone number set is: "{0}".' => '', + 'The sms sending failed, please check your configuration.' => '', 'This is the code to insert to enable two factor authentication' => '', 'Two factor authentication code by SMS' => '', 'Two factor authentication code by email' => '', 'Unfortunately, you can not work with this site without giving us consent to process your data.' => '', 'Your consent is required to work with this site' => '', + 'Your two factor authentication method is based on "{0}".' => '', 'A message has been sent to your email address. ' => '@@На вашу електронну адресу надіслано повідомлення@@', 'An email has been sent with instructions for resetting your password' => '@@Лист з інструкціями по зміні пароля надіслано на електронну адресу@@', 'Awesome, almost there. ' => '@@Чудово, майже все.@@', @@ -301,6 +307,7 @@ return [ 'Every user having your role has two factor authentication mandatory, you must enable it' => '@@@@', 'I aggree processing of my personal data and the use of cookies to facilitate the operation of this site. For more information read our {privacyPolicy}' => '@@Я даю згоду на обробку моїх персональних даних та на використання cookie даним сайтом. Для більш детальної інформації ознайомтесь з {privacyPolicy}@@', 'Insert the mobile phone number on which to receive text message.' => '@@@@', + 'Insert the mobile phone number where you want to receive text message in international format.' => '@@@@', 'Insert the mobile phone number where you want to receive text message.' => '@@@@', 'Invalid two-factor code' => '@@Невірний код двофакторної авторизації@@', 'Last login' => '@@Останній вхід@@', diff --git a/src/User/resources/i18n/vi/usuario.php b/src/User/resources/i18n/vi/usuario.php index 8d6dd3f..dbdf95f 100644 --- a/src/User/resources/i18n/vi/usuario.php +++ b/src/User/resources/i18n/vi/usuario.php @@ -142,6 +142,7 @@ return [ 'Login' => '', 'Logout' => '', 'Manage users' => '', + 'Mobile phone not found, please check your profile' => '', 'Mobile phone number' => '', 'Mobile phone number successfully enabled.' => '', 'Name' => '', @@ -207,6 +208,10 @@ return [ 'Thank you, registration is now complete.' => '', 'The "recaptcha" component must be configured.' => '', 'The confirmation link is invalid or expired. Please try requesting a new one.' => '', + 'The email address set is: "{0}".' => '', + 'The email sending failed, please check your configuration.' => '', + 'The phone number set is: "{0}".' => '', + 'The sms sending failed, please check your configuration.' => '', 'The verification code is incorrect.' => '', 'There is neither role nor permission with name "{0}"' => '', 'There was an error in saving user' => '', @@ -288,11 +293,13 @@ return [ 'Your password has expired, you must change it now' => '', 'Your personal information has been removed' => '', 'Your profile has been updated' => '', + 'Your two factor authentication method is based on "{0}".' => '', 'privacy policy' => '', '{0, date, MMM dd, YYYY HH:mm}' => '', '{0, date, MMMM dd, YYYY HH:mm}' => '', '{0} cannot be blank.' => '', 'Insert the mobile phone number on which to receive text message.' => '@@@@', + 'Insert the mobile phone number where you want to receive text message in international format.' => '@@@@', 'Insert the mobile phone number where you want to receive text message.' => '@@@@', 'Mobile phone number not registered.' => '@@@@', ]; diff --git a/src/User/resources/i18n/zh-CN/usuario.php b/src/User/resources/i18n/zh-CN/usuario.php index 8d6dd3f..dbdf95f 100644 --- a/src/User/resources/i18n/zh-CN/usuario.php +++ b/src/User/resources/i18n/zh-CN/usuario.php @@ -142,6 +142,7 @@ return [ 'Login' => '', 'Logout' => '', 'Manage users' => '', + 'Mobile phone not found, please check your profile' => '', 'Mobile phone number' => '', 'Mobile phone number successfully enabled.' => '', 'Name' => '', @@ -207,6 +208,10 @@ return [ 'Thank you, registration is now complete.' => '', 'The "recaptcha" component must be configured.' => '', 'The confirmation link is invalid or expired. Please try requesting a new one.' => '', + 'The email address set is: "{0}".' => '', + 'The email sending failed, please check your configuration.' => '', + 'The phone number set is: "{0}".' => '', + 'The sms sending failed, please check your configuration.' => '', 'The verification code is incorrect.' => '', 'There is neither role nor permission with name "{0}"' => '', 'There was an error in saving user' => '', @@ -288,11 +293,13 @@ return [ 'Your password has expired, you must change it now' => '', 'Your personal information has been removed' => '', 'Your profile has been updated' => '', + 'Your two factor authentication method is based on "{0}".' => '', 'privacy policy' => '', '{0, date, MMM dd, YYYY HH:mm}' => '', '{0, date, MMMM dd, YYYY HH:mm}' => '', '{0} cannot be blank.' => '', 'Insert the mobile phone number on which to receive text message.' => '@@@@', + 'Insert the mobile phone number where you want to receive text message in international format.' => '@@@@', 'Insert the mobile phone number where you want to receive text message.' => '@@@@', 'Mobile phone number not registered.' => '@@@@', ]; diff --git a/src/User/resources/views/settings/account.php b/src/User/resources/views/settings/account.php index 42c9164..4acfef0 100644 --- a/src/User/resources/views/settings/account.php +++ b/src/User/resources/views/settings/account.php @@ -12,6 +12,7 @@ use yii\helpers\Html; use yii\helpers\Url; use yii\widgets\ActiveForm; +use dmstr\widgets\Alert; /** * @var yii\web\View $this @@ -102,43 +103,70 @@ $module = Yii::$app->getModule('user');

.

- enableTwoFactorAuthentication && !$model->getUser()->auth_tf_enabled): - $validators = $module->twoFactorAuthenticationValidators; + getUser()->auth_tf_enabled): + $validators = $module->twoFactorAuthenticationValidators; + $theFirstFound = false; foreach( $validators as $name => $validator ) { - $description = $validator[ "description" ]; - $checked = $name=='google-authenticator'?'checked':''; - ?> -
- > - -
- +
+ > + +
+ -
- $model->getUser()->id], - [ - 'id' => 'disable_tf_btn', - 'class' => 'btn btn-warning ' . ($model->getUser()->auth_tf_enabled ? '' : 'hide'), - 'data-method' => 'post', - 'data-confirm' => Yii::t('usuario', 'This will disable two factor authentication. Are you sure?'), - ] - ) ?> + ?> 'enable_tf_btn', - 'class' => 'btn btn-info ' . ($model->getUser()->auth_tf_enabled ? 'hide' : ''), + 'class' => 'btn btn-info', 'data-toggle' => 'modal', 'data-target' => '#tfmodal' ] ) ?> -
+ +

+ getUser()->auth_tf_type; + $message = ''; + switch ($method) { + case 'email': + $message = Yii::t('usuario', 'The email address set is: "{0}".', [ $model->getUser()->email] ); + break; + case 'sms': + $message = Yii::t('usuario', 'The phone number set is: "{0}".', [ $model->getUser()->auth_tf_mobile_phone]); + break; + } + ?> + +

+
+ $model->getUser()->id], + [ + 'id' => 'disable_tf_btn', + 'class' => 'btn btn-warning ', + 'data-method' => 'post', + 'data-confirm' => Yii::t('usuario', 'This will disable two factor authentication. Are you sure?'), + ] + ) ?> +
+
From 52f81d431e8efc0f0d5a54b52c14c81b5e3df948 Mon Sep 17 00:00:00 2001 From: Antonio Cordeddu Date: Tue, 9 Aug 2022 16:56:54 +0200 Subject: [PATCH 04/10] PR #458 - code improvement required by @maxxer --- .../TwoFactorEmailCodeGeneratorService.php | 1 + .../TwoFactorSmsCodeGeneratorService.php | 23 +++++++++---------- .../Validator/TwoFactorEmailValidator.php | 3 ++- .../TwoFactorTextMessageValidator.php | 3 ++- src/User/resources/i18n/it/usuario.php | 8 ++----- 5 files changed, 18 insertions(+), 20 deletions(-) diff --git a/src/User/Service/TwoFactorEmailCodeGeneratorService.php b/src/User/Service/TwoFactorEmailCodeGeneratorService.php index cb15c88..1589f40 100644 --- a/src/User/Service/TwoFactorEmailCodeGeneratorService.php +++ b/src/User/Service/TwoFactorEmailCodeGeneratorService.php @@ -53,6 +53,7 @@ class TwoFactorEmailCodeGeneratorService implements ServiceInterface // check the sending emailYii::t( if(!$mailService->run()){ Yii::$app->session->addFlash('error', Yii::t('usuario','The email sending failed, please check your configuration.')); + return false; }else{ // put key in session Yii::$app->session->set("email_code_time", date('Y-m-d H:i:s')); diff --git a/src/User/Service/TwoFactorSmsCodeGeneratorService.php b/src/User/Service/TwoFactorSmsCodeGeneratorService.php index 7768b6c..862e0c0 100644 --- a/src/User/Service/TwoFactorSmsCodeGeneratorService.php +++ b/src/User/Service/TwoFactorSmsCodeGeneratorService.php @@ -65,20 +65,19 @@ class TwoFactorSmsCodeGeneratorService implements ServiceInterface $user = $this->user; $mobilePhone=$user->getAuthTfMobilePhone(); - if( !(null===$mobilePhone) && $mobilePhone!='' ){ - // send sms - $success = $this->smsSender->send($mobilePhone, $code); - if($success){ - // put key in session - Yii::$app->session->set("sms_code_time", date('Y-m-d H:i:s')); - Yii::$app->session->set("sms_code", $code); - }else{ - Yii::$app->session->addFlash('error', Yii::t('usuario','The sms sending failed, please check your configuration.')); - return false; - } - } else{ + if( null===$mobilePhone || $mobilePhone=='' ){ Yii::$app->session->addFlash('error', Yii::t('usuario','Mobile phone not found, please check your profile')); return false; + } + // send sms + $success = $this->smsSender->send($mobilePhone, $code); + if($success){ + // put key in session + Yii::$app->session->set("sms_code_time", date('Y-m-d H:i:s')); + Yii::$app->session->set("sms_code", $code); + }else{ + Yii::$app->session->addFlash('error', Yii::t('usuario','The sms sending failed, please check your configuration.')); + return false; } return true; } diff --git a/src/User/Validator/TwoFactorEmailValidator.php b/src/User/Validator/TwoFactorEmailValidator.php index ac10cd6..b7619fd 100644 --- a/src/User/Validator/TwoFactorEmailValidator.php +++ b/src/User/Validator/TwoFactorEmailValidator.php @@ -60,8 +60,9 @@ class TwoFactorEmailValidator extends TwoFactorCodeValidator $validators = $module->twoFactorAuthenticationValidators; $codeDurationTime = ArrayHelper::getValue($validators,$this->type.'.codeDurationTime', 300); - if($interval > $codeDurationTime ) + if($interval > $codeDurationTime ){ return false; + } $emailCode = Yii::$app->session->get("email_code"); return $this->code==$emailCode; } diff --git a/src/User/Validator/TwoFactorTextMessageValidator.php b/src/User/Validator/TwoFactorTextMessageValidator.php index 9af30fa..42930f8 100644 --- a/src/User/Validator/TwoFactorTextMessageValidator.php +++ b/src/User/Validator/TwoFactorTextMessageValidator.php @@ -59,8 +59,9 @@ class TwoFactorTextMessageValidator extends TwoFactorCodeValidator $validators = $module->twoFactorAuthenticationValidators; $codeDurationTime = ArrayHelper::getValue($validators,$this->type.'.codeDurationTime', 300); - if($interval > $codeDurationTime ) + if($interval > $codeDurationTime ){ return false; + } $smsCode = Yii::$app->session->get("sms_code"); return $this->code==$smsCode; } diff --git a/src/User/resources/i18n/it/usuario.php b/src/User/resources/i18n/it/usuario.php index a6ef150..b287dd5 100644 --- a/src/User/resources/i18n/it/usuario.php +++ b/src/User/resources/i18n/it/usuario.php @@ -126,6 +126,7 @@ return [ 'Insert' => 'Inserisci', 'Insert the code you received by SMS.' => 'Inserisci il codice ricevuto tramite SMS.', 'Insert the code you received by email.' => 'Inserisci il codice ricevuto tramite email.', + 'Insert the mobile phone number where you want to receive text message in international format' => 'Inserisci il numero di telefono sul quale ricevere il messaggio di testo nel formato internazionale', 'Invalid login or password' => 'Utente o password non validi', 'Invalid or expired link' => 'Collegamento non valido o scaduto', 'Invalid password' => 'Password non valida', @@ -141,6 +142,7 @@ return [ 'Login' => 'Accedi', 'Logout' => 'Esci', 'Manage users' => 'Gestisci gli utenti', + 'Mobile phone not found, please check your profile' => 'Il numero di telefono non è stato trovato. Verifica il tuo profilo', 'Mobile phone number' => 'Numero di cellulare', 'Mobile phone number successfully enabled.' => 'Il numero di cellulare è stato abilitato', 'Name' => 'Nome', @@ -295,13 +297,7 @@ return [ '{0, date, MMM dd, YYYY HH:mm}' => '{0, date, MMM dd, YYYY HH:mm}', '{0, date, MMMM dd, YYYY HH:mm}' => '{0, date, dd MMMM YYYY HH:mm}', '{0} cannot be blank.' => '{0} non può essere vuoto.', - 'Insert the mobile phone number where you want to receive text message in international format' => '', - 'Mobile phone not found, please check your profile' => '', 'This is the code to insert to enable two factor authentication' => '', 'An email has been sent with instructions for resetting your password' => '@@È stata inviata un\'email con le istruzioni per azzerare la tua password@@', - 'Insert the mobile phone number where you want to receive text message in international format.' => '@@Inserisci il numero di telefono sul quale ricevere il messaggio di testo nel formato internazionale@@', - 'Insert the mobile phone number where you want to receive the SMS.' => '@@Inserisci il numero del cellulare sul quale ricevere l\'SMS.@@', - 'Mobile phone number not registered.' => '@@L\'attivazione del numero di cellulare non è riuscita@@', 'Now you can resume the login process' => '@@Ora puoi riprendere il processo di autenticazione@@', - 'Send new code' => '@@Invia un nuovo codice@@', ]; From e3b8f83e483ba9529ced1fe9a8b19e622286ca9e Mon Sep 17 00:00:00 2001 From: Antonio Cordeddu Date: Wed, 10 Aug 2022 10:31:42 +0200 Subject: [PATCH 05/10] updated database dump --- tests/_data/schema.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/_data/schema.sql b/tests/_data/schema.sql index 745a4bb..fafda0b 100644 --- a/tests/_data/schema.sql +++ b/tests/_data/schema.sql @@ -71,6 +71,8 @@ CREATE TABLE `user` ( `updated_at` int(11) NOT NULL, `auth_tf_key` varchar(16) DEFAULT NULL, `auth_tf_enabled` tinyint(1) DEFAULT '0', + `auth_tf_type` varchar(20) DEFAULT NULL, + `auth_tf_mobile_phone` varchar(20) DEFAULT NULL, `flags` int(11) NOT NULL DEFAULT '0', `last_login_at` int(11) DEFAULT NULL, `gdpr_consent` tinyint(1) NULL DEFAULT '0', From 5ee14138bc0b6f68aea53d3242f4c0e350fc9e43 Mon Sep 17 00:00:00 2001 From: Antonio Cordeddu Date: Wed, 10 Aug 2022 13:15:08 +0200 Subject: [PATCH 06/10] #458 fixes on tests, validator and model/user --- src/User/Model/User.php | 2 +- src/User/Validator/TwoFactorCodeValidator.php | 4 ++-- tests/_fixtures/data/user.php | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/User/Model/User.php b/src/User/Model/User.php index 3ee70c0..2adabd8 100644 --- a/src/User/Model/User.php +++ b/src/User/Model/User.php @@ -252,7 +252,7 @@ class User extends ActiveRecord implements IdentityInterface 'twoFactorSecretLength' => ['auth_tf_key', 'string', 'max' => 16], 'twoFactorEnabledNumber' => ['auth_tf_enabled', 'boolean'], 'twoFactorTypeLength' => ['auth_tf_type', 'string', 'max' => 20], - 'twoFactorTypeLength' => ['auth_tf_mobile_phone', 'string', 'max' => 20], + 'twoFactorMobilePhoneLength' => ['auth_tf_mobile_phone', 'string', 'max' => 20], ]; } diff --git a/src/User/Validator/TwoFactorCodeValidator.php b/src/User/Validator/TwoFactorCodeValidator.php index d90448c..2c02575 100644 --- a/src/User/Validator/TwoFactorCodeValidator.php +++ b/src/User/Validator/TwoFactorCodeValidator.php @@ -16,7 +16,7 @@ use Da\TwoFA\Manager; use Da\User\Contracts\ValidatorInterface; use Da\User\Model\User; use Da\User\Traits\ContainerAwareTrait; -use Da\User\Service\TwoFactorEmailCodeGeneratorService; +use Da\User\Service\TwoFactorQrCodeUriGeneratorService; use Yii; class TwoFactorCodeValidator implements ValidatorInterface @@ -94,6 +94,6 @@ class TwoFactorCodeValidator implements ValidatorInterface */ public function generateCode() { - return $this->make(TwoFactorEmailCodeGeneratorService::class,[$this->user])->run(); + return $this->make(TwoFactorQrCodeUriGeneratorService::class,[$this->user])->run(); } } diff --git a/tests/_fixtures/data/user.php b/tests/_fixtures/data/user.php index adb87e9..2f59661 100644 --- a/tests/_fixtures/data/user.php +++ b/tests/_fixtures/data/user.php @@ -81,6 +81,7 @@ return [ 'auth_key' => '39HU0m5lpjWtqstFVGFjj6lFb7UZDeRq', 'auth_tf_key' => '', 'auth_tf_enabled' => true, + 'auth_tf_type' => 'google-authenticator', 'created_at' => $time, 'updated_at' => $time, 'confirmed_at' => $time, From 665466e5437576cb7893b54b3695c87d1271f884 Mon Sep 17 00:00:00 2001 From: Antonio Cordeddu Date: Wed, 10 Aug 2022 14:55:49 +0200 Subject: [PATCH 07/10] #458 added required-dev library for 2fa --- composer.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/composer.json b/composer.json index 204a5f1..a503aa6 100644 --- a/composer.json +++ b/composer.json @@ -53,6 +53,8 @@ "2amigos/qrcode-library": "Needed if you want to enable 2FA with QR Code generation. Require version ^1.1" }, "require-dev": { + "2amigos/2fa-library": "^1.0", + "2amigos/qrcode-library": "^1.1", "friendsofphp/php-cs-fixer": "^2.3", "squizlabs/php_codesniffer": "*", "phpmd/phpmd": "@stable", From 8b6c6282f98a0f308698432863c48bb7e8bed983 Mon Sep 17 00:00:00 2001 From: Antonio Cordeddu Date: Wed, 10 Aug 2022 15:59:52 +0200 Subject: [PATCH 08/10] #458 fix on sms 2fa management --- docs/installation/configuration-options.md | 1 + docs/installation/mailer.md | 1 + src/User/Bootstrap.php | 9 ++++----- src/User/Controller/SettingsController.php | 8 ++++---- src/User/Factory/MailFactory.php | 2 +- src/User/Module.php | 2 +- src/User/resources/i18n/ca/usuario.php | 5 +++-- src/User/resources/i18n/da/usuario.php | 5 +++-- src/User/resources/i18n/de-DU/usuario.php | 5 +++-- src/User/resources/i18n/de/usuario.php | 6 +++--- src/User/resources/i18n/es/usuario.php | 5 +++-- src/User/resources/i18n/et/usuario.php | 5 +++-- src/User/resources/i18n/fa-IR/usuario.php | 19 +++---------------- src/User/resources/i18n/fi/usuario.php | 5 +++-- src/User/resources/i18n/fr/usuario.php | 6 +++--- src/User/resources/i18n/hr/usuario.php | 5 +++-- src/User/resources/i18n/hu/usuario.php | 5 +++-- src/User/resources/i18n/it/usuario.php | 7 ++++--- src/User/resources/i18n/kk/usuario.php | 5 +++-- src/User/resources/i18n/lt/usuario.php | 5 +++-- src/User/resources/i18n/nl/usuario.php | 5 +++-- src/User/resources/i18n/pl/usuario.php | 5 +++-- src/User/resources/i18n/pt-BR/usuario.php | 5 +++-- src/User/resources/i18n/pt-PT/usuario.php | 5 +++-- src/User/resources/i18n/ro/usuario.php | 5 +++-- src/User/resources/i18n/ru/usuario.php | 5 +++-- src/User/resources/i18n/th/usuario.php | 5 +++-- src/User/resources/i18n/tr-TR/usuario.php | 5 +++-- src/User/resources/i18n/uk/usuario.php | 5 +++-- src/User/resources/i18n/vi/usuario.php | 5 +++-- src/User/resources/i18n/zh-CN/usuario.php | 5 +++-- 31 files changed, 88 insertions(+), 78 deletions(-) diff --git a/docs/installation/configuration-options.md b/docs/installation/configuration-options.md index 8d21a06..4832174 100644 --- a/docs/installation/configuration-options.md +++ b/docs/installation/configuration-options.md @@ -216,6 +216,7 @@ Configures the parameter values used on [MailFactory](../../src/User/Factory/Mai 'confirmationMailSubject' => Yii::t('usuario', 'Confirm account on {0}', $app->name), 'reconfirmationMailSubject' => Yii::t('usuario', 'Confirm email change on {0}', $app->name), 'recoveryMailSubject' => Yii::t('usuario', 'Complete password reset on {0}', $app->name), + 'twoFactorMailSubject' => Yii::t('usuario', 'Code for two factor authentication', $app->name), ] ``` diff --git a/docs/installation/mailer.md b/docs/installation/mailer.md index 870db41..0fc470e 100644 --- a/docs/installation/mailer.md +++ b/docs/installation/mailer.md @@ -14,6 +14,7 @@ values: 'confirmationMailSubject' => Yii::t('usuario', 'Confirm account on {0}', $app->name), 'reconfirmationMailSubject' => Yii::t('usuario', 'Confirm email change on {0}', $app->name), 'recoveryMailSubject' => Yii::t('usuario', 'Complete password reset on {0}', $app->name), + 'twoFactorMailSubject' => Yii::t('usuario', 'Code for two factor authentication', $app->name), ] ``` diff --git a/src/User/Bootstrap.php b/src/User/Bootstrap.php index 9f5bd3a..e729092 100644 --- a/src/User/Bootstrap.php +++ b/src/User/Bootstrap.php @@ -192,11 +192,9 @@ class Bootstrap implements BootstrapInterface ] ]; - $app->getModule('user')->twoFactorAuthenticationValidators = - ArrayHelper::merge($app->getModule('user')->twoFactorAuthenticationValidators, $defaultTwoFactorAuthenticationValidators); - - - + $app->getModule('user')->twoFactorAuthenticationValidators = ArrayHelper::merge( + $defaultTwoFactorAuthenticationValidators, $app->getModule('user')->twoFactorAuthenticationValidators); + if ($app instanceof WebApplication) { // override Yii $di->set( @@ -294,6 +292,7 @@ class Bootstrap implements BootstrapInterface 'confirmationMailSubject' => Yii::t('usuario', 'Confirm account on {0}', $app->name), 'reconfirmationMailSubject' => Yii::t('usuario', 'Confirm email change on {0}', $app->name), 'recoveryMailSubject' => Yii::t('usuario', 'Complete password reset on {0}', $app->name), + 'twoFactorMailSubject' => Yii::t('usuario', 'Code for two factor authentication', $app->name), ]; $module->mailParams = array_merge($defaults, $module->mailParams); diff --git a/src/User/Controller/SettingsController.php b/src/User/Controller/SettingsController.php index 8304148..eab2fad 100644 --- a/src/User/Controller/SettingsController.php +++ b/src/User/Controller/SettingsController.php @@ -583,14 +583,14 @@ class SettingsController extends Controller $success=true; }else{ $success = $user->updateAttributes(['auth_tf_mobile_phone' => $mobilePhone]); - $this->make(TwoFactorSmsCodeGeneratorService::class, [$user])->run(); - } - + } + $success = $success && $this->make(TwoFactorSmsCodeGeneratorService::class, [$user])->run(); + return [ 'success' => $success, 'message' => $success ? Yii::t('usuario', 'Mobile phone number successfully enabled.') - : Yii::t('usuario', 'Error while enabling SMS two factor authentication.'), + : Yii::t('usuario', 'Error while enabling SMS two factor authentication. Please reload the page.'), ]; } } diff --git a/src/User/Factory/MailFactory.php b/src/User/Factory/MailFactory.php index b0bd708..4018a30 100644 --- a/src/User/Factory/MailFactory.php +++ b/src/User/Factory/MailFactory.php @@ -128,7 +128,7 @@ class MailFactory $to = $user->email; $from = $module->mailParams['fromEmail']; - $subject = $module->mailParams['reconfirmationMailSubject']; + $subject = $module->mailParams['twoFactorMailSubject']; $params = [ 'code' => $code, ]; diff --git a/src/User/Module.php b/src/User/Module.php index 043db74..5942962 100644 --- a/src/User/Module.php +++ b/src/User/Module.php @@ -88,7 +88,7 @@ class Module extends BaseModule /** * @var array list of channels for two factor authentication availables */ - public $twoFactorAuthenticationValidators = null; + public $twoFactorAuthenticationValidators = []; /** * @var int cycles of key generation are set on 30 sec. To avoid sync issues, increased validity up to 60 sec. * @see http://2fa-library.readthedocs.io/en/latest/ diff --git a/src/User/resources/i18n/ca/usuario.php b/src/User/resources/i18n/ca/usuario.php index f6676a4..34821ab 100644 --- a/src/User/resources/i18n/ca/usuario.php +++ b/src/User/resources/i18n/ca/usuario.php @@ -63,6 +63,7 @@ return [ 'Children' => '', 'Class' => '', 'Close' => '', + 'Code for two factor authentication' => '', 'Complete password reset on {0}' => '', 'Confirm' => '', 'Confirm account on {0}' => '', @@ -105,7 +106,7 @@ return [ 'Error occurred while deleting user' => '', 'Error sending registration message to "{email}". Please try again later.' => '', 'Error sending welcome message to "{email}". Please try again later.' => '', - 'Error while enabling SMS two factor authentication.' => '', + 'Error while enabling SMS two factor authentication. Please reload the page.' => '', 'Export my data' => '', 'Finish' => '', 'Force password change at next login' => '', @@ -293,8 +294,8 @@ return [ 'Your password has expired, you must change it now' => '', 'Your personal information has been removed' => '', 'Your profile has been updated' => '', - 'Your two factor authentication method is based on "{0}".' => '', 'Your role requires 2FA, you won\'t be able to use the application until you enable it' => '', + 'Your two factor authentication method is based on "{0}".' => '', 'privacy policy' => '', '{0, date, MMM dd, YYYY HH:mm}' => '', '{0, date, MMMM dd, YYYY HH:mm}' => '', diff --git a/src/User/resources/i18n/da/usuario.php b/src/User/resources/i18n/da/usuario.php index f6676a4..34821ab 100644 --- a/src/User/resources/i18n/da/usuario.php +++ b/src/User/resources/i18n/da/usuario.php @@ -63,6 +63,7 @@ return [ 'Children' => '', 'Class' => '', 'Close' => '', + 'Code for two factor authentication' => '', 'Complete password reset on {0}' => '', 'Confirm' => '', 'Confirm account on {0}' => '', @@ -105,7 +106,7 @@ return [ 'Error occurred while deleting user' => '', 'Error sending registration message to "{email}". Please try again later.' => '', 'Error sending welcome message to "{email}". Please try again later.' => '', - 'Error while enabling SMS two factor authentication.' => '', + 'Error while enabling SMS two factor authentication. Please reload the page.' => '', 'Export my data' => '', 'Finish' => '', 'Force password change at next login' => '', @@ -293,8 +294,8 @@ return [ 'Your password has expired, you must change it now' => '', 'Your personal information has been removed' => '', 'Your profile has been updated' => '', - 'Your two factor authentication method is based on "{0}".' => '', 'Your role requires 2FA, you won\'t be able to use the application until you enable it' => '', + 'Your two factor authentication method is based on "{0}".' => '', 'privacy policy' => '', '{0, date, MMM dd, YYYY HH:mm}' => '', '{0, date, MMMM dd, YYYY HH:mm}' => '', diff --git a/src/User/resources/i18n/de-DU/usuario.php b/src/User/resources/i18n/de-DU/usuario.php index 220e11b..e0b09da 100644 --- a/src/User/resources/i18n/de-DU/usuario.php +++ b/src/User/resources/i18n/de-DU/usuario.php @@ -274,8 +274,9 @@ return [ '{0, date, MMMM dd, YYYY HH:mm}' => '{0, date, dd. MMMM YYYY, HH:mm}', '{0} cannot be blank.' => '{0} darf nicht leer sein.', 'According to the European General Data Protection Regulation (GDPR) we need your consent to work with your personal data.' => '', + 'Code for two factor authentication' => '', 'Data privacy' => '', - 'Error while enabling SMS two factor authentication.' => '', + 'Error while enabling SMS two factor authentication. Please reload the page.' => '', 'Google Authenticator' => '', 'Insert' => '', 'Insert the code you received by SMS.' => '', @@ -297,6 +298,6 @@ return [ 'Two factor authentication code by email' => '', 'Unfortunately, you can not work with this site without giving us consent to process your data.' => '', 'Your consent is required to work with this site' => '', - 'Your two factor authentication method is based on "{0}".' => '', 'Your role requires 2FA, you won\'t be able to use the application until you enable it' => '', + 'Your two factor authentication method is based on "{0}".' => '', ]; diff --git a/src/User/resources/i18n/de/usuario.php b/src/User/resources/i18n/de/usuario.php index e4684e9..6c37ed3 100644 --- a/src/User/resources/i18n/de/usuario.php +++ b/src/User/resources/i18n/de/usuario.php @@ -277,7 +277,8 @@ return [ '{0, date, MMM dd, YYYY HH:mm}' => '{0, date, dd. MMM YYYY, HH:mm}', '{0, date, MMMM dd, YYYY HH:mm}' => '{0, date, dd. MMMM YYYY, HH:mm}', '{0} cannot be blank.' => '{0} darf nicht leer sein.', - 'Error while enabling SMS two factor authentication.' => '', + 'Code for two factor authentication' => '', + 'Error while enabling SMS two factor authentication. Please reload the page.' => '', 'Google Authenticator' => '', 'Information' => '', 'Insert' => '', @@ -297,7 +298,6 @@ return [ 'This is the code to insert to enable two factor authentication' => '', 'Two factor authentication code by SMS' => '', 'Two factor authentication code by email' => '', - 'Your two factor authentication method is based on "{0}".' => '', - 'Information' => '', 'Your role requires 2FA, you won\'t be able to use the application until you enable it' => '', + 'Your two factor authentication method is based on "{0}".' => '', ]; diff --git a/src/User/resources/i18n/es/usuario.php b/src/User/resources/i18n/es/usuario.php index 74947a2..9e348cf 100644 --- a/src/User/resources/i18n/es/usuario.php +++ b/src/User/resources/i18n/es/usuario.php @@ -276,7 +276,8 @@ return [ 'privacy policy' => 'política de privacidad', '{0, date, MMMM dd, YYYY HH:mm}' => '{0, date, dd MMMM, YYYY HH:mm}', '{0} cannot be blank.' => '{0} no puede estar vacío.', - 'Error while enabling SMS two factor authentication.' => '', + 'Code for two factor authentication' => '', + 'Error while enabling SMS two factor authentication. Please reload the page.' => '', 'Google Authenticator' => '', 'Insert' => '', 'Insert the code you received by SMS.' => '', @@ -296,7 +297,7 @@ return [ 'Two factor authentication code by SMS' => '', 'Two factor authentication code by email' => '', 'Your consent is required to work with this site' => '', + 'Your role requires 2FA, you won\'t be able to use the application until you enable it' => '', 'Your two factor authentication method is based on "{0}".' => '', '{0, date, MMM dd, YYYY HH:mm}' => '', - 'Your role requires 2FA, you won\'t be able to use the application until you enable it' => '', ]; diff --git a/src/User/resources/i18n/et/usuario.php b/src/User/resources/i18n/et/usuario.php index 4fc43e3..e4f63ce 100644 --- a/src/User/resources/i18n/et/usuario.php +++ b/src/User/resources/i18n/et/usuario.php @@ -269,8 +269,9 @@ return [ '{0} cannot be blank.' => '{0} ei või olla tühi.', 'According to the European General Data Protection Regulation (GDPR) we need your consent to work with your personal data.' => '', 'Authentication rule class {0} can not be instantiated' => '', + 'Code for two factor authentication' => '', 'Data privacy' => '', - 'Error while enabling SMS two factor authentication.' => '', + 'Error while enabling SMS two factor authentication. Please reload the page.' => '', 'Google Authenticator' => '', 'Insert' => '', 'Insert the code you received by SMS.' => '', @@ -295,8 +296,8 @@ return [ 'VKontakte' => '', 'Yandex' => '', 'Your consent is required to work with this site' => '', + 'Your role requires 2FA, you won\'t be able to use the application until you enable it' => '', 'Your two factor authentication method is based on "{0}".' => '', '{0, date, MMM dd, YYYY HH:mm}' => '', '{0, date, MMMM dd, YYYY HH:mm}' => '', - 'Your role requires 2FA, you won\'t be able to use the application until you enable it' => '', ]; diff --git a/src/User/resources/i18n/fa-IR/usuario.php b/src/User/resources/i18n/fa-IR/usuario.php index fbde06a..e37eb98 100644 --- a/src/User/resources/i18n/fa-IR/usuario.php +++ b/src/User/resources/i18n/fa-IR/usuario.php @@ -173,6 +173,7 @@ return [ 'Children' => '', 'Class' => '', 'Close' => '', + 'Code for two factor authentication' => '', 'Create new permission' => '', 'Create new role' => '', 'Create new rule' => '', @@ -190,7 +191,7 @@ return [ 'Enable two factor authentication' => '', 'Error sending registration message to "{email}". Please try again later.' => '', 'Error sending welcome message to "{email}". Please try again later.' => '', - 'Error while enabling SMS two factor authentication.' => '', + 'Error while enabling SMS two factor authentication. Please reload the page.' => '', 'Export my data' => '', 'Force password change at next login' => '', 'Google Authenticator' => '', @@ -294,23 +295,9 @@ return [ 'Your consent is required to work with this site' => '', 'Your password has expired, you must change it now' => '', 'Your personal information has been removed' => '', -<<<<<<< HEAD - 'Your two factor authentication method is based on "{0}".' => '', -======= 'Your role requires 2FA, you won\'t be able to use the application until you enable it' => '', ->>>>>>> upstream/master + 'Your two factor authentication method is based on "{0}".' => '', 'privacy policy' => '', '{0, date, MMM dd, YYYY HH:mm}' => '', '{0} cannot be blank.' => '', - 'An email has been sent with instructions for resetting your password' => '@@ایمیلی حاوی راهنمایی برای تنظیم مجدد رمز عبور به شما ارسال شد@@', -<<<<<<< HEAD - 'Insert the mobile phone number on which to receive text message.' => '@@@@', - 'Insert the mobile phone number where you want to receive text message in international format.' => '@@@@', - 'Insert the mobile phone number where you want to receive text message.' => '@@@@', - 'Mobile phone number not registered.' => '@@@@', -======= - 'Every user having your role has two factor authentication mandatory, you must enable it' => '@@@@', - 'Now you can resume the login process' => '@@@@', ->>>>>>> upstream/master - 'Registration ip' => '@@ای پی ثبت نام@@', ]; diff --git a/src/User/resources/i18n/fi/usuario.php b/src/User/resources/i18n/fi/usuario.php index f6676a4..34821ab 100644 --- a/src/User/resources/i18n/fi/usuario.php +++ b/src/User/resources/i18n/fi/usuario.php @@ -63,6 +63,7 @@ return [ 'Children' => '', 'Class' => '', 'Close' => '', + 'Code for two factor authentication' => '', 'Complete password reset on {0}' => '', 'Confirm' => '', 'Confirm account on {0}' => '', @@ -105,7 +106,7 @@ return [ 'Error occurred while deleting user' => '', 'Error sending registration message to "{email}". Please try again later.' => '', 'Error sending welcome message to "{email}". Please try again later.' => '', - 'Error while enabling SMS two factor authentication.' => '', + 'Error while enabling SMS two factor authentication. Please reload the page.' => '', 'Export my data' => '', 'Finish' => '', 'Force password change at next login' => '', @@ -293,8 +294,8 @@ return [ 'Your password has expired, you must change it now' => '', 'Your personal information has been removed' => '', 'Your profile has been updated' => '', - 'Your two factor authentication method is based on "{0}".' => '', 'Your role requires 2FA, you won\'t be able to use the application until you enable it' => '', + 'Your two factor authentication method is based on "{0}".' => '', 'privacy policy' => '', '{0, date, MMM dd, YYYY HH:mm}' => '', '{0, date, MMMM dd, YYYY HH:mm}' => '', diff --git a/src/User/resources/i18n/fr/usuario.php b/src/User/resources/i18n/fr/usuario.php index 0c2c5a1..b6c1b02 100644 --- a/src/User/resources/i18n/fr/usuario.php +++ b/src/User/resources/i18n/fr/usuario.php @@ -273,8 +273,9 @@ return [ '{0, date, MMMM dd, YYYY HH:mm}' => '{0, date, dd MMMM YYYY HH:mm}', '{0} cannot be blank.' => '{0} ne peut être vide.', 'According to the European General Data Protection Regulation (GDPR) we need your consent to work with your personal data.' => '', + 'Code for two factor authentication' => '', 'Data privacy' => '', - 'Error while enabling SMS two factor authentication.' => '', + 'Error while enabling SMS two factor authentication. Please reload the page.' => '', 'Google Authenticator' => '', 'Insert' => '', 'Insert the code you received by SMS.' => '', @@ -296,8 +297,7 @@ return [ 'Two factor authentication code by email' => '', 'Unfortunately, you can not work with this site without giving us consent to process your data.' => '', 'Your consent is required to work with this site' => '', + 'Your role requires 2FA, you won\'t be able to use the application until you enable it' => '', 'Your two factor authentication method is based on "{0}".' => '', '{0, date, MMM dd, YYYY HH:mm}' => '', - 'Your role requires 2FA, you won\'t be able to use the application until you enable it' => '', - '{0, date, MMM dd, YYYY HH:mm}' => '', ]; diff --git a/src/User/resources/i18n/hr/usuario.php b/src/User/resources/i18n/hr/usuario.php index f6676a4..34821ab 100644 --- a/src/User/resources/i18n/hr/usuario.php +++ b/src/User/resources/i18n/hr/usuario.php @@ -63,6 +63,7 @@ return [ 'Children' => '', 'Class' => '', 'Close' => '', + 'Code for two factor authentication' => '', 'Complete password reset on {0}' => '', 'Confirm' => '', 'Confirm account on {0}' => '', @@ -105,7 +106,7 @@ return [ 'Error occurred while deleting user' => '', 'Error sending registration message to "{email}". Please try again later.' => '', 'Error sending welcome message to "{email}". Please try again later.' => '', - 'Error while enabling SMS two factor authentication.' => '', + 'Error while enabling SMS two factor authentication. Please reload the page.' => '', 'Export my data' => '', 'Finish' => '', 'Force password change at next login' => '', @@ -293,8 +294,8 @@ return [ 'Your password has expired, you must change it now' => '', 'Your personal information has been removed' => '', 'Your profile has been updated' => '', - 'Your two factor authentication method is based on "{0}".' => '', 'Your role requires 2FA, you won\'t be able to use the application until you enable it' => '', + 'Your two factor authentication method is based on "{0}".' => '', 'privacy policy' => '', '{0, date, MMM dd, YYYY HH:mm}' => '', '{0, date, MMMM dd, YYYY HH:mm}' => '', diff --git a/src/User/resources/i18n/hu/usuario.php b/src/User/resources/i18n/hu/usuario.php index 13ae72e..7ef52a3 100644 --- a/src/User/resources/i18n/hu/usuario.php +++ b/src/User/resources/i18n/hu/usuario.php @@ -271,8 +271,9 @@ return [ '{0} cannot be blank.' => '{0} nem lehet üres.', 'According to the European General Data Protection Regulation (GDPR) we need your consent to work with your personal data.' => '', 'An email with instructions to create a new password has been sent to {email} if it is associated with an {appName} account. Your existing password has not been changed.' => '', + 'Code for two factor authentication' => '', 'Data privacy' => '', - 'Error while enabling SMS two factor authentication.' => '', + 'Error while enabling SMS two factor authentication. Please reload the page.' => '', 'Google Authenticator' => '', 'Insert' => '', 'Insert the code you received by SMS.' => '', @@ -297,6 +298,6 @@ return [ 'Two factor authentication protects you in case of stolen credentials' => '', 'Unfortunately, you can not work with this site without giving us consent to process your data.' => '', 'Your consent is required to work with this site' => '', - 'Your two factor authentication method is based on "{0}".' => '', 'Your role requires 2FA, you won\'t be able to use the application until you enable it' => '', + 'Your two factor authentication method is based on "{0}".' => '', ]; diff --git a/src/User/resources/i18n/it/usuario.php b/src/User/resources/i18n/it/usuario.php index b416097..0eba230 100644 --- a/src/User/resources/i18n/it/usuario.php +++ b/src/User/resources/i18n/it/usuario.php @@ -63,6 +63,7 @@ return [ 'Children' => 'Figli', 'Class' => 'Classe', 'Close' => 'Chiudi', + 'Code for two factor authentication' => 'Codice per l\'autenticazione a due fattori', 'Complete password reset on {0}' => 'Completa la procedura di reset della password su {0}', 'Confirm' => 'Conferma', 'Confirm account on {0}' => 'Conferma l\'account su {0}', @@ -105,7 +106,7 @@ return [ 'Error occurred while deleting user' => 'Si è verificato un errore durante l\'eliminazione dell\'utente', 'Error sending registration message to "{email}". Please try again later.' => 'C\'è stato un errore nell\'invio del messaggio di registrazione all\'indirizzo "{email}". Per favore ritenta più tardi.', 'Error sending welcome message to "{email}". Please try again later.' => 'C\'è stato un errore nell\'invio del messaggio di benvenuto all\'indirizzo "{email}". Per favore ritenta più tardi.', - 'Error while enabling SMS two factor authentication.' => 'Errore in fase di attivazione dell\'autenticazione a due fattori tramite SMS', + 'Error while enabling SMS two factor authentication. Please reload the page.' => 'Errore in fase di attivazione dell\'autenticazione a due fattori tramite SMS. Ricarica la pagina', 'Export my data' => 'Esporta i miei dati', 'Finish' => 'Completa', 'Force password change at next login' => 'Forza il cambio password al prossimo accesso', @@ -211,7 +212,7 @@ return [ 'The email address set is: "{0}".' => 'L\'indirizzo email impostato è: "{0}".', 'The email sending failed, please check your configuration.' => 'L\'invio della email non è riuscito, verifica la configurazione', 'The phone number set is: "{0}".' => 'Il numero di telefono impostato è: "{0}".', - 'The sms sending failed, please check your configuration.' => 'L\'invio del messaggio di testo non è riuscito, verifica la configurazione', + 'The sms sending failed, please check your configuration.' => 'L\'invio del messaggio di testo non è riuscito, verifica il numero di cellulare o contatta l\'assistenza', 'The verification code is incorrect.' => 'Il codice di verifica non è corretto.', 'There is neither role nor permission with name "{0}"' => 'Non esiste un ruolo o permesso di nome "{0}', 'There was an error in saving user' => 'Errore in salvataggio utente', @@ -292,8 +293,8 @@ return [ 'Your password has expired, you must change it now' => 'La tua password è scaduta, devi cambiarla', 'Your personal information has been removed' => 'I tuoi dati personali sono stati rimossi', 'Your profile has been updated' => 'Il tuo profilo è stato aggiornato', - 'Your two factor authentication method is based on "{0}".' => 'La tua autenticazione a due fattori è basata su "{0}".', 'Your role requires 2FA, you won\'t be able to use the application until you enable it' => 'Il tuo ruolo richiede l\'autenticazione a due fattori, non potrai usare l\'applicazione finché non l\'avrai abilitata', + 'Your two factor authentication method is based on "{0}".' => 'La tua autenticazione a due fattori è basata su "{0}".', 'privacy policy' => 'politica della privacy', '{0, date, MMM dd, YYYY HH:mm}' => '{0, date, MMM dd, YYYY HH:mm}', '{0, date, MMMM dd, YYYY HH:mm}' => '{0, date, dd MMMM YYYY HH:mm}', diff --git a/src/User/resources/i18n/kk/usuario.php b/src/User/resources/i18n/kk/usuario.php index f6676a4..34821ab 100644 --- a/src/User/resources/i18n/kk/usuario.php +++ b/src/User/resources/i18n/kk/usuario.php @@ -63,6 +63,7 @@ return [ 'Children' => '', 'Class' => '', 'Close' => '', + 'Code for two factor authentication' => '', 'Complete password reset on {0}' => '', 'Confirm' => '', 'Confirm account on {0}' => '', @@ -105,7 +106,7 @@ return [ 'Error occurred while deleting user' => '', 'Error sending registration message to "{email}". Please try again later.' => '', 'Error sending welcome message to "{email}". Please try again later.' => '', - 'Error while enabling SMS two factor authentication.' => '', + 'Error while enabling SMS two factor authentication. Please reload the page.' => '', 'Export my data' => '', 'Finish' => '', 'Force password change at next login' => '', @@ -293,8 +294,8 @@ return [ 'Your password has expired, you must change it now' => '', 'Your personal information has been removed' => '', 'Your profile has been updated' => '', - 'Your two factor authentication method is based on "{0}".' => '', 'Your role requires 2FA, you won\'t be able to use the application until you enable it' => '', + 'Your two factor authentication method is based on "{0}".' => '', 'privacy policy' => '', '{0, date, MMM dd, YYYY HH:mm}' => '', '{0, date, MMMM dd, YYYY HH:mm}' => '', diff --git a/src/User/resources/i18n/lt/usuario.php b/src/User/resources/i18n/lt/usuario.php index f6676a4..34821ab 100644 --- a/src/User/resources/i18n/lt/usuario.php +++ b/src/User/resources/i18n/lt/usuario.php @@ -63,6 +63,7 @@ return [ 'Children' => '', 'Class' => '', 'Close' => '', + 'Code for two factor authentication' => '', 'Complete password reset on {0}' => '', 'Confirm' => '', 'Confirm account on {0}' => '', @@ -105,7 +106,7 @@ return [ 'Error occurred while deleting user' => '', 'Error sending registration message to "{email}". Please try again later.' => '', 'Error sending welcome message to "{email}". Please try again later.' => '', - 'Error while enabling SMS two factor authentication.' => '', + 'Error while enabling SMS two factor authentication. Please reload the page.' => '', 'Export my data' => '', 'Finish' => '', 'Force password change at next login' => '', @@ -293,8 +294,8 @@ return [ 'Your password has expired, you must change it now' => '', 'Your personal information has been removed' => '', 'Your profile has been updated' => '', - 'Your two factor authentication method is based on "{0}".' => '', 'Your role requires 2FA, you won\'t be able to use the application until you enable it' => '', + 'Your two factor authentication method is based on "{0}".' => '', 'privacy policy' => '', '{0, date, MMM dd, YYYY HH:mm}' => '', '{0, date, MMMM dd, YYYY HH:mm}' => '', diff --git a/src/User/resources/i18n/nl/usuario.php b/src/User/resources/i18n/nl/usuario.php index ed90213..4cdc751 100644 --- a/src/User/resources/i18n/nl/usuario.php +++ b/src/User/resources/i18n/nl/usuario.php @@ -271,8 +271,9 @@ return [ '{0} cannot be blank.' => '{0} kan niet leeg zijn.', 'According to the European General Data Protection Regulation (GDPR) we need your consent to work with your personal data.' => '', 'An email with instructions to create a new password has been sent to {email} if it is associated with an {appName} account. Your existing password has not been changed.' => '', + 'Code for two factor authentication' => '', 'Data privacy' => '', - 'Error while enabling SMS two factor authentication.' => '', + 'Error while enabling SMS two factor authentication. Please reload the page.' => '', 'Google Authenticator' => '', 'Insert' => '', 'Insert the code you received by SMS.' => '', @@ -297,6 +298,6 @@ return [ 'Two factor authentication protects you in case of stolen credentials' => '', 'Unfortunately, you can not work with this site without giving us consent to process your data.' => '', 'Your consent is required to work with this site' => '', - 'Your two factor authentication method is based on "{0}".' => '', 'Your role requires 2FA, you won\'t be able to use the application until you enable it' => '', + 'Your two factor authentication method is based on "{0}".' => '', ]; diff --git a/src/User/resources/i18n/pl/usuario.php b/src/User/resources/i18n/pl/usuario.php index b2da065..52e3001 100644 --- a/src/User/resources/i18n/pl/usuario.php +++ b/src/User/resources/i18n/pl/usuario.php @@ -271,8 +271,9 @@ return [ '{0} cannot be blank.' => '{0} nie może pozostać bez wartości', 'According to the European General Data Protection Regulation (GDPR) we need your consent to work with your personal data.' => '', 'An email with instructions to create a new password has been sent to {email} if it is associated with an {appName} account. Your existing password has not been changed.' => '', + 'Code for two factor authentication' => '', 'Data privacy' => '', - 'Error while enabling SMS two factor authentication.' => '', + 'Error while enabling SMS two factor authentication. Please reload the page.' => '', 'Google Authenticator' => '', 'Insert' => '', 'Insert the code you received by SMS.' => '', @@ -297,6 +298,6 @@ return [ 'Two factor authentication protects you in case of stolen credentials' => '', 'Unfortunately, you can not work with this site without giving us consent to process your data.' => '', 'Your consent is required to work with this site' => '', - 'Your two factor authentication method is based on "{0}".' => '', 'Your role requires 2FA, you won\'t be able to use the application until you enable it' => '', + 'Your two factor authentication method is based on "{0}".' => '', ]; diff --git a/src/User/resources/i18n/pt-BR/usuario.php b/src/User/resources/i18n/pt-BR/usuario.php index c74896a..d5e6f4a 100644 --- a/src/User/resources/i18n/pt-BR/usuario.php +++ b/src/User/resources/i18n/pt-BR/usuario.php @@ -271,8 +271,9 @@ return [ '{0} cannot be blank.' => '{0} não pode estar em branco', 'According to the European General Data Protection Regulation (GDPR) we need your consent to work with your personal data.' => '', 'An email with instructions to create a new password has been sent to {email} if it is associated with an {appName} account. Your existing password has not been changed.' => '', + 'Code for two factor authentication' => '', 'Data privacy' => '', - 'Error while enabling SMS two factor authentication.' => '', + 'Error while enabling SMS two factor authentication. Please reload the page.' => '', 'Google Authenticator' => '', 'Insert' => '', 'Insert the code you received by SMS.' => '', @@ -297,6 +298,6 @@ return [ 'Two factor authentication protects you in case of stolen credentials' => '', 'Unfortunately, you can not work with this site without giving us consent to process your data.' => '', 'Your consent is required to work with this site' => '', - 'Your two factor authentication method is based on "{0}".' => '', 'Your role requires 2FA, you won\'t be able to use the application until you enable it' => '', + 'Your two factor authentication method is based on "{0}".' => '', ]; diff --git a/src/User/resources/i18n/pt-PT/usuario.php b/src/User/resources/i18n/pt-PT/usuario.php index 8975c83..019bff5 100644 --- a/src/User/resources/i18n/pt-PT/usuario.php +++ b/src/User/resources/i18n/pt-PT/usuario.php @@ -262,9 +262,10 @@ return [ 'Awesome, almost there. Now you need to click the confirmation link sent to your old email address.' => '', 'Children' => '', 'Class' => '', + 'Code for two factor authentication' => '', 'Data privacy' => '', 'Email' => '', - 'Error while enabling SMS two factor authentication.' => '', + 'Error while enabling SMS two factor authentication. Please reload the page.' => '', 'Google Authenticator' => '', 'Gravatar email' => '', 'Insert' => '', @@ -295,8 +296,8 @@ return [ 'Website' => '', 'Yandex' => '', 'Your consent is required to work with this site' => '', + 'Your role requires 2FA, you won\'t be able to use the application until you enable it' => '', 'Your two factor authentication method is based on "{0}".' => '', '{0, date, MMM dd, YYYY HH:mm}' => '', '{0, date, MMMM dd, YYYY HH:mm}' => '', - 'Your role requires 2FA, you won\'t be able to use the application until you enable it' => '', ]; diff --git a/src/User/resources/i18n/ro/usuario.php b/src/User/resources/i18n/ro/usuario.php index e0e1b1c..9638b12 100644 --- a/src/User/resources/i18n/ro/usuario.php +++ b/src/User/resources/i18n/ro/usuario.php @@ -271,8 +271,9 @@ return [ '{0} cannot be blank.' => '{0} nu poate fi gol.', 'According to the European General Data Protection Regulation (GDPR) we need your consent to work with your personal data.' => '', 'An email with instructions to create a new password has been sent to {email} if it is associated with an {appName} account. Your existing password has not been changed.' => '', + 'Code for two factor authentication' => '', 'Data privacy' => '', - 'Error while enabling SMS two factor authentication.' => '', + 'Error while enabling SMS two factor authentication. Please reload the page.' => '', 'Google Authenticator' => '', 'Insert' => '', 'Insert the code you received by SMS.' => '', @@ -297,6 +298,6 @@ return [ 'Two factor authentication protects you in case of stolen credentials' => '', 'Unfortunately, you can not work with this site without giving us consent to process your data.' => '', 'Your consent is required to work with this site' => '', - 'Your two factor authentication method is based on "{0}".' => '', 'Your role requires 2FA, you won\'t be able to use the application until you enable it' => '', + 'Your two factor authentication method is based on "{0}".' => '', ]; diff --git a/src/User/resources/i18n/ru/usuario.php b/src/User/resources/i18n/ru/usuario.php index ff29e36..b1c8bde 100644 --- a/src/User/resources/i18n/ru/usuario.php +++ b/src/User/resources/i18n/ru/usuario.php @@ -274,8 +274,9 @@ return [ '{0, date, MMMM dd, YYYY HH:mm}' => '{0, date, d MMMM YYYY в HH:mm}', '{0} cannot be blank.' => '{0} не может быть пустым.', 'According to the European General Data Protection Regulation (GDPR) we need your consent to work with your personal data.' => '', + 'Code for two factor authentication' => '', 'Data privacy' => '', - 'Error while enabling SMS two factor authentication.' => '', + 'Error while enabling SMS two factor authentication. Please reload the page.' => '', 'Google Authenticator' => '', 'Insert' => '', 'Insert the code you received by SMS.' => '', @@ -297,6 +298,6 @@ return [ 'Two factor authentication code by email' => '', 'Unfortunately, you can not work with this site without giving us consent to process your data.' => '', 'Your consent is required to work with this site' => '', - 'Your two factor authentication method is based on "{0}".' => '', 'Your role requires 2FA, you won\'t be able to use the application until you enable it' => '', + 'Your two factor authentication method is based on "{0}".' => '', ]; diff --git a/src/User/resources/i18n/th/usuario.php b/src/User/resources/i18n/th/usuario.php index f6676a4..34821ab 100644 --- a/src/User/resources/i18n/th/usuario.php +++ b/src/User/resources/i18n/th/usuario.php @@ -63,6 +63,7 @@ return [ 'Children' => '', 'Class' => '', 'Close' => '', + 'Code for two factor authentication' => '', 'Complete password reset on {0}' => '', 'Confirm' => '', 'Confirm account on {0}' => '', @@ -105,7 +106,7 @@ return [ 'Error occurred while deleting user' => '', 'Error sending registration message to "{email}". Please try again later.' => '', 'Error sending welcome message to "{email}". Please try again later.' => '', - 'Error while enabling SMS two factor authentication.' => '', + 'Error while enabling SMS two factor authentication. Please reload the page.' => '', 'Export my data' => '', 'Finish' => '', 'Force password change at next login' => '', @@ -293,8 +294,8 @@ return [ 'Your password has expired, you must change it now' => '', 'Your personal information has been removed' => '', 'Your profile has been updated' => '', - 'Your two factor authentication method is based on "{0}".' => '', 'Your role requires 2FA, you won\'t be able to use the application until you enable it' => '', + 'Your two factor authentication method is based on "{0}".' => '', 'privacy policy' => '', '{0, date, MMM dd, YYYY HH:mm}' => '', '{0, date, MMMM dd, YYYY HH:mm}' => '', diff --git a/src/User/resources/i18n/tr-TR/usuario.php b/src/User/resources/i18n/tr-TR/usuario.php index f6676a4..34821ab 100644 --- a/src/User/resources/i18n/tr-TR/usuario.php +++ b/src/User/resources/i18n/tr-TR/usuario.php @@ -63,6 +63,7 @@ return [ 'Children' => '', 'Class' => '', 'Close' => '', + 'Code for two factor authentication' => '', 'Complete password reset on {0}' => '', 'Confirm' => '', 'Confirm account on {0}' => '', @@ -105,7 +106,7 @@ return [ 'Error occurred while deleting user' => '', 'Error sending registration message to "{email}". Please try again later.' => '', 'Error sending welcome message to "{email}". Please try again later.' => '', - 'Error while enabling SMS two factor authentication.' => '', + 'Error while enabling SMS two factor authentication. Please reload the page.' => '', 'Export my data' => '', 'Finish' => '', 'Force password change at next login' => '', @@ -293,8 +294,8 @@ return [ 'Your password has expired, you must change it now' => '', 'Your personal information has been removed' => '', 'Your profile has been updated' => '', - 'Your two factor authentication method is based on "{0}".' => '', 'Your role requires 2FA, you won\'t be able to use the application until you enable it' => '', + 'Your two factor authentication method is based on "{0}".' => '', 'privacy policy' => '', '{0, date, MMM dd, YYYY HH:mm}' => '', '{0, date, MMMM dd, YYYY HH:mm}' => '', diff --git a/src/User/resources/i18n/uk/usuario.php b/src/User/resources/i18n/uk/usuario.php index 2de9240..34237da 100644 --- a/src/User/resources/i18n/uk/usuario.php +++ b/src/User/resources/i18n/uk/usuario.php @@ -273,8 +273,9 @@ return [ '{0, date, MMMM dd, YYYY HH:mm}' => '{0, date, MMMM dd, YYYY HH:mm}', '{0} cannot be blank.' => '{0} не може бути порожнім.', 'According to the European General Data Protection Regulation (GDPR) we need your consent to work with your personal data.' => '', + 'Code for two factor authentication' => '', 'Data privacy' => '', - 'Error while enabling SMS two factor authentication.' => '', + 'Error while enabling SMS two factor authentication. Please reload the page.' => '', 'Google Authenticator' => '', 'Insert' => '', 'Insert the code you received by SMS.' => '', @@ -297,8 +298,8 @@ return [ 'Two factor authentication code by email' => '', 'Unfortunately, you can not work with this site without giving us consent to process your data.' => '', 'Your consent is required to work with this site' => '', - 'Your two factor authentication method is based on "{0}".' => '', 'Your role requires 2FA, you won\'t be able to use the application until you enable it' => '', + 'Your two factor authentication method is based on "{0}".' => '', 'A message has been sent to your email address. ' => '@@На вашу електронну адресу надіслано повідомлення@@', 'An email has been sent with instructions for resetting your password' => '@@Лист з інструкціями по зміні пароля надіслано на електронну адресу@@', 'Awesome, almost there. ' => '@@Чудово, майже все.@@', diff --git a/src/User/resources/i18n/vi/usuario.php b/src/User/resources/i18n/vi/usuario.php index f6676a4..34821ab 100644 --- a/src/User/resources/i18n/vi/usuario.php +++ b/src/User/resources/i18n/vi/usuario.php @@ -63,6 +63,7 @@ return [ 'Children' => '', 'Class' => '', 'Close' => '', + 'Code for two factor authentication' => '', 'Complete password reset on {0}' => '', 'Confirm' => '', 'Confirm account on {0}' => '', @@ -105,7 +106,7 @@ return [ 'Error occurred while deleting user' => '', 'Error sending registration message to "{email}". Please try again later.' => '', 'Error sending welcome message to "{email}". Please try again later.' => '', - 'Error while enabling SMS two factor authentication.' => '', + 'Error while enabling SMS two factor authentication. Please reload the page.' => '', 'Export my data' => '', 'Finish' => '', 'Force password change at next login' => '', @@ -293,8 +294,8 @@ return [ 'Your password has expired, you must change it now' => '', 'Your personal information has been removed' => '', 'Your profile has been updated' => '', - 'Your two factor authentication method is based on "{0}".' => '', 'Your role requires 2FA, you won\'t be able to use the application until you enable it' => '', + 'Your two factor authentication method is based on "{0}".' => '', 'privacy policy' => '', '{0, date, MMM dd, YYYY HH:mm}' => '', '{0, date, MMMM dd, YYYY HH:mm}' => '', diff --git a/src/User/resources/i18n/zh-CN/usuario.php b/src/User/resources/i18n/zh-CN/usuario.php index f6676a4..34821ab 100644 --- a/src/User/resources/i18n/zh-CN/usuario.php +++ b/src/User/resources/i18n/zh-CN/usuario.php @@ -63,6 +63,7 @@ return [ 'Children' => '', 'Class' => '', 'Close' => '', + 'Code for two factor authentication' => '', 'Complete password reset on {0}' => '', 'Confirm' => '', 'Confirm account on {0}' => '', @@ -105,7 +106,7 @@ return [ 'Error occurred while deleting user' => '', 'Error sending registration message to "{email}". Please try again later.' => '', 'Error sending welcome message to "{email}". Please try again later.' => '', - 'Error while enabling SMS two factor authentication.' => '', + 'Error while enabling SMS two factor authentication. Please reload the page.' => '', 'Export my data' => '', 'Finish' => '', 'Force password change at next login' => '', @@ -293,8 +294,8 @@ return [ 'Your password has expired, you must change it now' => '', 'Your personal information has been removed' => '', 'Your profile has been updated' => '', - 'Your two factor authentication method is based on "{0}".' => '', 'Your role requires 2FA, you won\'t be able to use the application until you enable it' => '', + 'Your two factor authentication method is based on "{0}".' => '', 'privacy policy' => '', '{0, date, MMM dd, YYYY HH:mm}' => '', '{0, date, MMMM dd, YYYY HH:mm}' => '', From 902970c7188a18f0221e355b1c2c66511fd299af Mon Sep 17 00:00:00 2001 From: Antonio Cordeddu Date: Thu, 11 Aug 2022 12:15:53 +0200 Subject: [PATCH 09/10] #458 fix on email subject message and on send sms --- docs/installation/configuration-options.md | 2 +- docs/installation/mailer.md | 2 +- src/User/Bootstrap.php | 2 +- src/User/Controller/SettingsController.php | 4 ++-- src/User/Service/TwoFactorSmsCodeGeneratorService.php | 1 - src/User/resources/i18n/ca/usuario.php | 3 ++- src/User/resources/i18n/da/usuario.php | 3 ++- src/User/resources/i18n/de-DU/usuario.php | 3 ++- src/User/resources/i18n/de/usuario.php | 3 ++- src/User/resources/i18n/es/usuario.php | 3 ++- src/User/resources/i18n/et/usuario.php | 3 ++- src/User/resources/i18n/fa-IR/usuario.php | 3 ++- src/User/resources/i18n/fi/usuario.php | 3 ++- src/User/resources/i18n/fr/usuario.php | 3 ++- src/User/resources/i18n/hr/usuario.php | 3 ++- src/User/resources/i18n/hu/usuario.php | 3 ++- src/User/resources/i18n/it/usuario.php | 2 +- src/User/resources/i18n/kk/usuario.php | 3 ++- src/User/resources/i18n/lt/usuario.php | 3 ++- src/User/resources/i18n/nl/usuario.php | 3 ++- src/User/resources/i18n/pl/usuario.php | 3 ++- src/User/resources/i18n/pt-BR/usuario.php | 3 ++- src/User/resources/i18n/pt-PT/usuario.php | 3 ++- src/User/resources/i18n/ro/usuario.php | 3 ++- src/User/resources/i18n/ru/usuario.php | 3 ++- src/User/resources/i18n/th/usuario.php | 3 ++- src/User/resources/i18n/tr-TR/usuario.php | 3 ++- src/User/resources/i18n/uk/usuario.php | 3 ++- src/User/resources/i18n/vi/usuario.php | 3 ++- src/User/resources/i18n/zh-CN/usuario.php | 3 ++- 30 files changed, 54 insertions(+), 31 deletions(-) diff --git a/docs/installation/configuration-options.md b/docs/installation/configuration-options.md index 4832174..c3b5a61 100644 --- a/docs/installation/configuration-options.md +++ b/docs/installation/configuration-options.md @@ -216,7 +216,7 @@ Configures the parameter values used on [MailFactory](../../src/User/Factory/Mai 'confirmationMailSubject' => Yii::t('usuario', 'Confirm account on {0}', $app->name), 'reconfirmationMailSubject' => Yii::t('usuario', 'Confirm email change on {0}', $app->name), 'recoveryMailSubject' => Yii::t('usuario', 'Complete password reset on {0}', $app->name), - 'twoFactorMailSubject' => Yii::t('usuario', 'Code for two factor authentication', $app->name), + 'twoFactorMailSubject' => Yii::t('usuario', 'Code for two factor authentication on {0}', $app->name), ] ``` diff --git a/docs/installation/mailer.md b/docs/installation/mailer.md index 0fc470e..0b355ef 100644 --- a/docs/installation/mailer.md +++ b/docs/installation/mailer.md @@ -14,7 +14,7 @@ values: 'confirmationMailSubject' => Yii::t('usuario', 'Confirm account on {0}', $app->name), 'reconfirmationMailSubject' => Yii::t('usuario', 'Confirm email change on {0}', $app->name), 'recoveryMailSubject' => Yii::t('usuario', 'Complete password reset on {0}', $app->name), - 'twoFactorMailSubject' => Yii::t('usuario', 'Code for two factor authentication', $app->name), + 'twoFactorMailSubject' => Yii::t('usuario', 'Code for two factor authentication on {0}', $app->name), ] ``` diff --git a/src/User/Bootstrap.php b/src/User/Bootstrap.php index e729092..478d09e 100644 --- a/src/User/Bootstrap.php +++ b/src/User/Bootstrap.php @@ -292,7 +292,7 @@ class Bootstrap implements BootstrapInterface 'confirmationMailSubject' => Yii::t('usuario', 'Confirm account on {0}', $app->name), 'reconfirmationMailSubject' => Yii::t('usuario', 'Confirm email change on {0}', $app->name), 'recoveryMailSubject' => Yii::t('usuario', 'Complete password reset on {0}', $app->name), - 'twoFactorMailSubject' => Yii::t('usuario', 'Code for two factor authentication', $app->name), + 'twoFactorMailSubject' => Yii::t('usuario', 'Code for two factor authentication on {0}', $app->name), ]; $module->mailParams = array_merge($defaults, $module->mailParams); diff --git a/src/User/Controller/SettingsController.php b/src/User/Controller/SettingsController.php index eab2fad..216d398 100644 --- a/src/User/Controller/SettingsController.php +++ b/src/User/Controller/SettingsController.php @@ -583,9 +583,9 @@ class SettingsController extends Controller $success=true; }else{ $success = $user->updateAttributes(['auth_tf_mobile_phone' => $mobilePhone]); + $success = $success && $this->make(TwoFactorSmsCodeGeneratorService::class, [$user])->run(); } - $success = $success && $this->make(TwoFactorSmsCodeGeneratorService::class, [$user])->run(); - + return [ 'success' => $success, 'message' => $success diff --git a/src/User/Service/TwoFactorSmsCodeGeneratorService.php b/src/User/Service/TwoFactorSmsCodeGeneratorService.php index 862e0c0..cda2fbb 100644 --- a/src/User/Service/TwoFactorSmsCodeGeneratorService.php +++ b/src/User/Service/TwoFactorSmsCodeGeneratorService.php @@ -66,7 +66,6 @@ class TwoFactorSmsCodeGeneratorService implements ServiceInterface $mobilePhone=$user->getAuthTfMobilePhone(); if( null===$mobilePhone || $mobilePhone=='' ){ - Yii::$app->session->addFlash('error', Yii::t('usuario','Mobile phone not found, please check your profile')); return false; } // send sms diff --git a/src/User/resources/i18n/ca/usuario.php b/src/User/resources/i18n/ca/usuario.php index 34821ab..a76ca29 100644 --- a/src/User/resources/i18n/ca/usuario.php +++ b/src/User/resources/i18n/ca/usuario.php @@ -63,7 +63,7 @@ return [ 'Children' => '', 'Class' => '', 'Close' => '', - 'Code for two factor authentication' => '', + 'Code for two factor authentication on {0}' => '', 'Complete password reset on {0}' => '', 'Confirm' => '', 'Confirm account on {0}' => '', @@ -300,4 +300,5 @@ return [ '{0, date, MMM dd, YYYY HH:mm}' => '', '{0, date, MMMM dd, YYYY HH:mm}' => '', '{0} cannot be blank.' => '', + 'Code for two factor authentication' => '@@@@', ]; diff --git a/src/User/resources/i18n/da/usuario.php b/src/User/resources/i18n/da/usuario.php index 34821ab..a76ca29 100644 --- a/src/User/resources/i18n/da/usuario.php +++ b/src/User/resources/i18n/da/usuario.php @@ -63,7 +63,7 @@ return [ 'Children' => '', 'Class' => '', 'Close' => '', - 'Code for two factor authentication' => '', + 'Code for two factor authentication on {0}' => '', 'Complete password reset on {0}' => '', 'Confirm' => '', 'Confirm account on {0}' => '', @@ -300,4 +300,5 @@ return [ '{0, date, MMM dd, YYYY HH:mm}' => '', '{0, date, MMMM dd, YYYY HH:mm}' => '', '{0} cannot be blank.' => '', + 'Code for two factor authentication' => '@@@@', ]; diff --git a/src/User/resources/i18n/de-DU/usuario.php b/src/User/resources/i18n/de-DU/usuario.php index e0b09da..19cbf9d 100644 --- a/src/User/resources/i18n/de-DU/usuario.php +++ b/src/User/resources/i18n/de-DU/usuario.php @@ -274,7 +274,7 @@ return [ '{0, date, MMMM dd, YYYY HH:mm}' => '{0, date, dd. MMMM YYYY, HH:mm}', '{0} cannot be blank.' => '{0} darf nicht leer sein.', 'According to the European General Data Protection Regulation (GDPR) we need your consent to work with your personal data.' => '', - 'Code for two factor authentication' => '', + 'Code for two factor authentication on {0}' => '', 'Data privacy' => '', 'Error while enabling SMS two factor authentication. Please reload the page.' => '', 'Google Authenticator' => '', @@ -300,4 +300,5 @@ return [ 'Your consent is required to work with this site' => '', 'Your role requires 2FA, you won\'t be able to use the application until you enable it' => '', 'Your two factor authentication method is based on "{0}".' => '', + 'Code for two factor authentication' => '@@@@', ]; diff --git a/src/User/resources/i18n/de/usuario.php b/src/User/resources/i18n/de/usuario.php index 6c37ed3..efd62fe 100644 --- a/src/User/resources/i18n/de/usuario.php +++ b/src/User/resources/i18n/de/usuario.php @@ -277,7 +277,7 @@ return [ '{0, date, MMM dd, YYYY HH:mm}' => '{0, date, dd. MMM YYYY, HH:mm}', '{0, date, MMMM dd, YYYY HH:mm}' => '{0, date, dd. MMMM YYYY, HH:mm}', '{0} cannot be blank.' => '{0} darf nicht leer sein.', - 'Code for two factor authentication' => '', + 'Code for two factor authentication on {0}' => '', 'Error while enabling SMS two factor authentication. Please reload the page.' => '', 'Google Authenticator' => '', 'Information' => '', @@ -300,4 +300,5 @@ return [ 'Two factor authentication code by email' => '', 'Your role requires 2FA, you won\'t be able to use the application until you enable it' => '', 'Your two factor authentication method is based on "{0}".' => '', + 'Code for two factor authentication' => '@@@@', ]; diff --git a/src/User/resources/i18n/es/usuario.php b/src/User/resources/i18n/es/usuario.php index 9e348cf..924fb98 100644 --- a/src/User/resources/i18n/es/usuario.php +++ b/src/User/resources/i18n/es/usuario.php @@ -276,7 +276,7 @@ return [ 'privacy policy' => 'política de privacidad', '{0, date, MMMM dd, YYYY HH:mm}' => '{0, date, dd MMMM, YYYY HH:mm}', '{0} cannot be blank.' => '{0} no puede estar vacío.', - 'Code for two factor authentication' => '', + 'Code for two factor authentication on {0}' => '', 'Error while enabling SMS two factor authentication. Please reload the page.' => '', 'Google Authenticator' => '', 'Insert' => '', @@ -300,4 +300,5 @@ return [ 'Your role requires 2FA, you won\'t be able to use the application until you enable it' => '', 'Your two factor authentication method is based on "{0}".' => '', '{0, date, MMM dd, YYYY HH:mm}' => '', + 'Code for two factor authentication' => '@@@@', ]; diff --git a/src/User/resources/i18n/et/usuario.php b/src/User/resources/i18n/et/usuario.php index e4f63ce..4604d33 100644 --- a/src/User/resources/i18n/et/usuario.php +++ b/src/User/resources/i18n/et/usuario.php @@ -269,7 +269,7 @@ return [ '{0} cannot be blank.' => '{0} ei või olla tühi.', 'According to the European General Data Protection Regulation (GDPR) we need your consent to work with your personal data.' => '', 'Authentication rule class {0} can not be instantiated' => '', - 'Code for two factor authentication' => '', + 'Code for two factor authentication on {0}' => '', 'Data privacy' => '', 'Error while enabling SMS two factor authentication. Please reload the page.' => '', 'Google Authenticator' => '', @@ -300,4 +300,5 @@ return [ 'Your two factor authentication method is based on "{0}".' => '', '{0, date, MMM dd, YYYY HH:mm}' => '', '{0, date, MMMM dd, YYYY HH:mm}' => '', + 'Code for two factor authentication' => '@@@@', ]; diff --git a/src/User/resources/i18n/fa-IR/usuario.php b/src/User/resources/i18n/fa-IR/usuario.php index e37eb98..f67da68 100644 --- a/src/User/resources/i18n/fa-IR/usuario.php +++ b/src/User/resources/i18n/fa-IR/usuario.php @@ -173,7 +173,7 @@ return [ 'Children' => '', 'Class' => '', 'Close' => '', - 'Code for two factor authentication' => '', + 'Code for two factor authentication on {0}' => '', 'Create new permission' => '', 'Create new role' => '', 'Create new rule' => '', @@ -300,4 +300,5 @@ return [ 'privacy policy' => '', '{0, date, MMM dd, YYYY HH:mm}' => '', '{0} cannot be blank.' => '', + 'Code for two factor authentication' => '@@@@', ]; diff --git a/src/User/resources/i18n/fi/usuario.php b/src/User/resources/i18n/fi/usuario.php index 34821ab..a76ca29 100644 --- a/src/User/resources/i18n/fi/usuario.php +++ b/src/User/resources/i18n/fi/usuario.php @@ -63,7 +63,7 @@ return [ 'Children' => '', 'Class' => '', 'Close' => '', - 'Code for two factor authentication' => '', + 'Code for two factor authentication on {0}' => '', 'Complete password reset on {0}' => '', 'Confirm' => '', 'Confirm account on {0}' => '', @@ -300,4 +300,5 @@ return [ '{0, date, MMM dd, YYYY HH:mm}' => '', '{0, date, MMMM dd, YYYY HH:mm}' => '', '{0} cannot be blank.' => '', + 'Code for two factor authentication' => '@@@@', ]; diff --git a/src/User/resources/i18n/fr/usuario.php b/src/User/resources/i18n/fr/usuario.php index b6c1b02..0a1d042 100644 --- a/src/User/resources/i18n/fr/usuario.php +++ b/src/User/resources/i18n/fr/usuario.php @@ -273,7 +273,7 @@ return [ '{0, date, MMMM dd, YYYY HH:mm}' => '{0, date, dd MMMM YYYY HH:mm}', '{0} cannot be blank.' => '{0} ne peut être vide.', 'According to the European General Data Protection Regulation (GDPR) we need your consent to work with your personal data.' => '', - 'Code for two factor authentication' => '', + 'Code for two factor authentication on {0}' => '', 'Data privacy' => '', 'Error while enabling SMS two factor authentication. Please reload the page.' => '', 'Google Authenticator' => '', @@ -300,4 +300,5 @@ return [ 'Your role requires 2FA, you won\'t be able to use the application until you enable it' => '', 'Your two factor authentication method is based on "{0}".' => '', '{0, date, MMM dd, YYYY HH:mm}' => '', + 'Code for two factor authentication' => '@@@@', ]; diff --git a/src/User/resources/i18n/hr/usuario.php b/src/User/resources/i18n/hr/usuario.php index 34821ab..a76ca29 100644 --- a/src/User/resources/i18n/hr/usuario.php +++ b/src/User/resources/i18n/hr/usuario.php @@ -63,7 +63,7 @@ return [ 'Children' => '', 'Class' => '', 'Close' => '', - 'Code for two factor authentication' => '', + 'Code for two factor authentication on {0}' => '', 'Complete password reset on {0}' => '', 'Confirm' => '', 'Confirm account on {0}' => '', @@ -300,4 +300,5 @@ return [ '{0, date, MMM dd, YYYY HH:mm}' => '', '{0, date, MMMM dd, YYYY HH:mm}' => '', '{0} cannot be blank.' => '', + 'Code for two factor authentication' => '@@@@', ]; diff --git a/src/User/resources/i18n/hu/usuario.php b/src/User/resources/i18n/hu/usuario.php index 7ef52a3..6ce037c 100644 --- a/src/User/resources/i18n/hu/usuario.php +++ b/src/User/resources/i18n/hu/usuario.php @@ -271,7 +271,7 @@ return [ '{0} cannot be blank.' => '{0} nem lehet üres.', 'According to the European General Data Protection Regulation (GDPR) we need your consent to work with your personal data.' => '', 'An email with instructions to create a new password has been sent to {email} if it is associated with an {appName} account. Your existing password has not been changed.' => '', - 'Code for two factor authentication' => '', + 'Code for two factor authentication on {0}' => '', 'Data privacy' => '', 'Error while enabling SMS two factor authentication. Please reload the page.' => '', 'Google Authenticator' => '', @@ -300,4 +300,5 @@ return [ 'Your consent is required to work with this site' => '', 'Your role requires 2FA, you won\'t be able to use the application until you enable it' => '', 'Your two factor authentication method is based on "{0}".' => '', + 'Code for two factor authentication' => '@@@@', ]; diff --git a/src/User/resources/i18n/it/usuario.php b/src/User/resources/i18n/it/usuario.php index 0eba230..c026247 100644 --- a/src/User/resources/i18n/it/usuario.php +++ b/src/User/resources/i18n/it/usuario.php @@ -63,7 +63,7 @@ return [ 'Children' => 'Figli', 'Class' => 'Classe', 'Close' => 'Chiudi', - 'Code for two factor authentication' => 'Codice per l\'autenticazione a due fattori', + 'Code for two factor authentication on {0}' => 'Codice per l\'autenticazione a due fattori su {0}', 'Complete password reset on {0}' => 'Completa la procedura di reset della password su {0}', 'Confirm' => 'Conferma', 'Confirm account on {0}' => 'Conferma l\'account su {0}', diff --git a/src/User/resources/i18n/kk/usuario.php b/src/User/resources/i18n/kk/usuario.php index 34821ab..a76ca29 100644 --- a/src/User/resources/i18n/kk/usuario.php +++ b/src/User/resources/i18n/kk/usuario.php @@ -63,7 +63,7 @@ return [ 'Children' => '', 'Class' => '', 'Close' => '', - 'Code for two factor authentication' => '', + 'Code for two factor authentication on {0}' => '', 'Complete password reset on {0}' => '', 'Confirm' => '', 'Confirm account on {0}' => '', @@ -300,4 +300,5 @@ return [ '{0, date, MMM dd, YYYY HH:mm}' => '', '{0, date, MMMM dd, YYYY HH:mm}' => '', '{0} cannot be blank.' => '', + 'Code for two factor authentication' => '@@@@', ]; diff --git a/src/User/resources/i18n/lt/usuario.php b/src/User/resources/i18n/lt/usuario.php index 34821ab..a76ca29 100644 --- a/src/User/resources/i18n/lt/usuario.php +++ b/src/User/resources/i18n/lt/usuario.php @@ -63,7 +63,7 @@ return [ 'Children' => '', 'Class' => '', 'Close' => '', - 'Code for two factor authentication' => '', + 'Code for two factor authentication on {0}' => '', 'Complete password reset on {0}' => '', 'Confirm' => '', 'Confirm account on {0}' => '', @@ -300,4 +300,5 @@ return [ '{0, date, MMM dd, YYYY HH:mm}' => '', '{0, date, MMMM dd, YYYY HH:mm}' => '', '{0} cannot be blank.' => '', + 'Code for two factor authentication' => '@@@@', ]; diff --git a/src/User/resources/i18n/nl/usuario.php b/src/User/resources/i18n/nl/usuario.php index 4cdc751..f46c61b 100644 --- a/src/User/resources/i18n/nl/usuario.php +++ b/src/User/resources/i18n/nl/usuario.php @@ -271,7 +271,7 @@ return [ '{0} cannot be blank.' => '{0} kan niet leeg zijn.', 'According to the European General Data Protection Regulation (GDPR) we need your consent to work with your personal data.' => '', 'An email with instructions to create a new password has been sent to {email} if it is associated with an {appName} account. Your existing password has not been changed.' => '', - 'Code for two factor authentication' => '', + 'Code for two factor authentication on {0}' => '', 'Data privacy' => '', 'Error while enabling SMS two factor authentication. Please reload the page.' => '', 'Google Authenticator' => '', @@ -300,4 +300,5 @@ return [ 'Your consent is required to work with this site' => '', 'Your role requires 2FA, you won\'t be able to use the application until you enable it' => '', 'Your two factor authentication method is based on "{0}".' => '', + 'Code for two factor authentication' => '@@@@', ]; diff --git a/src/User/resources/i18n/pl/usuario.php b/src/User/resources/i18n/pl/usuario.php index 52e3001..1b0c79d 100644 --- a/src/User/resources/i18n/pl/usuario.php +++ b/src/User/resources/i18n/pl/usuario.php @@ -271,7 +271,7 @@ return [ '{0} cannot be blank.' => '{0} nie może pozostać bez wartości', 'According to the European General Data Protection Regulation (GDPR) we need your consent to work with your personal data.' => '', 'An email with instructions to create a new password has been sent to {email} if it is associated with an {appName} account. Your existing password has not been changed.' => '', - 'Code for two factor authentication' => '', + 'Code for two factor authentication on {0}' => '', 'Data privacy' => '', 'Error while enabling SMS two factor authentication. Please reload the page.' => '', 'Google Authenticator' => '', @@ -300,4 +300,5 @@ return [ 'Your consent is required to work with this site' => '', 'Your role requires 2FA, you won\'t be able to use the application until you enable it' => '', 'Your two factor authentication method is based on "{0}".' => '', + 'Code for two factor authentication' => '@@@@', ]; diff --git a/src/User/resources/i18n/pt-BR/usuario.php b/src/User/resources/i18n/pt-BR/usuario.php index d5e6f4a..ccbe070 100644 --- a/src/User/resources/i18n/pt-BR/usuario.php +++ b/src/User/resources/i18n/pt-BR/usuario.php @@ -271,7 +271,7 @@ return [ '{0} cannot be blank.' => '{0} não pode estar em branco', 'According to the European General Data Protection Regulation (GDPR) we need your consent to work with your personal data.' => '', 'An email with instructions to create a new password has been sent to {email} if it is associated with an {appName} account. Your existing password has not been changed.' => '', - 'Code for two factor authentication' => '', + 'Code for two factor authentication on {0}' => '', 'Data privacy' => '', 'Error while enabling SMS two factor authentication. Please reload the page.' => '', 'Google Authenticator' => '', @@ -300,4 +300,5 @@ return [ 'Your consent is required to work with this site' => '', 'Your role requires 2FA, you won\'t be able to use the application until you enable it' => '', 'Your two factor authentication method is based on "{0}".' => '', + 'Code for two factor authentication' => '@@@@', ]; diff --git a/src/User/resources/i18n/pt-PT/usuario.php b/src/User/resources/i18n/pt-PT/usuario.php index 019bff5..f80e06d 100644 --- a/src/User/resources/i18n/pt-PT/usuario.php +++ b/src/User/resources/i18n/pt-PT/usuario.php @@ -262,7 +262,7 @@ return [ 'Awesome, almost there. Now you need to click the confirmation link sent to your old email address.' => '', 'Children' => '', 'Class' => '', - 'Code for two factor authentication' => '', + 'Code for two factor authentication on {0}' => '', 'Data privacy' => '', 'Email' => '', 'Error while enabling SMS two factor authentication. Please reload the page.' => '', @@ -300,4 +300,5 @@ return [ 'Your two factor authentication method is based on "{0}".' => '', '{0, date, MMM dd, YYYY HH:mm}' => '', '{0, date, MMMM dd, YYYY HH:mm}' => '', + 'Code for two factor authentication' => '@@@@', ]; diff --git a/src/User/resources/i18n/ro/usuario.php b/src/User/resources/i18n/ro/usuario.php index 9638b12..0e48773 100644 --- a/src/User/resources/i18n/ro/usuario.php +++ b/src/User/resources/i18n/ro/usuario.php @@ -271,7 +271,7 @@ return [ '{0} cannot be blank.' => '{0} nu poate fi gol.', 'According to the European General Data Protection Regulation (GDPR) we need your consent to work with your personal data.' => '', 'An email with instructions to create a new password has been sent to {email} if it is associated with an {appName} account. Your existing password has not been changed.' => '', - 'Code for two factor authentication' => '', + 'Code for two factor authentication on {0}' => '', 'Data privacy' => '', 'Error while enabling SMS two factor authentication. Please reload the page.' => '', 'Google Authenticator' => '', @@ -300,4 +300,5 @@ return [ 'Your consent is required to work with this site' => '', 'Your role requires 2FA, you won\'t be able to use the application until you enable it' => '', 'Your two factor authentication method is based on "{0}".' => '', + 'Code for two factor authentication' => '@@@@', ]; diff --git a/src/User/resources/i18n/ru/usuario.php b/src/User/resources/i18n/ru/usuario.php index b1c8bde..df904f6 100644 --- a/src/User/resources/i18n/ru/usuario.php +++ b/src/User/resources/i18n/ru/usuario.php @@ -274,7 +274,7 @@ return [ '{0, date, MMMM dd, YYYY HH:mm}' => '{0, date, d MMMM YYYY в HH:mm}', '{0} cannot be blank.' => '{0} не может быть пустым.', 'According to the European General Data Protection Regulation (GDPR) we need your consent to work with your personal data.' => '', - 'Code for two factor authentication' => '', + 'Code for two factor authentication on {0}' => '', 'Data privacy' => '', 'Error while enabling SMS two factor authentication. Please reload the page.' => '', 'Google Authenticator' => '', @@ -300,4 +300,5 @@ return [ 'Your consent is required to work with this site' => '', 'Your role requires 2FA, you won\'t be able to use the application until you enable it' => '', 'Your two factor authentication method is based on "{0}".' => '', + 'Code for two factor authentication' => '@@@@', ]; diff --git a/src/User/resources/i18n/th/usuario.php b/src/User/resources/i18n/th/usuario.php index 34821ab..a76ca29 100644 --- a/src/User/resources/i18n/th/usuario.php +++ b/src/User/resources/i18n/th/usuario.php @@ -63,7 +63,7 @@ return [ 'Children' => '', 'Class' => '', 'Close' => '', - 'Code for two factor authentication' => '', + 'Code for two factor authentication on {0}' => '', 'Complete password reset on {0}' => '', 'Confirm' => '', 'Confirm account on {0}' => '', @@ -300,4 +300,5 @@ return [ '{0, date, MMM dd, YYYY HH:mm}' => '', '{0, date, MMMM dd, YYYY HH:mm}' => '', '{0} cannot be blank.' => '', + 'Code for two factor authentication' => '@@@@', ]; diff --git a/src/User/resources/i18n/tr-TR/usuario.php b/src/User/resources/i18n/tr-TR/usuario.php index 34821ab..a76ca29 100644 --- a/src/User/resources/i18n/tr-TR/usuario.php +++ b/src/User/resources/i18n/tr-TR/usuario.php @@ -63,7 +63,7 @@ return [ 'Children' => '', 'Class' => '', 'Close' => '', - 'Code for two factor authentication' => '', + 'Code for two factor authentication on {0}' => '', 'Complete password reset on {0}' => '', 'Confirm' => '', 'Confirm account on {0}' => '', @@ -300,4 +300,5 @@ return [ '{0, date, MMM dd, YYYY HH:mm}' => '', '{0, date, MMMM dd, YYYY HH:mm}' => '', '{0} cannot be blank.' => '', + 'Code for two factor authentication' => '@@@@', ]; diff --git a/src/User/resources/i18n/uk/usuario.php b/src/User/resources/i18n/uk/usuario.php index 34237da..b1f63cf 100644 --- a/src/User/resources/i18n/uk/usuario.php +++ b/src/User/resources/i18n/uk/usuario.php @@ -273,7 +273,7 @@ return [ '{0, date, MMMM dd, YYYY HH:mm}' => '{0, date, MMMM dd, YYYY HH:mm}', '{0} cannot be blank.' => '{0} не може бути порожнім.', 'According to the European General Data Protection Regulation (GDPR) we need your consent to work with your personal data.' => '', - 'Code for two factor authentication' => '', + 'Code for two factor authentication on {0}' => '', 'Data privacy' => '', 'Error while enabling SMS two factor authentication. Please reload the page.' => '', 'Google Authenticator' => '', @@ -304,6 +304,7 @@ return [ 'An email has been sent with instructions for resetting your password' => '@@Лист з інструкціями по зміні пароля надіслано на електронну адресу@@', 'Awesome, almost there. ' => '@@Чудово, майже все.@@', 'Class "{0}" does not exist' => '@@Клас "{0}" не існує@@', + 'Code for two factor authentication' => '@@@@', 'Disable Two-Factor Auth' => '@@Вимкнути двофакторну аутентифікацію@@', 'Enable Two-factor auth' => '@@Увімкнути двофакторну аутентифікацію@@', 'Every user having your role has two factor authentication mandatory, you must enable it' => '@@@@', diff --git a/src/User/resources/i18n/vi/usuario.php b/src/User/resources/i18n/vi/usuario.php index 34821ab..a76ca29 100644 --- a/src/User/resources/i18n/vi/usuario.php +++ b/src/User/resources/i18n/vi/usuario.php @@ -63,7 +63,7 @@ return [ 'Children' => '', 'Class' => '', 'Close' => '', - 'Code for two factor authentication' => '', + 'Code for two factor authentication on {0}' => '', 'Complete password reset on {0}' => '', 'Confirm' => '', 'Confirm account on {0}' => '', @@ -300,4 +300,5 @@ return [ '{0, date, MMM dd, YYYY HH:mm}' => '', '{0, date, MMMM dd, YYYY HH:mm}' => '', '{0} cannot be blank.' => '', + 'Code for two factor authentication' => '@@@@', ]; diff --git a/src/User/resources/i18n/zh-CN/usuario.php b/src/User/resources/i18n/zh-CN/usuario.php index 34821ab..a76ca29 100644 --- a/src/User/resources/i18n/zh-CN/usuario.php +++ b/src/User/resources/i18n/zh-CN/usuario.php @@ -63,7 +63,7 @@ return [ 'Children' => '', 'Class' => '', 'Close' => '', - 'Code for two factor authentication' => '', + 'Code for two factor authentication on {0}' => '', 'Complete password reset on {0}' => '', 'Confirm' => '', 'Confirm account on {0}' => '', @@ -300,4 +300,5 @@ return [ '{0, date, MMM dd, YYYY HH:mm}' => '', '{0, date, MMMM dd, YYYY HH:mm}' => '', '{0} cannot be blank.' => '', + 'Code for two factor authentication' => '@@@@', ]; From 34981c8d4f92d69ed7282ddc230f2a0c22ed3647 Mon Sep 17 00:00:00 2001 From: Lorenzo Milesi Date: Fri, 12 Aug 2022 09:47:02 +0200 Subject: [PATCH 10/10] Files left out of merge --- src/User/Controller/SettingsController.php | 36 ++++++++++------------ src/User/Model/User.php | 4 +-- 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/src/User/Controller/SettingsController.php b/src/User/Controller/SettingsController.php index 812089e..048c457 100755 --- a/src/User/Controller/SettingsController.php +++ b/src/User/Controller/SettingsController.php @@ -397,7 +397,7 @@ class SettingsController extends Controller public function actionConfirm($id, $code) { $user = $this->userQuery->whereId($id)->one(); - + if ($user === null || MailChangeStrategyInterface::TYPE_INSECURE === $this->module->emailChangeStrategy) { throw new NotFoundHttpException(); } @@ -454,15 +454,14 @@ class SettingsController extends Controller public function actionTwoFactor($id) { $choice=Yii::$app->request->post('choice'); - /** @var User $user */ + /** @var User $user */ $user = $this->userQuery->whereId($id)->one(); if (null === $user) { throw new NotFoundHttpException(); } - - switch($choice) - { + + switch ($choice) { case 'google-authenticator': $uri = $this->make(TwoFactorQrCodeUriGeneratorService::class, [$user])->run(); return $this->renderAjax('two-factor', ['id' => $id, 'uri' => $uri]); @@ -473,9 +472,8 @@ class SettingsController extends Controller // get mobile phone, if exists $mobilePhone=$user->getAuthTfMobilePhone(); $smsCode = $this->make(TwoFactorSmsCodeGeneratorService::class, [$user])->run(); - return $this->renderAjax('two-factor-sms', ['id' => $id, 'code' => $smsCode, 'mobilePhone' => $mobilePhone] ); + return $this->renderAjax('two-factor-sms', ['id' => $id, 'code' => $smsCode, 'mobilePhone' => $mobilePhone]); } - } public function actionTwoFactorEnable($id) @@ -497,17 +495,17 @@ class SettingsController extends Controller } $code = Yii::$app->request->get('code'); $module = Yii::$app->getModule('user'); - $validators = $module->twoFactorAuthenticationValidators; + $validators = $module->twoFactorAuthenticationValidators; $choice = Yii::$app->request->get('choice'); - $codeDurationTime = ArrayHelper::getValue($validators,$choice.'.codeDurationTime', 300); - $class = ArrayHelper::getValue($validators,$choice.'.class'); + $codeDurationTime = ArrayHelper::getValue($validators, $choice.'.codeDurationTime', 300); + $class = ArrayHelper::getValue($validators, $choice.'.class'); $object = $this ->make($class, [$user, $code, $this->module->twoFactorAuthenticationCycles]); $success = $object->validate(); $success = $success && $user->updateAttributes(['auth_tf_enabled' => '1','auth_tf_type' => $choice]); - $message = $success? $object->getSuccessMessage():$object->getUnsuccessMessage($codeDurationTime); - + $message = $success ? $object->getSuccessMessage() : $object->getUnsuccessMessage($codeDurationTime); + return [ 'success' => $success, 'message' => $message @@ -601,9 +599,9 @@ class SettingsController extends Controller Yii::$app->response->format = Response::FORMAT_JSON; /** - * * - * @var User $user + * + * @var User $user */ $user = $this->userQuery->whereId($id)->one(); @@ -616,13 +614,13 @@ class SettingsController extends Controller $mobilePhone = Yii::$app->request->get('mobilephone'); $currentMobilePhone = $user->getAuthTfMobilePhone(); $success=false; - if($currentMobilePhone==$mobilePhone){ - $success=true; - }else{ + if ($currentMobilePhone==$mobilePhone) { + $success=true; + } else { $success = $user->updateAttributes(['auth_tf_mobile_phone' => $mobilePhone]); $success = $success && $this->make(TwoFactorSmsCodeGeneratorService::class, [$user])->run(); - } - + } + return [ 'success' => $success, 'message' => $success diff --git a/src/User/Model/User.php b/src/User/Model/User.php index 807dd72..dbd5484 100644 --- a/src/User/Model/User.php +++ b/src/User/Model/User.php @@ -67,8 +67,8 @@ class User extends ActiveRecord implements IdentityInterface use ContainerAwareTrait; // following constants are used on secured email changing process - const OLD_EMAIL_CONFIRMED = 0b01; - const NEW_EMAIL_CONFIRMED = 0b10; + public const OLD_EMAIL_CONFIRMED = 0b01; + public const NEW_EMAIL_CONFIRMED = 0b10; /** * @var string Plain password. Used for model validation