dennis-kashirin/yii2-session-timeout-warning 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

dennis-kashirin/yii2-session-timeout-warning

Composer 安装命令:

composer require dennis-kashirin/yii2-session-timeout-warning

包简介

Users are warned about expiring session.

README 文档

README

Users are warned about expiring session.

Differences with original code

  1. Added support of Russian and Ukrainian languages

This is simple implementation of session timeout warning. Plugin does not make any ajax calls, otherwise it would not work with many projects. Components like RBAC are using user identity all time and auth session is renewed every request.

This plugin writes and reads cookies.

It supports multiple tabs. Plugin will not work if user is logged out from server side, or sessions are cleared from database.

If user session is expired, page will be reloaded.

Install

Either run

$ php composer.phar require dennis-kashirin/yii2-session-timeout-warning "@dev"

or add

"dennis-kashirin/yii2-session-timeout-warning": "@dev"

to the require section of your composer.json file.

Usage

  1. Register bootstrap class in application config.
[
  'bootstrap' => [
      [
          'class' => \mgcode\sessionWarning\components\SessionWarningBootstrap::className(),
          'initMessages' => true,
      ]
  ],
];

initMesscompoages property initializes translations. Currently only English, Latvian, Russian and Ukrainian languages are supported. Please contribute and add your language.

  1. Add controller to controllerMap in application config.
[
  'controllerMap' => [
    'session-warning' => [
      'class' => 'mgcode\sessionWarning\controllers\SessionWarningController',
    ],
  ],
];

Note: If you are using RBAC, you should allow all visitors to access this controller.

  1. Insert widget in layout view.
<?= \mgcode\sessionWarning\widgets\SessionWarningWidget::widget([
  //... Properties  ...
]); ?>

Properties:

  • logoutUrl - if is set, logout button will be shown before Continue button. Default: null
  • extendUrl - url where ajax request is sent, when continue button is clicked. Default: ['/session-warning/extend']
  • warnBefore - time in seconds before user is warned about expiring session. Default: 300 (5min)

统计信息

  • 总下载量: 196
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 10
  • 开发语言: PHP

其他信息

  • 授权协议: BSD
  • 更新时间: 2021-09-30

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固