Add and tune devise lockable strategy. Refs #270
This commit is contained in:
parent
81d18b5337
commit
8b252d8c14
|
@ -14,7 +14,7 @@ class User < ActiveRecord::Base
|
|||
validates_inclusion_of :avatar_file_size, :in => (0..MAX_AVATAR_SIZE), :allow_nil => true
|
||||
|
||||
devise :database_authenticatable, :registerable, #:omniauthable, # :token_authenticatable, :encryptable, :timeoutable
|
||||
:recoverable, :rememberable, :validatable #, :trackable, :confirmable, :lockable
|
||||
:recoverable, :rememberable, :validatable, :lockable #, :trackable, :confirmable
|
||||
|
||||
has_one :notifier, :class_name => 'Settings::Notifier', :dependent => :destroy #:notifier
|
||||
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
class AddDeviseLockable < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :users, :failed_attempts, :integer, :default => 0 # Only if lock strategy is :failed_attempts
|
||||
add_column :users, :unlock_token, :string # Only if unlock strategy is :email or :both
|
||||
add_column :users, :locked_at, :datetime
|
||||
add_index :users, :unlock_token, :unique => true
|
||||
end
|
||||
end
|
14
db/schema.rb
14
db/schema.rb
|
@ -11,14 +11,14 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20120320102912) do
|
||||
ActiveRecord::Schema.define(:version => 20120321130436) do
|
||||
|
||||
create_table "activity_feeds", :force => true do |t|
|
||||
t.integer "user_id", :null => false
|
||||
t.string "kind"
|
||||
t.text "data"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "arches", :force => true do |t|
|
||||
|
@ -370,16 +370,16 @@ ActiveRecord::Schema.define(:version => 20120320102912) do
|
|||
t.string "name"
|
||||
t.string "email", :default => "", :null => false
|
||||
t.string "encrypted_password", :limit => 128, :default => "", :null => false
|
||||
t.string "password_salt", :default => "", :null => false
|
||||
t.string "reset_password_token"
|
||||
t.datetime "remember_created_at"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.text "ssh_key"
|
||||
t.string "uname"
|
||||
t.string "role"
|
||||
t.string "language", :default => "en"
|
||||
t.integer "own_projects_count", :default => 0, :null => false
|
||||
t.datetime "reset_password_sent_at"
|
||||
t.integer "own_projects_count", :default => 0, :null => false
|
||||
t.text "professional_experience"
|
||||
t.string "site"
|
||||
t.string "company"
|
||||
|
@ -388,10 +388,14 @@ ActiveRecord::Schema.define(:version => 20120320102912) do
|
|||
t.string "avatar_content_type"
|
||||
t.integer "avatar_file_size"
|
||||
t.datetime "avatar_updated_at"
|
||||
t.integer "failed_attempts", :default => 0
|
||||
t.string "unlock_token"
|
||||
t.datetime "locked_at"
|
||||
end
|
||||
|
||||
add_index "users", ["email"], :name => "index_users_on_email", :unique => true
|
||||
add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true
|
||||
add_index "users", ["uname"], :name => "index_users_on_uname", :unique => true
|
||||
add_index "users", ["unlock_token"], :name => "index_users_on_unlock_token", :unique => true
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue