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 + */ +?> += Yii::t('usuario', 'Hello') ?>, + += Yii::t('usuario', 'This is the code to insert to enable two factor authentication') ?>. + += $code ?> + += Yii::t('usuario', 'If you did not make this request you can ignore this email') ?>. 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 + */ +?> +
+ = Yii::t('usuario', 'Hello') ?>, +
++ = $code ?> +
++ = Yii::t('usuario', 'If you did not make this request you can ignore this email') ?>. +
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']] ) ?> -