From 269f4df246a5868f6a73c8a42dd3771a7e153593 Mon Sep 17 00:00:00 2001 From: Ross Kaffenberger Date: Mon, 7 Apr 2014 13:33:03 -0400 Subject: [PATCH] install two_factor_authentication in dummy app User --- spec/dummy/app/models/user.rb | 5 +++-- ...2619_two_factor_authentication_add_to_users.rb | 15 +++++++++++++++ spec/dummy/db/schema.rb | 15 +++++++++------ 3 files changed, 27 insertions(+), 8 deletions(-) create mode 100644 spec/dummy/db/migrate/20140407172619_two_factor_authentication_add_to_users.rb diff --git a/spec/dummy/app/models/user.rb b/spec/dummy/app/models/user.rb index 5378daf..d61264f 100644 --- a/spec/dummy/app/models/user.rb +++ b/spec/dummy/app/models/user.rb @@ -1,8 +1,9 @@ class User < ActiveRecord::Base # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable and :omniauthable - devise :database_authenticatable, :registerable, - :recoverable, :rememberable, :trackable, :validatable + devise :two_factor_authenticatable, :database_authenticatable, :registerable, + :recoverable, :rememberable, :trackable, :validatable, + :two_factor_authenticatable # Setup accessible (or protected) attributes for your model attr_accessible :email, :password, :password_confirmation, :remember_me diff --git a/spec/dummy/db/migrate/20140407172619_two_factor_authentication_add_to_users.rb b/spec/dummy/db/migrate/20140407172619_two_factor_authentication_add_to_users.rb new file mode 100644 index 0000000..5720bb8 --- /dev/null +++ b/spec/dummy/db/migrate/20140407172619_two_factor_authentication_add_to_users.rb @@ -0,0 +1,15 @@ +class TwoFactorAuthenticationAddToUsers < ActiveRecord::Migration + def up + change_table :users do |t| + t.string :otp_secret_key + t.integer :second_factor_attempts_count, :default => 0 + end + + add_index :users, :otp_secret_key, :unique => true + end + + def down + remove_column :users, :otp_secret_key + remove_column :users, :second_factor_attempts_count + end +end diff --git a/spec/dummy/db/schema.rb b/spec/dummy/db/schema.rb index f70f406..e378f2b 100644 --- a/spec/dummy/db/schema.rb +++ b/spec/dummy/db/schema.rb @@ -11,24 +11,27 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20140403184646) do +ActiveRecord::Schema.define(:version => 20140407172619) do create_table "users", :force => true do |t| - t.string "email", :default => "", :null => false - t.string "encrypted_password", :default => "", :null => false + t.string "email", :default => "", :null => false + t.string "encrypted_password", :default => "", :null => false t.string "reset_password_token" t.datetime "reset_password_sent_at" t.datetime "remember_created_at" - t.integer "sign_in_count", :default => 0, :null => false + t.integer "sign_in_count", :default => 0, :null => false t.datetime "current_sign_in_at" t.datetime "last_sign_in_at" t.string "current_sign_in_ip" t.string "last_sign_in_ip" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "otp_secret_key" + t.integer "second_factor_attempts_count", :default => 0 end add_index "users", ["email"], :name => "index_users_on_email", :unique => true + add_index "users", ["otp_secret_key"], :name => "index_users_on_otp_secret_key", :unique => true add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true end