定制 omarpre/idle-timeout 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

omarpre/idle-timeout

Composer 安装命令:

composer require omarpre/idle-timeout

包简介

A Laravel package for alerting idle sessions about to expire - FORKED

README 文档

README

A Laravel package for alerting idle sessions about to expire.

SESSION_LIFETIME is great but how is the user supposed to know when the session is about to expire due to inactivity, especially if it is a low value? Furthermore, a user may be actively engaging the site (by clicking around or filling out a form) without ever sending a request to the backend. Laravel may end the session during this time without the user knowing.

When the session is about to expire, show a dialog so the user can choose not to be logged out.

How it works

This code doesn't actually log the user out. It still relies on Laravel's mechanism for expiring sessions. All it does is periodically check how much time before the session will expire and alert the user when it is almost time.

A demo library is at omarpre/idle-timeout-alert-demo

Installation

Laravel package and NPM dependencies

composer require omarpre/idle-timeout-alert
npm install --save idle-vue

Usage

Disable "Remember Me" functionality

Step 1: Add the following line to app/User.php:

protected $rememberTokenName = false;

Step 2: Remove the "Remember Me" checkbox from your login form

Publish and compile assets

Step 1: Publish assets to vendor folder:

php artisan vendor:publish --provider="omarpre\IdleTimeoutAlert\IdleTimeoutAlertServiceProvider" --tag="vue-components"

Step 2: Add the following to your application's resources/js/app.js. Place within section where components are registered:

require('./../assets/vendor/omarpre/idle-timeout-alert/js/app');

Step 3: Compile

npm run dev

Add component

Finally, add the component to any page where you would like the dialog. A good place is layouts/app.blade.php.

<timeout-dialog></timeout-dialog>

By default the dialog will only appear if the user happens to be idle when the session is about to expire. As long as user has activity, a ping will be sent in the background keeping the session alive.

If you would like to ignore user activity and have the dialog appear no matter what, then use the following:

<timeout-dialog v-bind:ignore-activity="true"></timeout-dialog>

If you want to allow a user to be on a particular page forever without ever timing out, then use the following:

<timeout-dialog v-bind:keep-alive="true"></timeout-dialog>

As long as user is on the page, a ping will be sent in the background keeping the session alive and no dialog will ever appear.

Customization

Feel free to make changes to the dialog in resources/assets/vendor/omarpre/idle-timeout-alert/js/components/TimeoutDialog.vue. Don't forget to recompile assets afterward!

omarpre/idle-timeout 适用场景与选型建议

omarpre/idle-timeout 是一款 基于 Vue 开发的 Composer 扩展包,目前已累计 169 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 09 月 16 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 omarpre/idle-timeout 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 omarpre/idle-timeout 我们能提供哪些服务?
定制开发 / 二次开发

基于 omarpre/idle-timeout 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: Vue

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-09-16