yottaram/multi-login-restrictor 问题修复 & 功能扩展

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

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

yottaram/multi-login-restrictor

Composer 安装命令:

composer require yottaram/multi-login-restrictor

包简介

README 文档

README

Restrict users on a Laravel 4 system from logging in more than a certain number of times.

This package provides a filter to add to your Laravel routes that will log out the oldest user session for a particular user when he or she is logged in more than a set number of times.

There is a current dev dependency on Laravel 4 Generators.

Usage

Add the composer definition to your composer.json:

"yottaram/multi-login-restrictor": "dev-master"

And run composer update. When it is installed, register the service provider in app/config/app.php in the providers array:

'providers' => array(
        'Yottaram\MultiLoginRestrictor\MultiLoginRestrictorServiceProvider',
)        

Publish configuration and review settings in app/config/packages/yottaram/multi-login-restrictor/config.php:

php artisan config:publish yottaram/multi-login-restrictor

In particular, make sure the users_table property is set to the name of the users table in your application. You may also change the field on the users table that indicates how many simultaneous logins each user will be allowed. To do this edit users_num_seats_field.

Run the artisan command to generate migrations which will add a num_seats field to the users table and a users_logins table:

php artisan multi-login:make-migration

Run the migrations:

php artisan migrate

Add the multi-login-restrict filter to any route:

Route::group( [ 'before' => [ 'auth', 'multi-login-restrict' ] ], function() 

Users by default will be allowed to login at most one simultaneous time. You may change the value of num_seats for any particular user to allow his account additional simultaneous logins.

If the maximum number of logins is exceeded for a user, the oldest user session that logged in will be logged out and Redirected to '/'.

TODO - configure the route a user is sent to when logged out.

TODO - if request is made via Ajax, then just send a 403 response.

统计信息

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

GitHub 信息

  • Stars: 6
  • Watchers: 0
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2014-11-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固