diff --git a/demo/db/migrate/20170516191259_add_lastotpat_to_users.rb b/demo/db/migrate/20170516191259_add_lastotpat_to_users.rb index c373c8c..24a0042 100644 --- a/demo/db/migrate/20170516191259_add_lastotpat_to_users.rb +++ b/demo/db/migrate/20170516191259_add_lastotpat_to_users.rb @@ -1,5 +1,5 @@ class AddLastotpatToUsers < ActiveRecord::Migration def change - add_column :users, :last_otp_at, :datetime + add_column :users, :last_otp_at, :integer end end diff --git a/demo/db/schema.rb b/demo/db/schema.rb index b08c69a..da1fc6c 100644 --- a/demo/db/schema.rb +++ b/demo/db/schema.rb @@ -34,6 +34,7 @@ t.string "encrypted_otp_secret_salt" t.integer "consumed_timestep" t.boolean "otp_required_for_login" + t.integer "last_otp_at" end add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree diff --git a/lib/devise_two_factor/spec_helpers/two_factor_authenticatable_shared_examples.rb b/lib/devise_two_factor/spec_helpers/two_factor_authenticatable_shared_examples.rb index 0177521..9065948 100644 --- a/lib/devise_two_factor/spec_helpers/two_factor_authenticatable_shared_examples.rb +++ b/lib/devise_two_factor/spec_helpers/two_factor_authenticatable_shared_examples.rb @@ -119,7 +119,7 @@ Timecop.travel(subject.otp.interval.seconds.from_now) end - # This currently fails! + # This spec tests that reuse of the OTP is not allowed it 'fails to validate' do expect(subject.validate_and_consume_otp!(consumed_otp)).to be false end diff --git a/lib/generators/devise_two_factor/devise_two_factor_generator.rb b/lib/generators/devise_two_factor/devise_two_factor_generator.rb index 655d2b7..e963f73 100644 --- a/lib/generators/devise_two_factor/devise_two_factor_generator.rb +++ b/lib/generators/devise_two_factor/devise_two_factor_generator.rb @@ -23,7 +23,7 @@ def create_devise_two_factor_migration "encrypted_otp_secret_iv:string", "encrypted_otp_secret_salt:string", "consumed_timestep:integer", - "last_otp_at:datetime", + "last_otp_at:integer", "otp_required_for_login:boolean" ]