Close #55 add google captcha mechanism
This commit is contained in:
@ -39,7 +39,6 @@ class CreateController extends Controller
|
||||
if (null !== $role) {
|
||||
$this->assignRole($user, $role);
|
||||
}
|
||||
|
||||
} else {
|
||||
$this->stdout(Yii::t('usuario', 'Please fix following errors:') . "\n", Console::FG_RED);
|
||||
foreach ($user->errors as $errors) {
|
||||
|
||||
75
src/User/Component/ReCaptchaComponent.php
Normal file
75
src/User/Component/ReCaptchaComponent.php
Normal file
@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the 2amigos/yii2-usuario project.
|
||||
*
|
||||
* (c) 2amigOS! <http://2amigos.us/>
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Da\User\Component;
|
||||
|
||||
use Yii;
|
||||
use yii\base\Component;
|
||||
use yii\base\InvalidConfigException;
|
||||
use yii\httpclient\Client;
|
||||
|
||||
class ReCaptchaComponent extends Component
|
||||
{
|
||||
/**
|
||||
* @var string the ReCAPTCHA sitekey
|
||||
*/
|
||||
public $key;
|
||||
/**
|
||||
* @var string the shared key between the site and ReCAPTCHA
|
||||
*/
|
||||
public $secret;
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
if (empty($this->key)) {
|
||||
throw new InvalidConfigException(Yii::t('usuario', 'Required "key" cannot be empty.'));
|
||||
}
|
||||
|
||||
if (empty($this->secret)) {
|
||||
throw new InvalidConfigException(Yii::t('usuario', 'Required "secret" cannot be empty.'));
|
||||
}
|
||||
|
||||
parent::init();
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies whether a user response is valid or not.
|
||||
*
|
||||
* @param $value
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function verify($value)
|
||||
{
|
||||
$response = (new Client(
|
||||
[
|
||||
'baseUrl' => 'https://www.google.com/recaptcha/api',
|
||||
'responseConfig' => [
|
||||
'format' => Client::FORMAT_JSON
|
||||
]
|
||||
]
|
||||
))
|
||||
->get(
|
||||
'site/verify',
|
||||
[
|
||||
'secret' => $this->secret,
|
||||
'response' => $value,
|
||||
'remoteip' => Yii::$app->request->getUserIP()
|
||||
]
|
||||
)
|
||||
->send();
|
||||
|
||||
return $response['success'] ? : false;
|
||||
}
|
||||
}
|
||||
@ -156,10 +156,9 @@ class RecoveryController extends Controller
|
||||
|
||||
if ($form->load(Yii::$app->getRequest()->post())) {
|
||||
if ($this->make(ResetPasswordService::class, [$form->password, $token->user])->run()) {
|
||||
|
||||
$this->trigger(ResetPasswordEvent::EVENT_AFTER_RESET, $event);
|
||||
|
||||
Yii::$app->session->setFlash('success',Yii::t('usuario', 'Password has been changed'));
|
||||
Yii::$app->session->setFlash('success', Yii::t('usuario', 'Password has been changed'));
|
||||
|
||||
return $this->render(
|
||||
'/shared/message',
|
||||
|
||||
@ -37,10 +37,10 @@ class SecurityController extends Controller
|
||||
/**
|
||||
* SecurityController constructor.
|
||||
*
|
||||
* @param string $id
|
||||
* @param Module $module
|
||||
* @param string $id
|
||||
* @param Module $module
|
||||
* @param SocialNetworkAccountQuery $socialNetworkAccountQuery
|
||||
* @param array $config
|
||||
* @param array $config
|
||||
*/
|
||||
public function __construct(
|
||||
$id,
|
||||
@ -117,14 +117,12 @@ class SecurityController extends Controller
|
||||
$event = $this->make(FormEvent::class, [$form]);
|
||||
|
||||
if (Yii::$app->request->isAjax && $form->load(Yii::$app->request->post())) {
|
||||
|
||||
Yii::$app->response->format = Response::FORMAT_JSON;
|
||||
|
||||
return ActiveForm::validate($form);
|
||||
}
|
||||
|
||||
if ($form->load(Yii::$app->request->post())) {
|
||||
|
||||
if ($this->module->enableTwoFactorAuthentication && $form->validate()) {
|
||||
if ($form->getUser()->auth_tf_enabled) {
|
||||
Yii::$app->session->set('credentials', ['login' => $form->login, 'pwd' => $form->password]);
|
||||
@ -173,18 +171,15 @@ class SecurityController extends Controller
|
||||
$event = $this->make(FormEvent::class, [$form]);
|
||||
|
||||
if (Yii::$app->request->isAjax && $form->load(Yii::$app->request->post())) {
|
||||
|
||||
Yii::$app->response->format = Response::FORMAT_JSON;
|
||||
|
||||
return ActiveForm::validate($form);
|
||||
}
|
||||
|
||||
if ($form->load(Yii::$app->request->post())) {
|
||||
|
||||
$this->trigger(FormEvent::EVENT_BEFORE_LOGIN, $event);
|
||||
|
||||
if ($form->login()) {
|
||||
|
||||
Yii::$app->session->set('credentials', null);
|
||||
|
||||
$form->getUser()->updateAttributes(['last_login_at' => time()]);
|
||||
@ -202,7 +197,6 @@ class SecurityController extends Controller
|
||||
'module' => $this->module,
|
||||
]
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function actionLogout()
|
||||
|
||||
@ -52,12 +52,12 @@ class SettingsController extends Controller
|
||||
/**
|
||||
* SettingsController constructor.
|
||||
*
|
||||
* @param string $id
|
||||
* @param Module $module
|
||||
* @param ProfileQuery $profileQuery
|
||||
* @param UserQuery $userQuery
|
||||
* @param string $id
|
||||
* @param Module $module
|
||||
* @param ProfileQuery $profileQuery
|
||||
* @param UserQuery $userQuery
|
||||
* @param SocialNetworkAccountQuery $socialNetworkAccountQuery
|
||||
* @param array $config
|
||||
* @param array $config
|
||||
*/
|
||||
public function __construct(
|
||||
$id,
|
||||
@ -294,8 +294,7 @@ class SettingsController extends Controller
|
||||
throw new NotFoundHttpException();
|
||||
}
|
||||
|
||||
if($user->updateAttributes(['auth_tf_enabled' => '0']))
|
||||
{
|
||||
if ($user->updateAttributes(['auth_tf_enabled' => '0'])) {
|
||||
Yii::$app
|
||||
->getSession()
|
||||
->setFlash('success', Yii::t('usuario', 'Two-factor authorization has been disabled.'));
|
||||
|
||||
@ -53,9 +53,9 @@ class LoginForm extends Model
|
||||
protected $securityHelper;
|
||||
|
||||
/**
|
||||
* @param UserQuery $query
|
||||
* @param UserQuery $query
|
||||
* @param SecurityHelper $securityHelper
|
||||
* @param array $config
|
||||
* @param array $config
|
||||
*/
|
||||
public function __construct(UserQuery $query, SecurityHelper $securityHelper, $config = [])
|
||||
{
|
||||
|
||||
@ -1,5 +1,14 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the 2amigos/yii2-usuario project.
|
||||
*
|
||||
* (c) 2amigOS! <http://2amigos.us/>
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Da\User\Helper;
|
||||
|
||||
use RuntimeException;
|
||||
|
||||
@ -1,5 +1,14 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the 2amigos/yii2-usuario project.
|
||||
*
|
||||
* (c) 2amigOS! <http://2amigos.us/>
|
||||
*
|
||||
* 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;
|
||||
@ -42,5 +51,4 @@ class TwoFactorQrCodeUriGeneratorService implements ServiceInterface
|
||||
|
||||
return $dataUri;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
68
src/User/Validator/ReCaptchaValidator.php
Normal file
68
src/User/Validator/ReCaptchaValidator.php
Normal file
@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the 2amigos/yii2-usuario project.
|
||||
*
|
||||
* (c) 2amigOS! <http://2amigos.us/>
|
||||
*
|
||||
* 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\User\Component\ReCaptchaComponent;
|
||||
use Yii;
|
||||
use yii\validators\Validator;
|
||||
|
||||
class ReCaptchaValidator extends Validator
|
||||
{
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public $skipOnEmpty = false;
|
||||
/**
|
||||
* @var string the message for client validation
|
||||
*/
|
||||
public $notCheckedMessage;
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
parent::init();
|
||||
|
||||
if (null === $this->message) {
|
||||
$this->message = Yii::t('usuario', 'The verification code is incorrect.');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function clientValidateAttribute($model, $attribute, $view)
|
||||
{
|
||||
$message = addslashes(
|
||||
$this->notCheckedMessage ?: Yii::t('usuario', '{0} cannot be blank.', $model->getAttributeLabel($attribute))
|
||||
);
|
||||
|
||||
return "(function(messages){if(!grecaptcha.getResponse()){messages.push('{$message}');}})(messages);";
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
protected function validateValue($value)
|
||||
{
|
||||
if (empty($value)) {
|
||||
if (!($value = Yii::$app->request->post('g-recaptcha-response'))) {
|
||||
return [$this->message, []];
|
||||
}
|
||||
}
|
||||
/** @var ReCaptchaComponent $recaptcha */
|
||||
$recaptcha = Yii::$app->get('recaptcha');
|
||||
|
||||
return $recaptcha->verify($value) ? null : [$this->message, []];
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,14 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the 2amigos/yii2-usuario project.
|
||||
*
|
||||
* (c) 2amigOS! <http://2amigos.us/>
|
||||
*
|
||||
* 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\Manager;
|
||||
|
||||
163
src/User/Widget/ReCaptchaWidget.php
Normal file
163
src/User/Widget/ReCaptchaWidget.php
Normal file
@ -0,0 +1,163 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the 2amigos/yii2-usuario project.
|
||||
*
|
||||
* (c) 2amigOS! <http://2amigos.us/>
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Da\User\Widget;
|
||||
|
||||
use Yii;
|
||||
use yii\base\InvalidConfigException;
|
||||
use yii\helpers\Html;
|
||||
use yii\web\View;
|
||||
use yii\widgets\InputWidget;
|
||||
|
||||
class ReCaptchaWidget extends InputWidget
|
||||
{
|
||||
/**
|
||||
* @var string the color theme of the widget. Values can be 'dark' or 'light'. Optional.
|
||||
*/
|
||||
public $theme;
|
||||
/**
|
||||
* @var string the type of captcha. Values can be 'audio' or 'image'. Optional.
|
||||
*/
|
||||
public $type;
|
||||
/**
|
||||
* @var string the size of the widget. Values can be 'compact' or 'normal'. Optional.
|
||||
*/
|
||||
public $size;
|
||||
/**
|
||||
* @var string the tabindex of the widget and challenge. Optional.
|
||||
*/
|
||||
public $tabIndex;
|
||||
/**
|
||||
* @var string the name of the callbaqck function to be executed when the user submits a
|
||||
* successful CAPTCHA response. The user's response, *g-recaptcha-response*, will be the input
|
||||
* for the callback function. Optional.
|
||||
*/
|
||||
public $callback;
|
||||
/**
|
||||
* @var string the name of the callback function to be executed when the recaptcha response
|
||||
* expires and the user needs to solve a new CAPTCHA.
|
||||
*/
|
||||
public $expiredCallback;
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
if (Yii::$app->get('recaptcha')) {
|
||||
throw new InvalidConfigException(Yii::t('usuario', 'The "recaptcha" component must be configured.'));
|
||||
}
|
||||
|
||||
parent::init();
|
||||
|
||||
$this->registerClientScript();
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$html = [];
|
||||
|
||||
$html[] = $this->hasModel()
|
||||
? Html::activeHiddenInput($this->model, $this->attribute, $this->options)
|
||||
: Html::hiddenInput($this->name, null, $this->options);
|
||||
|
||||
$html[] = Html::tag('div', '', $this->getCaptchaOptions());
|
||||
|
||||
return implode("\n", $html);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array the google recaptcha options.
|
||||
*/
|
||||
protected function getCaptchaOptions()
|
||||
{
|
||||
$data = [
|
||||
'sitekey' => Yii::$app->get('recaptcha')->key,
|
||||
'callback' => $this->callback,
|
||||
'expired-callback' => $this->expiredCallback,
|
||||
'theme' => $this->theme,
|
||||
'type' => $this->type,
|
||||
'size' => $this->size,
|
||||
'tabindex' => $this->tabIndex
|
||||
];
|
||||
|
||||
$options = [
|
||||
'class' => 'g-recaptcha',
|
||||
'data' => array_filter($data)
|
||||
];
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers the required libraries and scripts for the widget to work.
|
||||
*/
|
||||
protected function registerClientScript()
|
||||
{
|
||||
$view = $this->getView();
|
||||
|
||||
$view->registerJsFile(
|
||||
'//www.google.com/recaptcha/api.js?hl=' . $this->getLanguageCode(),
|
||||
[
|
||||
'position' => View::POS_HEAD,
|
||||
'async' => true,
|
||||
'defer' => true
|
||||
]
|
||||
);
|
||||
|
||||
$js = [];
|
||||
$id = $this->options['id'];
|
||||
|
||||
$js[] = empty($this->callback)
|
||||
? "var reCaptchaCallback = function(r){jQuery('#{$id}').val(r);};"
|
||||
: "var reCaptchaCallback = function(r){jQuery('#{$id}').val(r); {$this->callback}(r);};";
|
||||
|
||||
$this->callback = 'reCaptchaCallback';
|
||||
|
||||
$js[] = empty($this->expiredCallback)
|
||||
? "var reCaptchaExpiredCallback = function(){jQuery('#{$id}').val('');};"
|
||||
: "var reCaptchaExpiredCallback = function(){jQuery('#{$id}').val(''); {$this->expiredCallback}();};";
|
||||
|
||||
$this->expiredCallback = 'reCaptchaExpiredCallback';
|
||||
|
||||
$view->registerJs(implode("\n", $js), View::POS_BEGIN);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool|string the language code config option for google recatpcha library url.
|
||||
*/
|
||||
protected function getLanguageCode()
|
||||
{
|
||||
$language = Yii::$app->language;
|
||||
|
||||
if (strpos($language, '-') === false) {
|
||||
return $language;
|
||||
}
|
||||
|
||||
$except = [
|
||||
'zh-HK',
|
||||
'zh-CN',
|
||||
'zh-TW',
|
||||
'en-GB',
|
||||
'de-AT',
|
||||
'de-CH',
|
||||
'pt-BR',
|
||||
'pt-PT'
|
||||
];
|
||||
|
||||
return in_array($language, $except)
|
||||
? $language
|
||||
: substr($language, 0, strpos($language, '-'));
|
||||
}
|
||||
}
|
||||
@ -1,21 +1,14 @@
|
||||
<?php
|
||||
/**
|
||||
* Message translations.
|
||||
|
||||
/*
|
||||
* This file is part of the 2amigos/yii2-usuario project.
|
||||
*
|
||||
* This file is automatically generated by 'yii message/extract' command.
|
||||
* It contains the localizable messages extracted from source code.
|
||||
* You may modify this file by translating the extracted messages.
|
||||
* (c) 2amigOS! <http://2amigos.us/>
|
||||
*
|
||||
* Each array element represents the translation (value) of a message (key).
|
||||
* If the value is empty, the message is considered as not translated.
|
||||
* Messages that no longer need translation will have their translations
|
||||
* enclosed between a pair of '@@' marks.
|
||||
*
|
||||
* Message string can be used with plural forms format. Check i18n section
|
||||
* of the guide for details.
|
||||
*
|
||||
* NOTE: this file must be saved in UTF-8 encoding.
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
return [
|
||||
'(not set)' => '',
|
||||
'A confirmation message has been sent to your new email address' => '',
|
||||
|
||||
@ -1,21 +1,14 @@
|
||||
<?php
|
||||
/**
|
||||
* Message translations.
|
||||
|
||||
/*
|
||||
* This file is part of the 2amigos/yii2-usuario project.
|
||||
*
|
||||
* This file is automatically generated by 'yii message/extract' command.
|
||||
* It contains the localizable messages extracted from source code.
|
||||
* You may modify this file by translating the extracted messages.
|
||||
* (c) 2amigOS! <http://2amigos.us/>
|
||||
*
|
||||
* Each array element represents the translation (value) of a message (key).
|
||||
* If the value is empty, the message is considered as not translated.
|
||||
* Messages that no longer need translation will have their translations
|
||||
* enclosed between a pair of '@@' marks.
|
||||
*
|
||||
* Message string can be used with plural forms format. Check i18n section
|
||||
* of the guide for details.
|
||||
*
|
||||
* NOTE: this file must be saved in UTF-8 encoding.
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
return [
|
||||
'(not set)' => '',
|
||||
'A confirmation message has been sent to your new email address' => '',
|
||||
|
||||
@ -1,21 +1,14 @@
|
||||
<?php
|
||||
/**
|
||||
* Message translations.
|
||||
|
||||
/*
|
||||
* This file is part of the 2amigos/yii2-usuario project.
|
||||
*
|
||||
* This file is automatically generated by 'yii message/extract' command.
|
||||
* It contains the localizable messages extracted from source code.
|
||||
* You may modify this file by translating the extracted messages.
|
||||
* (c) 2amigOS! <http://2amigos.us/>
|
||||
*
|
||||
* Each array element represents the translation (value) of a message (key).
|
||||
* If the value is empty, the message is considered as not translated.
|
||||
* Messages that no longer need translation will have their translations
|
||||
* enclosed between a pair of '@@' marks.
|
||||
*
|
||||
* Message string can be used with plural forms format. Check i18n section
|
||||
* of the guide for details.
|
||||
*
|
||||
* NOTE: this file must be saved in UTF-8 encoding.
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
return [
|
||||
'(not set)' => '',
|
||||
'A confirmation message has been sent to your new email address' => '',
|
||||
|
||||
@ -1,21 +1,14 @@
|
||||
<?php
|
||||
/**
|
||||
* Message translations.
|
||||
|
||||
/*
|
||||
* This file is part of the 2amigos/yii2-usuario project.
|
||||
*
|
||||
* This file is automatically generated by 'yii message/extract' command.
|
||||
* It contains the localizable messages extracted from source code.
|
||||
* You may modify this file by translating the extracted messages.
|
||||
* (c) 2amigOS! <http://2amigos.us/>
|
||||
*
|
||||
* Each array element represents the translation (value) of a message (key).
|
||||
* If the value is empty, the message is considered as not translated.
|
||||
* Messages that no longer need translation will have their translations
|
||||
* enclosed between a pair of '@@' marks.
|
||||
*
|
||||
* Message string can be used with plural forms format. Check i18n section
|
||||
* of the guide for details.
|
||||
*
|
||||
* NOTE: this file must be saved in UTF-8 encoding.
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
return [
|
||||
'A message has been sent to your email address. It contains a confirmation link that you must click to complete registration.' => '',
|
||||
'Are you sure you want to switch to this user for the rest of this Session?' => '',
|
||||
|
||||
@ -1,21 +1,14 @@
|
||||
<?php
|
||||
/**
|
||||
* Message translations.
|
||||
|
||||
/*
|
||||
* This file is part of the 2amigos/yii2-usuario project.
|
||||
*
|
||||
* This file is automatically generated by 'yii message/extract' command.
|
||||
* It contains the localizable messages extracted from source code.
|
||||
* You may modify this file by translating the extracted messages.
|
||||
* (c) 2amigOS! <http://2amigos.us/>
|
||||
*
|
||||
* Each array element represents the translation (value) of a message (key).
|
||||
* If the value is empty, the message is considered as not translated.
|
||||
* Messages that no longer need translation will have their translations
|
||||
* enclosed between a pair of '@@' marks.
|
||||
*
|
||||
* Message string can be used with plural forms format. Check i18n section
|
||||
* of the guide for details.
|
||||
*
|
||||
* NOTE: this file must be saved in UTF-8 encoding.
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
return [
|
||||
'Cannot assign role "{0}" as the AuthManager is not configured on your console application.' => 'No se puede asignar rol "{0}" ya que AuthManager no ha sido configurado en tu aplicación de consola.',
|
||||
'Role "{0}" not found. Creating it.' => 'Rol "{0}" no encontrado. Creándolo.',
|
||||
|
||||
@ -1,21 +1,14 @@
|
||||
<?php
|
||||
/**
|
||||
* Message translations.
|
||||
|
||||
/*
|
||||
* This file is part of the 2amigos/yii2-usuario project.
|
||||
*
|
||||
* This file is automatically generated by 'yii message/extract' command.
|
||||
* It contains the localizable messages extracted from source code.
|
||||
* You may modify this file by translating the extracted messages.
|
||||
* (c) 2amigOS! <http://2amigos.us/>
|
||||
*
|
||||
* Each array element represents the translation (value) of a message (key).
|
||||
* If the value is empty, the message is considered as not translated.
|
||||
* Messages that no longer need translation will have their translations
|
||||
* enclosed between a pair of '@@' marks.
|
||||
*
|
||||
* Message string can be used with plural forms format. Check i18n section
|
||||
* of the guide for details.
|
||||
*
|
||||
* NOTE: this file must be saved in UTF-8 encoding.
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
return [
|
||||
'(not set)' => '',
|
||||
'A confirmation message has been sent to your new email address' => '',
|
||||
|
||||
@ -1,21 +1,14 @@
|
||||
<?php
|
||||
/**
|
||||
* Message translations.
|
||||
|
||||
/*
|
||||
* This file is part of the 2amigos/yii2-usuario project.
|
||||
*
|
||||
* This file is automatically generated by 'yii message/extract' command.
|
||||
* It contains the localizable messages extracted from source code.
|
||||
* You may modify this file by translating the extracted messages.
|
||||
* (c) 2amigOS! <http://2amigos.us/>
|
||||
*
|
||||
* Each array element represents the translation (value) of a message (key).
|
||||
* If the value is empty, the message is considered as not translated.
|
||||
* Messages that no longer need translation will have their translations
|
||||
* enclosed between a pair of '@@' marks.
|
||||
*
|
||||
* Message string can be used with plural forms format. Check i18n section
|
||||
* of the guide for details.
|
||||
*
|
||||
* NOTE: this file must be saved in UTF-8 encoding.
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
return [
|
||||
'(not set)' => '',
|
||||
'A confirmation message has been sent to your new email address' => '',
|
||||
|
||||
@ -1,21 +1,14 @@
|
||||
<?php
|
||||
/**
|
||||
* Message translations.
|
||||
|
||||
/*
|
||||
* This file is part of the 2amigos/yii2-usuario project.
|
||||
*
|
||||
* This file is automatically generated by 'yii message/extract' command.
|
||||
* It contains the localizable messages extracted from source code.
|
||||
* You may modify this file by translating the extracted messages.
|
||||
* (c) 2amigOS! <http://2amigos.us/>
|
||||
*
|
||||
* Each array element represents the translation (value) of a message (key).
|
||||
* If the value is empty, the message is considered as not translated.
|
||||
* Messages that no longer need translation will have their translations
|
||||
* enclosed between a pair of '@@' marks.
|
||||
*
|
||||
* Message string can be used with plural forms format. Check i18n section
|
||||
* of the guide for details.
|
||||
*
|
||||
* NOTE: this file must be saved in UTF-8 encoding.
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
return [
|
||||
'(not set)' => '',
|
||||
'A confirmation message has been sent to your new email address' => '',
|
||||
|
||||
@ -1,21 +1,14 @@
|
||||
<?php
|
||||
/**
|
||||
* Message translations.
|
||||
|
||||
/*
|
||||
* This file is part of the 2amigos/yii2-usuario project.
|
||||
*
|
||||
* This file is automatically generated by 'yii message/extract' command.
|
||||
* It contains the localizable messages extracted from source code.
|
||||
* You may modify this file by translating the extracted messages.
|
||||
* (c) 2amigOS! <http://2amigos.us/>
|
||||
*
|
||||
* Each array element represents the translation (value) of a message (key).
|
||||
* If the value is empty, the message is considered as not translated.
|
||||
* Messages that no longer need translation will have their translations
|
||||
* enclosed between a pair of '@@' marks.
|
||||
*
|
||||
* Message string can be used with plural forms format. Check i18n section
|
||||
* of the guide for details.
|
||||
*
|
||||
* NOTE: this file must be saved in UTF-8 encoding.
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
return [
|
||||
'(not set)' => '',
|
||||
'A confirmation message has been sent to your new email address' => '',
|
||||
|
||||
@ -1,21 +1,14 @@
|
||||
<?php
|
||||
/**
|
||||
* Message translations.
|
||||
|
||||
/*
|
||||
* This file is part of the 2amigos/yii2-usuario project.
|
||||
*
|
||||
* This file is automatically generated by 'yii message/extract' command.
|
||||
* It contains the localizable messages extracted from source code.
|
||||
* You may modify this file by translating the extracted messages.
|
||||
* (c) 2amigOS! <http://2amigos.us/>
|
||||
*
|
||||
* Each array element represents the translation (value) of a message (key).
|
||||
* If the value is empty, the message is considered as not translated.
|
||||
* Messages that no longer need translation will have their translations
|
||||
* enclosed between a pair of '@@' marks.
|
||||
*
|
||||
* Message string can be used with plural forms format. Check i18n section
|
||||
* of the guide for details.
|
||||
*
|
||||
* NOTE: this file must be saved in UTF-8 encoding.
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
return [
|
||||
'A message has been sent to your email address. It contains a confirmation link that you must click to complete registration.' => '',
|
||||
'Awesome, almost there. Now you need to click the confirmation link sent to your new email address.' => '',
|
||||
|
||||
@ -1,21 +1,14 @@
|
||||
<?php
|
||||
/**
|
||||
* Message translations.
|
||||
|
||||
/*
|
||||
* This file is part of the 2amigos/yii2-usuario project.
|
||||
*
|
||||
* This file is automatically generated by 'yii message/extract' command.
|
||||
* It contains the localizable messages extracted from source code.
|
||||
* You may modify this file by translating the extracted messages.
|
||||
* (c) 2amigOS! <http://2amigos.us/>
|
||||
*
|
||||
* Each array element represents the translation (value) of a message (key).
|
||||
* If the value is empty, the message is considered as not translated.
|
||||
* Messages that no longer need translation will have their translations
|
||||
* enclosed between a pair of '@@' marks.
|
||||
*
|
||||
* Message string can be used with plural forms format. Check i18n section
|
||||
* of the guide for details.
|
||||
*
|
||||
* NOTE: this file must be saved in UTF-8 encoding.
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
return [
|
||||
'A message has been sent to your email address. It contains a confirmation link that you must click to complete registration.' => '',
|
||||
'Awesome, almost there. Now you need to click the confirmation link sent to your new email address.' => '',
|
||||
|
||||
@ -1,21 +1,14 @@
|
||||
<?php
|
||||
/**
|
||||
* Message translations.
|
||||
|
||||
/*
|
||||
* This file is part of the 2amigos/yii2-usuario project.
|
||||
*
|
||||
* This file is automatically generated by 'yii message/extract' command.
|
||||
* It contains the localizable messages extracted from source code.
|
||||
* You may modify this file by translating the extracted messages.
|
||||
* (c) 2amigOS! <http://2amigos.us/>
|
||||
*
|
||||
* Each array element represents the translation (value) of a message (key).
|
||||
* If the value is empty, the message is considered as not translated.
|
||||
* Messages that no longer need translation will have their translations
|
||||
* enclosed between a pair of '@@' marks.
|
||||
*
|
||||
* Message string can be used with plural forms format. Check i18n section
|
||||
* of the guide for details.
|
||||
*
|
||||
* NOTE: this file must be saved in UTF-8 encoding.
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
return [
|
||||
'(not set)' => '',
|
||||
'A confirmation message has been sent to your new email address' => '',
|
||||
|
||||
@ -1,21 +1,14 @@
|
||||
<?php
|
||||
/**
|
||||
* Message translations.
|
||||
|
||||
/*
|
||||
* This file is part of the 2amigos/yii2-usuario project.
|
||||
*
|
||||
* This file is automatically generated by 'yii message/extract' command.
|
||||
* It contains the localizable messages extracted from source code.
|
||||
* You may modify this file by translating the extracted messages.
|
||||
* (c) 2amigOS! <http://2amigos.us/>
|
||||
*
|
||||
* Each array element represents the translation (value) of a message (key).
|
||||
* If the value is empty, the message is considered as not translated.
|
||||
* Messages that no longer need translation will have their translations
|
||||
* enclosed between a pair of '@@' marks.
|
||||
*
|
||||
* Message string can be used with plural forms format. Check i18n section
|
||||
* of the guide for details.
|
||||
*
|
||||
* NOTE: this file must be saved in UTF-8 encoding.
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
return [
|
||||
'(not set)' => '',
|
||||
'A confirmation message has been sent to your new email address' => '',
|
||||
|
||||
@ -1,21 +1,14 @@
|
||||
<?php
|
||||
/**
|
||||
* Message translations.
|
||||
|
||||
/*
|
||||
* This file is part of the 2amigos/yii2-usuario project.
|
||||
*
|
||||
* This file is automatically generated by 'yii message/extract' command.
|
||||
* It contains the localizable messages extracted from source code.
|
||||
* You may modify this file by translating the extracted messages.
|
||||
* (c) 2amigOS! <http://2amigos.us/>
|
||||
*
|
||||
* Each array element represents the translation (value) of a message (key).
|
||||
* If the value is empty, the message is considered as not translated.
|
||||
* Messages that no longer need translation will have their translations
|
||||
* enclosed between a pair of '@@' marks.
|
||||
*
|
||||
* Message string can be used with plural forms format. Check i18n section
|
||||
* of the guide for details.
|
||||
*
|
||||
* NOTE: this file must be saved in UTF-8 encoding.
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
return [
|
||||
'(not set)' => '',
|
||||
'A confirmation message has been sent to your new email address' => '',
|
||||
|
||||
@ -1,21 +1,14 @@
|
||||
<?php
|
||||
/**
|
||||
* Message translations.
|
||||
|
||||
/*
|
||||
* This file is part of the 2amigos/yii2-usuario project.
|
||||
*
|
||||
* This file is automatically generated by 'yii message/extract' command.
|
||||
* It contains the localizable messages extracted from source code.
|
||||
* You may modify this file by translating the extracted messages.
|
||||
* (c) 2amigOS! <http://2amigos.us/>
|
||||
*
|
||||
* Each array element represents the translation (value) of a message (key).
|
||||
* If the value is empty, the message is considered as not translated.
|
||||
* Messages that no longer need translation will have their translations
|
||||
* enclosed between a pair of '@@' marks.
|
||||
*
|
||||
* Message string can be used with plural forms format. Check i18n section
|
||||
* of the guide for details.
|
||||
*
|
||||
* NOTE: this file must be saved in UTF-8 encoding.
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
return [
|
||||
'Cannot assign role "{0}" as the AuthManager is not configured on your console application.' => '',
|
||||
'Role "{0}" not found. Creating it.' => '',
|
||||
|
||||
@ -1,21 +1,14 @@
|
||||
<?php
|
||||
/**
|
||||
* Message translations.
|
||||
|
||||
/*
|
||||
* This file is part of the 2amigos/yii2-usuario project.
|
||||
*
|
||||
* This file is automatically generated by 'yii message/extract' command.
|
||||
* It contains the localizable messages extracted from source code.
|
||||
* You may modify this file by translating the extracted messages.
|
||||
* (c) 2amigOS! <http://2amigos.us/>
|
||||
*
|
||||
* Each array element represents the translation (value) of a message (key).
|
||||
* If the value is empty, the message is considered as not translated.
|
||||
* Messages that no longer need translation will have their translations
|
||||
* enclosed between a pair of '@@' marks.
|
||||
*
|
||||
* Message string can be used with plural forms format. Check i18n section
|
||||
* of the guide for details.
|
||||
*
|
||||
* NOTE: this file must be saved in UTF-8 encoding.
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
return [
|
||||
'(not set)' => '',
|
||||
'A confirmation message has been sent to your new email address' => '',
|
||||
|
||||
@ -1,21 +1,14 @@
|
||||
<?php
|
||||
/**
|
||||
* Message translations.
|
||||
|
||||
/*
|
||||
* This file is part of the 2amigos/yii2-usuario project.
|
||||
*
|
||||
* This file is automatically generated by 'yii message/extract' command.
|
||||
* It contains the localizable messages extracted from source code.
|
||||
* You may modify this file by translating the extracted messages.
|
||||
* (c) 2amigOS! <http://2amigos.us/>
|
||||
*
|
||||
* Each array element represents the translation (value) of a message (key).
|
||||
* If the value is empty, the message is considered as not translated.
|
||||
* Messages that no longer need translation will have their translations
|
||||
* enclosed between a pair of '@@' marks.
|
||||
*
|
||||
* Message string can be used with plural forms format. Check i18n section
|
||||
* of the guide for details.
|
||||
*
|
||||
* NOTE: this file must be saved in UTF-8 encoding.
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
return [
|
||||
'(not set)' => '',
|
||||
'A confirmation message has been sent to your new email address' => '',
|
||||
|
||||
@ -1,21 +1,14 @@
|
||||
<?php
|
||||
/**
|
||||
* Message translations.
|
||||
|
||||
/*
|
||||
* This file is part of the 2amigos/yii2-usuario project.
|
||||
*
|
||||
* This file is automatically generated by 'yii message/extract' command.
|
||||
* It contains the localizable messages extracted from source code.
|
||||
* You may modify this file by translating the extracted messages.
|
||||
* (c) 2amigOS! <http://2amigos.us/>
|
||||
*
|
||||
* Each array element represents the translation (value) of a message (key).
|
||||
* If the value is empty, the message is considered as not translated.
|
||||
* Messages that no longer need translation will have their translations
|
||||
* enclosed between a pair of '@@' marks.
|
||||
*
|
||||
* Message string can be used with plural forms format. Check i18n section
|
||||
* of the guide for details.
|
||||
*
|
||||
* NOTE: this file must be saved in UTF-8 encoding.
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
return [
|
||||
'A message has been sent to your email address. It contains a confirmation link that you must click to complete registration.' => '',
|
||||
'Awesome, almost there. Now you need to click the confirmation link sent to your new email address.' => '',
|
||||
|
||||
@ -1,21 +1,14 @@
|
||||
<?php
|
||||
/**
|
||||
* Message translations.
|
||||
|
||||
/*
|
||||
* This file is part of the 2amigos/yii2-usuario project.
|
||||
*
|
||||
* This file is automatically generated by 'yii message/extract' command.
|
||||
* It contains the localizable messages extracted from source code.
|
||||
* You may modify this file by translating the extracted messages.
|
||||
* (c) 2amigOS! <http://2amigos.us/>
|
||||
*
|
||||
* Each array element represents the translation (value) of a message (key).
|
||||
* If the value is empty, the message is considered as not translated.
|
||||
* Messages that no longer need translation will have their translations
|
||||
* enclosed between a pair of '@@' marks.
|
||||
*
|
||||
* Message string can be used with plural forms format. Check i18n section
|
||||
* of the guide for details.
|
||||
*
|
||||
* NOTE: this file must be saved in UTF-8 encoding.
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
return [
|
||||
'A message has been sent to your email address. It contains a confirmation link that you must click to complete registration.' => '',
|
||||
'Awesome, almost there. Now you need to click the confirmation link sent to your new email address.' => '',
|
||||
|
||||
@ -1,21 +1,14 @@
|
||||
<?php
|
||||
/**
|
||||
* Message translations.
|
||||
|
||||
/*
|
||||
* This file is part of the 2amigos/yii2-usuario project.
|
||||
*
|
||||
* This file is automatically generated by 'yii message/extract' command.
|
||||
* It contains the localizable messages extracted from source code.
|
||||
* You may modify this file by translating the extracted messages.
|
||||
* (c) 2amigOS! <http://2amigos.us/>
|
||||
*
|
||||
* Each array element represents the translation (value) of a message (key).
|
||||
* If the value is empty, the message is considered as not translated.
|
||||
* Messages that no longer need translation will have their translations
|
||||
* enclosed between a pair of '@@' marks.
|
||||
*
|
||||
* Message string can be used with plural forms format. Check i18n section
|
||||
* of the guide for details.
|
||||
*
|
||||
* NOTE: this file must be saved in UTF-8 encoding.
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
return [
|
||||
'(not set)' => '',
|
||||
'A confirmation message has been sent to your new email address' => '',
|
||||
|
||||
@ -1,21 +1,14 @@
|
||||
<?php
|
||||
/**
|
||||
* Message translations.
|
||||
|
||||
/*
|
||||
* This file is part of the 2amigos/yii2-usuario project.
|
||||
*
|
||||
* This file is automatically generated by 'yii message/extract' command.
|
||||
* It contains the localizable messages extracted from source code.
|
||||
* You may modify this file by translating the extracted messages.
|
||||
* (c) 2amigOS! <http://2amigos.us/>
|
||||
*
|
||||
* Each array element represents the translation (value) of a message (key).
|
||||
* If the value is empty, the message is considered as not translated.
|
||||
* Messages that no longer need translation will have their translations
|
||||
* enclosed between a pair of '@@' marks.
|
||||
*
|
||||
* Message string can be used with plural forms format. Check i18n section
|
||||
* of the guide for details.
|
||||
*
|
||||
* NOTE: this file must be saved in UTF-8 encoding.
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
return [
|
||||
'(not set)' => '',
|
||||
'A confirmation message has been sent to your new email address' => '',
|
||||
|
||||
@ -1,21 +1,14 @@
|
||||
<?php
|
||||
/**
|
||||
* Message translations.
|
||||
|
||||
/*
|
||||
* This file is part of the 2amigos/yii2-usuario project.
|
||||
*
|
||||
* This file is automatically generated by 'yii message/extract' command.
|
||||
* It contains the localizable messages extracted from source code.
|
||||
* You may modify this file by translating the extracted messages.
|
||||
* (c) 2amigOS! <http://2amigos.us/>
|
||||
*
|
||||
* Each array element represents the translation (value) of a message (key).
|
||||
* If the value is empty, the message is considered as not translated.
|
||||
* Messages that no longer need translation will have their translations
|
||||
* enclosed between a pair of '@@' marks.
|
||||
*
|
||||
* Message string can be used with plural forms format. Check i18n section
|
||||
* of the guide for details.
|
||||
*
|
||||
* NOTE: this file must be saved in UTF-8 encoding.
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
return [
|
||||
'(not set)' => '',
|
||||
'A confirmation message has been sent to your new email address' => '',
|
||||
|
||||
@ -1,21 +1,14 @@
|
||||
<?php
|
||||
/**
|
||||
* Message translations.
|
||||
|
||||
/*
|
||||
* This file is part of the 2amigos/yii2-usuario project.
|
||||
*
|
||||
* This file is automatically generated by 'yii message/extract' command.
|
||||
* It contains the localizable messages extracted from source code.
|
||||
* You may modify this file by translating the extracted messages.
|
||||
* (c) 2amigOS! <http://2amigos.us/>
|
||||
*
|
||||
* Each array element represents the translation (value) of a message (key).
|
||||
* If the value is empty, the message is considered as not translated.
|
||||
* Messages that no longer need translation will have their translations
|
||||
* enclosed between a pair of '@@' marks.
|
||||
*
|
||||
* Message string can be used with plural forms format. Check i18n section
|
||||
* of the guide for details.
|
||||
*
|
||||
* NOTE: this file must be saved in UTF-8 encoding.
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
return [
|
||||
'(not set)' => '',
|
||||
'A confirmation message has been sent to your new email address' => '',
|
||||
|
||||
@ -1,21 +1,14 @@
|
||||
<?php
|
||||
/**
|
||||
* Message translations.
|
||||
|
||||
/*
|
||||
* This file is part of the 2amigos/yii2-usuario project.
|
||||
*
|
||||
* This file is automatically generated by 'yii message/extract' command.
|
||||
* It contains the localizable messages extracted from source code.
|
||||
* You may modify this file by translating the extracted messages.
|
||||
* (c) 2amigOS! <http://2amigos.us/>
|
||||
*
|
||||
* Each array element represents the translation (value) of a message (key).
|
||||
* If the value is empty, the message is considered as not translated.
|
||||
* Messages that no longer need translation will have their translations
|
||||
* enclosed between a pair of '@@' marks.
|
||||
*
|
||||
* Message string can be used with plural forms format. Check i18n section
|
||||
* of the guide for details.
|
||||
*
|
||||
* NOTE: this file must be saved in UTF-8 encoding.
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
return [
|
||||
'(not set)' => '',
|
||||
'A confirmation message has been sent to your new email address' => '',
|
||||
|
||||
@ -63,7 +63,7 @@ $module = Yii::$app->getModule('user');
|
||||
'value' => function ($model) {
|
||||
if (!$model->last_login_at || $model->last_login_at == 0) {
|
||||
return Yii::t('usuario', 'Never');
|
||||
} else if (extension_loaded('intl')) {
|
||||
} elseif (extension_loaded('intl')) {
|
||||
return Yii::t('usuario', '{0, date, MMMM dd, YYYY HH:mm}', [$model->last_login_at]);
|
||||
} else {
|
||||
return date('Y-m-d G:i:s', $model->last_login_at);
|
||||
|
||||
@ -14,8 +14,8 @@ use yii\helpers\Url;
|
||||
use yii\widgets\ActiveForm;
|
||||
|
||||
/**
|
||||
* @var yii\web\View $this
|
||||
* @var yii\widgets\ActiveForm $form
|
||||
* @var yii\web\View $this
|
||||
* @var yii\widgets\ActiveForm $form
|
||||
* @var \Da\User\Form\SettingsForm $model
|
||||
*/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user