Merge branch 'session-histroy' of https://github.com/maranqz/yii2-usuario
This commit is contained in:
68
src/User/resources/views/admin/_session-history.php
Executable file
68
src/User/resources/views/admin/_session-history.php
Executable 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.
|
||||
*/
|
||||
|
||||
use Da\User\Widget\SessionStatusWidget;
|
||||
use yii\helpers\Html;
|
||||
use yii\grid\GridView;
|
||||
use yii\widgets\Pjax;
|
||||
use Da\User\Model\SessionHistory;
|
||||
use Da\User\Search\SessionHistorySearch;
|
||||
use yii\web\View;
|
||||
use yii\data\ActiveDataProvider;
|
||||
|
||||
/**
|
||||
* @var $this View
|
||||
* @var $searchModel SessionHistorySearch
|
||||
* @var $dataProvider ActiveDataProvider
|
||||
*/
|
||||
?>
|
||||
|
||||
<?php $this->beginContent('@Da/User/resources/views/admin/update.php', ['user' => $user]) ?>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<?= Html::a(
|
||||
Yii::t('usuario', 'Terminate all sessions'),
|
||||
['/user/admin/terminate-sessions', 'id' => $user->id],
|
||||
[
|
||||
'class' => 'btn btn-danger btn-xs pull-right',
|
||||
'data-method' => 'post'
|
||||
]
|
||||
) ?>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
|
||||
<?php Pjax::begin(); ?>
|
||||
|
||||
<?= GridView::widget([
|
||||
'dataProvider' => $dataProvider,
|
||||
'filterModel' => $searchModel,
|
||||
'columns' => [
|
||||
'user_agent',
|
||||
'ip',
|
||||
[
|
||||
'contentOptions' => [
|
||||
'class' => 'text-nowrap',
|
||||
],
|
||||
'label' => Yii::t('usuario', 'Status'),
|
||||
'value' => function (SessionHistory $model) {
|
||||
return SessionStatusWidget::widget(['model' => $model]);
|
||||
},
|
||||
],
|
||||
[
|
||||
'attribute' => 'updated_at',
|
||||
'format' => 'datetime'
|
||||
],
|
||||
],
|
||||
]); ?>
|
||||
<?php Pjax::end(); ?>
|
||||
|
||||
<?php $this->endContent() ?>
|
||||
10
src/User/resources/views/admin/update.php
Normal file → Executable file
10
src/User/resources/views/admin/update.php
Normal file → Executable file
@ -13,6 +13,7 @@ use Da\User\Model\User;
|
||||
use yii\bootstrap\Nav;
|
||||
use yii\helpers\Html;
|
||||
use yii\web\View;
|
||||
use Da\User\Module as UserModule;
|
||||
|
||||
/**
|
||||
* @var View $this
|
||||
@ -24,12 +25,14 @@ $this->title = Yii::t('usuario', 'Update user account');
|
||||
$this->params['breadcrumbs'][] = ['label' => Yii::t('usuario', 'Users'), 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
|
||||
/** @var UserModule $module */
|
||||
$module = Yii::$app->getModule('user');
|
||||
?>
|
||||
<div class="clearfix"></div>
|
||||
<?= $this->render(
|
||||
'/shared/_alert',
|
||||
[
|
||||
'module' => Yii::$app->getModule('user'),
|
||||
'module' => $module,
|
||||
]
|
||||
) ?>
|
||||
|
||||
@ -67,6 +70,11 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
'label' => Yii::t('usuario', 'Assignments'),
|
||||
'url' => ['/user/admin/assignments', 'id' => $user->id],
|
||||
],
|
||||
[
|
||||
'label' => Yii::t('usuario', 'Session history'),
|
||||
'url' => ['/user/admin/session-history', 'id' => $user->id],
|
||||
'visible' => $module->enableSessionHistory,
|
||||
],
|
||||
'<hr>',
|
||||
[
|
||||
'label' => Yii::t('usuario', 'Confirm'),
|
||||
|
||||
10
src/User/resources/views/settings/_menu.php
Normal file → Executable file
10
src/User/resources/views/settings/_menu.php
Normal file → Executable file
@ -11,9 +11,12 @@
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\Menu;
|
||||
use Da\User\Module as UserModule;
|
||||
use Da\User\Model\User;
|
||||
|
||||
/** @var \Da\User\Model\User $user */
|
||||
/** @var User $user */
|
||||
$user = Yii::$app->user->identity;
|
||||
/** @var UserModule $module */
|
||||
$module = Yii::$app->getModule('user');
|
||||
$networksVisible = count(Yii::$app->authClientCollection->clients) > 0;
|
||||
|
||||
@ -41,6 +44,11 @@ $networksVisible = count(Yii::$app->authClientCollection->clients) > 0;
|
||||
'items' => [
|
||||
['label' => Yii::t('usuario', 'Profile'), 'url' => ['/user/settings/profile']],
|
||||
['label' => Yii::t('usuario', 'Account'), 'url' => ['/user/settings/account']],
|
||||
[
|
||||
'label' => Yii::t('usuario', 'Session history'),
|
||||
'url' => ['/user/settings/session-history'],
|
||||
'visible' => $module->enableSessionHistory,
|
||||
],
|
||||
['label' => Yii::t('usuario', 'Privacy'),
|
||||
'url' => ['/user/settings/privacy'],
|
||||
'visible' => $module->enableGdprCompliance
|
||||
|
||||
79
src/User/resources/views/settings/session-history.php
Executable file
79
src/User/resources/views/settings/session-history.php
Executable file
@ -0,0 +1,79 @@
|
||||
<?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.
|
||||
*/
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\grid\GridView;
|
||||
use yii\widgets\Pjax;
|
||||
use Da\User\Model\SessionHistory;
|
||||
use Da\User\Search\SessionHistorySearch;
|
||||
use yii\web\View;
|
||||
use yii\data\ActiveDataProvider;
|
||||
use Da\User\Widget\SessionStatusWidget;
|
||||
|
||||
/**
|
||||
* @var $this View
|
||||
* @var $searchModel SessionHistorySearch
|
||||
* @var $dataProvider ActiveDataProvider
|
||||
*/
|
||||
|
||||
$this->title = Yii::t('usuario', 'Session history');
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
|
||||
<?= $this->render('/shared/_alert', ['module' => Yii::$app->getModule('user')]) ?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
<?= $this->render('/settings/_menu') ?>
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<?= Html::encode($this->title) ?>
|
||||
<?= Html::a(
|
||||
Yii::t('usuario', 'Terminate all sessions'),
|
||||
['/user/settings/terminate-sessions'],
|
||||
[
|
||||
'class' => 'btn btn-danger btn-xs pull-right',
|
||||
'data-method' => 'post'
|
||||
]
|
||||
) ?>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
|
||||
<?php Pjax::begin(); ?>
|
||||
|
||||
<?= GridView::widget([
|
||||
'dataProvider' => $dataProvider,
|
||||
'filterModel' => $searchModel,
|
||||
'columns' => [
|
||||
'user_agent',
|
||||
'ip',
|
||||
[
|
||||
'contentOptions' => [
|
||||
'class' => 'text-nowrap',
|
||||
],
|
||||
'label' => Yii::t('usuario', 'Status'),
|
||||
'value' => function (SessionHistory $model) {
|
||||
return SessionStatusWidget::widget(['model' => $model]);
|
||||
},
|
||||
],
|
||||
[
|
||||
'attribute' => 'updated_at',
|
||||
'format' => 'datetime'
|
||||
],
|
||||
],
|
||||
]); ?>
|
||||
<?php Pjax::end(); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user