diff --git a/src/User/resources/views/admin/index.php b/src/User/resources/views/admin/index.php
index 97cee7c..c9a9e46 100644
--- a/src/User/resources/views/admin/index.php
+++ b/src/User/resources/views/admin/index.php
@@ -52,7 +52,7 @@ $module = Yii::$app->getModule('user');
'attribute' => 'created_at',
'value' => function ($model) {
if (extension_loaded('intl')) {
- return Yii::t('usuario', '{0, date, MMMM dd, YYYY HH:mm}', [$model->created_at]);
+ return Yii::t('usuario', '{0, date, MMM dd, YYYY HH:mm}', [$model->created_at]);
}
return date('Y-m-d G:i:s', $model->created_at);
@@ -64,12 +64,21 @@ $module = Yii::$app->getModule('user');
if (!$model->last_login_at || $model->last_login_at == 0) {
return Yii::t('usuario', 'Never');
} elseif (extension_loaded('intl')) {
- return Yii::t('usuario', '{0, date, MMMM dd, YYYY HH:mm}', [$model->last_login_at]);
+ return Yii::t('usuario', '{0, date, MMM dd, YYYY HH:mm}', [$model->last_login_at]);
} else {
return date('Y-m-d G:i:s', $model->last_login_at);
}
},
],
+ [
+ 'attribute' => 'last_login_ip',
+ 'value' => function ($model) {
+ return $model->last_login_ip == null
+ ? '
' . Yii::t('usuario', '(not set)') . ''
+ : $model->last_login_ip;
+ },
+ 'format' => 'html',
+ ],
[
'header' => Yii::t('usuario', 'Confirmation'),
'value' => function ($model) {
@@ -92,6 +101,7 @@ $module = Yii::$app->getModule('user');
'format' => 'raw',
'visible' => Yii::$app->getModule('user')->enableEmailConfirmation,
],
+ 'password_age',
[
'header' => Yii::t('usuario', 'Block status'),
'value' => function ($model) {
@@ -121,7 +131,7 @@ $module = Yii::$app->getModule('user');
],
[
'class' => 'yii\grid\ActionColumn',
- 'template' => '{switch} {update} {delete}',
+ 'template' => '{switch} {reset} {force-password-change} {update} {delete}',
'buttons' => [
'switch' => function ($url, $model) use ($module) {
if ($model->id != Yii::$app->user->id && $module->enableSwitchIdentities) {
@@ -140,7 +150,42 @@ $module = Yii::$app->getModule('user');
}
return null;
- }
+ },
+ 'reset' => function ($url, $model) use ($module) {
+ if(!$module->allowPasswordRecovery && $module->allowAdminPasswordRecovery) {
+ return Html::a(
+ '
',
+ ['/user/admin/password-reset', 'id' => $model->id],
+ [
+ 'title' => Yii::t('usuario', 'Send password recovery email'),
+ 'data-confirm' => Yii::t(
+ 'usuario',
+ 'Are you sure you wish to send a password recovery email to this user?'
+ ),
+ 'data-method' => 'POST',
+ ]
+ );
+ }
+
+ return null;
+ },
+ 'force-password-change' => function ($url, $model) use ($module) {
+ if (is_null($module->maxPasswordAge)) {
+ return null;
+ }
+ return Html::a(
+ '
',
+ ['/user/admin/force-password-change', 'id' => $model->id],
+ [
+ 'title' => Yii::t('usuario', 'Force password change at next login'),
+ 'data-confirm' => Yii::t(
+ 'usuario',
+ 'Are you sure you wish the user to change their password at next login?'
+ ),
+ 'data-method' => 'POST',
+ ]
+ );
+ },
]
],
],
diff --git a/src/User/resources/views/permission/create.php b/src/User/resources/views/permission/create.php
index 1e77b26..90ef9e4 100644
--- a/src/User/resources/views/permission/create.php
+++ b/src/User/resources/views/permission/create.php
@@ -23,7 +23,7 @@ $this->params['breadcrumbs'][] = $this->title;
beginContent('@Da/User/resources/views/shared/admin_layout.php') ?>
= $this->render(
- '_form',
+ '/permission/_form',
[
'model' => $model,
'unassignedItems' => $unassignedItems,
diff --git a/src/User/resources/views/permission/update.php b/src/User/resources/views/permission/update.php
index 70097df..a553acb 100644
--- a/src/User/resources/views/permission/update.php
+++ b/src/User/resources/views/permission/update.php
@@ -23,7 +23,7 @@ $this->params['breadcrumbs'][] = $this->title;
beginContent('@Da/User/resources/views/shared/admin_layout.php') ?>
= $this->render(
- '_form',
+ '/permission/_form',
[
'model' => $model,
'unassignedItems' => $unassignedItems,
diff --git a/src/User/resources/views/registration/register.php b/src/User/resources/views/registration/register.php
index bb5a02f..243977a 100644
--- a/src/User/resources/views/registration/register.php
+++ b/src/User/resources/views/registration/register.php
@@ -37,7 +37,7 @@ $this->params['breadcrumbs'][] = $this->title;
]
); ?>
- = $form->field($model, 'email') ?>
+ = $form->field($model, 'email')->textInput(['autofocus' => true]) ?>
= $form->field($model, 'username') ?>
diff --git a/src/User/resources/views/role/create.php b/src/User/resources/views/role/create.php
index dea05b8..3176627 100644
--- a/src/User/resources/views/role/create.php
+++ b/src/User/resources/views/role/create.php
@@ -22,7 +22,7 @@ $this->params['breadcrumbs'][] = $this->title;
beginContent('@Da/User/resources/views/shared/admin_layout.php') ?>
= $this->render(
- '_form',
+ '/role/_form',
[
'model' => $model,
'unassignedItems' => $unassignedItems,
diff --git a/src/User/resources/views/role/update.php b/src/User/resources/views/role/update.php
index 0759dfd..b9ccc34 100644
--- a/src/User/resources/views/role/update.php
+++ b/src/User/resources/views/role/update.php
@@ -22,7 +22,7 @@ $this->params['breadcrumbs'][] = $this->title;
beginContent('@Da/User/resources/views/shared/admin_layout.php') ?>
= $this->render(
- '_form',
+ '/role/_form',
[
'model' => $model,
'unassignedItems' => $unassignedItems,
diff --git a/src/User/resources/views/rule/create.php b/src/User/resources/views/rule/create.php
index 386a9c0..c2b8a54 100644
--- a/src/User/resources/views/rule/create.php
+++ b/src/User/resources/views/rule/create.php
@@ -22,7 +22,7 @@ $this->params['breadcrumbs'][] = $this->title;
beginContent('@Da/User/resources/views/shared/admin_layout.php') ?>
= $this->render(
- '_form',
+ '/rule/_form',
[
'model' => $model,
]
diff --git a/src/User/resources/views/rule/update.php b/src/User/resources/views/rule/update.php
index df4fce4..f12495e 100644
--- a/src/User/resources/views/rule/update.php
+++ b/src/User/resources/views/rule/update.php
@@ -23,7 +23,7 @@ $this->params['breadcrumbs'][] = $this->title;
beginContent('@Da/User/resources/views/shared/admin_layout.php') ?>
= $this->render(
- '_form',
+ '/rule/_form',
[
'model' => $model,
]
diff --git a/src/User/resources/views/settings/account.php b/src/User/resources/views/settings/account.php
index df29662..3b54bb3 100644
--- a/src/User/resources/views/settings/account.php
+++ b/src/User/resources/views/settings/account.php
@@ -31,7 +31,7 @@ $module = Yii::$app->getModule('user');
- = $this->render('_menu') ?>
+ = $this->render('/settings/_menu') ?>
@@ -81,7 +81,7 @@ $module = Yii::$app->getModule('user');
- = Yii::t('usuario', 'Two Factor Authentication') ?>
+ = Yii::t('usuario', 'Two Factor Authentication (2FA)') ?>
...
@@ -96,25 +96,25 @@ $module = Yii::$app->getModule('user');
-
= Yii::t('usuario', 'Two-Factor Authentication') ?>
+ = Yii::t('usuario', 'Two Factor Authentication (2FA)') ?>
- = Yii::t('usuario', 'Two-factor auth protects you against stolen credentials') ?>.
+ = Yii::t('usuario', 'Two factor authentication protects you against stolen credentials') ?>.
= Html::a(
- Yii::t('usuario', 'Disable Two-Factor Auth'),
+ Yii::t('usuario', 'Disable two factor authentication'),
['two-factor-disable', 'id' => $model->getUser()->id],
[
'id' => 'disable_tf_btn',
'class' => 'btn btn-warning ' . ($model->getUser()->auth_tf_enabled ? '' : 'hide'),
'data-method' => 'post',
- 'data-confirm' => Yii::t('usuario', 'This will disable two-factor auth. Are you sure?'),
+ 'data-confirm' => Yii::t('usuario', 'This will disable two factor authentication. Are you sure?'),
]
) ?>
= Html::a(
- Yii::t('usuario', 'Enable Two-factor auth'),
+ Yii::t('usuario', 'Enable two factor authentication'),
'#tfmodal',
[
'id' => 'enable_tf_btn',
diff --git a/src/User/resources/views/settings/networks.php b/src/User/resources/views/settings/networks.php
index f7c6883..3c62583 100644
--- a/src/User/resources/views/settings/networks.php
+++ b/src/User/resources/views/settings/networks.php
@@ -28,7 +28,7 @@ $this->params['breadcrumbs'][] = $this->title;
- = $this->render('_menu') ?>
+ = $this->render('/networks/_menu') ?>
diff --git a/src/User/resources/views/settings/profile.php b/src/User/resources/views/settings/profile.php
index 1144909..8f33786 100644
--- a/src/User/resources/views/settings/profile.php
+++ b/src/User/resources/views/settings/profile.php
@@ -32,7 +32,7 @@ $timezoneHelper = $model->make(TimezoneHelper::class);
- = $this->render('_menu') ?>
+ = $this->render('/profile/_menu') ?>
@@ -71,7 +71,8 @@ $timezoneHelper = $model->make(TimezoneHelper::class);
->hint(
Html::a(
Yii::t('usuario', 'Change your avatar at Gravatar.com'),
- 'http://gravatar.com'
+ 'http://gravatar.com',
+ ['target' => '_blank']
)
) ?>
diff --git a/src/User/resources/views/settings/two-factor.php b/src/User/resources/views/settings/two-factor.php
index d4d5527..6434396 100644
--- a/src/User/resources/views/settings/two-factor.php
+++ b/src/User/resources/views/settings/two-factor.php
@@ -29,7 +29,7 @@
diff --git a/src/User/resources/views/shared/message.php b/src/User/resources/views/shared/message.php
index a35d8f6..84574e0 100644
--- a/src/User/resources/views/shared/message.php
+++ b/src/User/resources/views/shared/message.php
@@ -20,7 +20,7 @@ $this->title = $title;
?>
= $this->render(
- '_alert',
+ '/shared/_alert',
[
'module' => $module,
]
diff --git a/src/User/resources/views/widgets/login/login.php b/src/User/resources/views/widgets/login/form.php
similarity index 100%
rename from src/User/resources/views/widgets/login/login.php
rename to src/User/resources/views/widgets/login/form.php
diff --git a/tests/_data/schema.sql b/tests/_data/schema.sql
index eb32a92..cd9c92a 100644
--- a/tests/_data/schema.sql
+++ b/tests/_data/schema.sql
@@ -76,6 +76,8 @@ CREATE TABLE `user` (
`gdpr_consent` tinyint(1) NULL DEFAULT '0',
`gdpr_consent_date` int(11) NULL,
`gdpr_deleted` tinyint(1) DEFAULT '0',
+ `last_login_ip` varchar(45) DEFAULT NULL,
+ `password_changed_at` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `user_unique_email` (`email`),
diff --git a/tests/functional/RegistrationCest.php b/tests/functional/RegistrationCest.php
index d496dbe..dfc19cf 100644
--- a/tests/functional/RegistrationCest.php
+++ b/tests/functional/RegistrationCest.php
@@ -50,7 +50,7 @@ class RegistrationCest
$I->see(Html::encode('This email address has already been taken'));
$this->register($I, 'tester@example.com', 'tester', 'tester');
- $I->see('Your account has been created and a message with further instructions has been sent to your email');
+ $I->see('Your account has been created');
$user = $I->grabRecord(User::className(), ['email' => 'tester@example.com']);
$I->assertTrue($user->isConfirmed);
@@ -96,7 +96,7 @@ class RegistrationCest
]);
$I->amOnRoute('/user/registration/register');
$this->register($I, 'tester@example.com', 'tester');
- $I->see('Your account has been created and a message with further instructions has been sent to your email');
+ $I->see('Your account has been created');
$user = $I->grabRecord(User::className(), ['email' => 'tester@example.com']);
$I->assertEquals('tester', $user->username);
/** @var yii\swiftmailer\Message $message */