devise_suspendable
devise_suspendable is a simple module which uses the [Devise](github.com/plataformatec/devise) authentication framework Activatable module hooks to provide a simple clean way to suspend an account. When an account is suspended the date and time of suspension is recorded, as well as an optional reason, for easy reference.
Setup
(Assumes that you have devise already setup and your device models, e.g. User, are already created)
-
Add ‘gem devise_suspendable` in your Gemfile
-
Create a migration to update each of your device model(s), e.g. User, that you want to be suspendable
rails g devise_suspendable User
-
Run the migration
rake db:migrate
-
Mark the model as suspendable
class User < ActiveRecord::Base
devise ..., :activatable, :suspendable
...
end
Notes
-
:suspendable depends on :activatable
-
This plugin is similar to Lockable and can be used along side it, as long as Lockable is using token or timeouts as the unlock strategy. Lockable is great for failed login tracking, and subsequent locking, suspendable is best for manual account suspension
-
Maintaining your active users is part and parcel of running a web app
References
-
[Devise](github.com/plataformatec/devise)
-
[Warden](github.com/hassox/warden)
Thanks to
-
Josh Kalderimis for most of core logic for this gem
-
devise_lastseenable for essentially operating as the base for this gem
-
Jeweler for making it dead simple to write this gem
Released under the MIT license
Copyright © 2010, 2011 Josh Kalderimis, Amol Kelkar