Browse Source

Adding unique index to otp secret key.

This prevents the potential of a leaking of a single secret key from effecting others.
master
Matt Mueller 11 years ago
parent
commit
af6e150124
  1. 2
      lib/generators/active_record/templates/migration.rb

2
lib/generators/active_record/templates/migration.rb

@ -4,6 +4,8 @@ class TwoFactorAuthenticationAddTo<%= table_name.camelize %> < ActiveRecord::Mig
t.string :otp_secret_key t.string :otp_secret_key
t.integer :second_factor_attempts_count, :default => 0 t.integer :second_factor_attempts_count, :default => 0
end end
add_index :<%= table_name %>, :otp_secret_key, :unique => true
end end
def down def down

Loading…
Cancel
Save