Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thadeu/rails-automaticlogout
❤️ Provides automatic session timeout in a Rails application.
https://github.com/thadeu/rails-automaticlogout
devise rails-application rails-automatic-logout ruby
Last synced: 11 days ago
JSON representation
❤️ Provides automatic session timeout in a Rails application.
- Host: GitHub
- URL: https://github.com/thadeu/rails-automaticlogout
- Owner: thadeu
- License: mit
- Created: 2016-12-09T17:18:43.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-04-20T21:03:02.000Z (over 7 years ago)
- Last Synced: 2024-12-17T11:23:32.795Z (17 days ago)
- Topics: devise, rails-application, rails-automatic-logout, ruby
- Language: Ruby
- Homepage:
- Size: 24.4 KB
- Stars: 11
- Watchers: 2
- Forks: 5
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Rails Automatic Logout
By Thadeu Esteves Jr.[![Gem Version](https://badge.fury.io/rb/rails-automaticlogout.png)](https://badge.fury.io/rb/rails-automaticlogout)
[![Code Climate](https://codeclimate.com/github/Thadeu/rails-automaticlogout/badges/gpa.svg)](https://codeclimate.com/github/Thadeu/rails-automaticlogout)Provides automatic session timeout in a Rails application. Very easy to install and configure. Have you ever wanted to force your users off your app if they go idle for a certain period of time? Many online banking sites use this technique. If your app is used on any kind of public computer system, this plugin is a necessity.
* Force your users power off session
* show for they the regressive time## Getting started
Rails Automatic Logout works only Rails 4. You can add it to your Gemfile with:
```ruby
gem 'rails-automaticlogout', '~> 0.1'
```Then run bundle install
## How to use?
### Configure Controller
After installing, add in your application controller, _ex:_
```ruby
class ApplicationController < ActionController::Base
before_action :authenticate_user!# by default is time 1.hour
automatic_logout_at
end
```By default the time is _1.hour_
#### Change timeout value.
```ruby
class ApplicationController < ActionController::Base
before_action :authenticate_user!# by default is time 1.hour
automatic_logout_at time: 5.minutes
end
```#### Change message
```ruby
class ApplicationController < ActionController::Base
before_action :authenticate_user!# by default is time 1.hour
automatic_logout_at time: 12.hour,
message: 'Session expired! You will be redirect.'
end
```### Configure Javascript
Add in your application.js this require```javascript
//= require automatic_logout
```
### Configure View (OPTIONAL)Use Helper in your view, for show regressive timer. Add this in your file application.html.erb
```ruby
<%= regressive_timer %>
```## TODO
* Add translations
* Add configurations for action_view
* Add Suport for Rails 5.x
* Setup test environment
* Add Tests
* Integrate automatic verification services (Travis-CI, Hakiri, CodeClimate, etc)## Contributing
We have a long list of valued contributors. Check them all at: https://github.com/Thadeu/rails-automaticlogout.