two_factor_authentication 1.1.3 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +21 -0
  3. data/.gitignore +2 -0
  4. data/.rubocop.yml +295 -0
  5. data/.travis.yml +14 -7
  6. data/CHANGELOG.md +119 -0
  7. data/Gemfile +12 -3
  8. data/README.md +320 -58
  9. data/app/controllers/devise/two_factor_authentication_controller.rb +65 -25
  10. data/app/views/devise/two_factor_authentication/show.html.erb +11 -2
  11. data/config/locales/en.yml +1 -0
  12. data/config/locales/es.yml +8 -0
  13. data/config/locales/fr.yml +8 -0
  14. data/config/locales/ru.yml +1 -0
  15. data/lib/generators/active_record/templates/migration.rb +9 -11
  16. data/lib/two_factor_authentication/controllers/helpers.rb +3 -3
  17. data/lib/two_factor_authentication/hooks/two_factor_authenticatable.rb +12 -2
  18. data/lib/two_factor_authentication/models/two_factor_authenticatable.rb +158 -29
  19. data/lib/two_factor_authentication/orm/active_record.rb +2 -0
  20. data/lib/two_factor_authentication/routes.rb +3 -1
  21. data/lib/two_factor_authentication/schema.rb +24 -4
  22. data/lib/two_factor_authentication/version.rb +1 -1
  23. data/lib/two_factor_authentication.rb +20 -3
  24. data/spec/controllers/two_factor_authentication_controller_spec.rb +41 -0
  25. data/spec/features/two_factor_authenticatable_spec.rb +179 -30
  26. data/spec/generators/active_record/two_factor_authentication_generator_spec.rb +36 -0
  27. data/spec/lib/two_factor_authentication/models/two_factor_authenticatable_spec.rb +272 -114
  28. data/spec/rails_app/app/controllers/home_controller.rb +1 -1
  29. data/spec/rails_app/app/models/admin.rb +6 -0
  30. data/spec/rails_app/app/models/encrypted_user.rb +15 -0
  31. data/spec/rails_app/app/models/guest_user.rb +8 -1
  32. data/spec/rails_app/app/models/user.rb +3 -4
  33. data/spec/rails_app/config/environments/test.rb +10 -1
  34. data/spec/rails_app/config/initializers/devise.rb +5 -3
  35. data/spec/rails_app/config/routes.rb +1 -0
  36. data/spec/rails_app/db/migrate/20140403184646_devise_create_users.rb +2 -2
  37. data/spec/rails_app/db/migrate/20140407172619_two_factor_authentication_add_to_users.rb +1 -1
  38. data/spec/rails_app/db/migrate/20140407215513_add_nickanme_to_users.rb +1 -1
  39. data/spec/rails_app/db/migrate/20151224171231_add_encrypted_columns_to_user.rb +9 -0
  40. data/spec/rails_app/db/migrate/20151224180310_populate_otp_column.rb +19 -0
  41. data/spec/rails_app/db/migrate/20151228230340_remove_otp_secret_key_from_user.rb +5 -0
  42. data/spec/rails_app/db/migrate/20160209032439_devise_create_admins.rb +42 -0
  43. data/spec/rails_app/db/schema.rb +35 -18
  44. data/spec/spec_helper.rb +4 -0
  45. data/spec/support/authenticated_model_helper.rb +33 -2
  46. data/spec/support/controller_helper.rb +16 -0
  47. data/spec/support/features_spec_helper.rb +24 -1
  48. data/spec/support/totp_helper.rb +11 -0
  49. data/two_factor_authentication.gemspec +4 -2
  50. metadata +133 -30
  51. data/spec/controllers/two_factor_auth_spec.rb +0 -18
@@ -0,0 +1,42 @@
1
+ class DeviseCreateAdmins < ActiveRecord::Migration[4.2]
2
+ def change
3
+ create_table(:admins) do |t|
4
+ ## Database authenticatable
5
+ t.string :email, null: false, default: ""
6
+ t.string :encrypted_password, null: false, default: ""
7
+
8
+ ## Recoverable
9
+ t.string :reset_password_token
10
+ t.datetime :reset_password_sent_at
11
+
12
+ ## Rememberable
13
+ t.datetime :remember_created_at
14
+
15
+ ## Trackable
16
+ t.integer :sign_in_count, default: 0, null: false
17
+ t.datetime :current_sign_in_at
18
+ t.datetime :last_sign_in_at
19
+ t.string :current_sign_in_ip
20
+ t.string :last_sign_in_ip
21
+
22
+ ## Confirmable
23
+ # t.string :confirmation_token
24
+ # t.datetime :confirmed_at
25
+ # t.datetime :confirmation_sent_at
26
+ # t.string :unconfirmed_email # Only if using reconfirmable
27
+
28
+ ## Lockable
29
+ # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
30
+ # t.string :unlock_token # Only if unlock strategy is :email or :both
31
+ # t.datetime :locked_at
32
+
33
+
34
+ t.timestamps null: false
35
+ end
36
+
37
+ add_index :admins, :email, unique: true
38
+ add_index :admins, :reset_password_token, unique: true
39
+ # add_index :admins, :confirmation_token, unique: true
40
+ # add_index :admins, :unlock_token, unique: true
41
+ end
42
+ end
@@ -1,4 +1,3 @@
1
- # encoding: UTF-8
2
1
  # This file is auto-generated from the current state of the database. Instead
3
2
  # of editing this file, please use the migrations feature of Active Record to
4
3
  # incrementally modify your database, and then regenerate this schema definition.
@@ -9,30 +8,48 @@
9
8
  # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
9
  # you'll amass, the slower it'll run and the greater likelihood for issues).
11
10
  #
12
- # It's strongly recommended to check this file into your version control system.
11
+ # It's strongly recommended that you check this file into your version control system.
13
12
 
14
- ActiveRecord::Schema.define(:version => 20140407215513) do
13
+ ActiveRecord::Schema.define(version: 2016_02_09_032439) do
15
14
 
16
- create_table "users", :force => true do |t|
17
- t.string "email", :default => "", :null => false
18
- t.string "encrypted_password", :default => "", :null => false
19
- t.string "reset_password_token"
15
+ create_table "admins", force: :cascade do |t|
16
+ t.string "email", default: "", null: false
17
+ t.string "encrypted_password", default: "", null: false
18
+ t.string "reset_password_token"
20
19
  t.datetime "reset_password_sent_at"
21
20
  t.datetime "remember_created_at"
22
- t.integer "sign_in_count", :default => 0, :null => false
21
+ t.integer "sign_in_count", default: 0, null: false
23
22
  t.datetime "current_sign_in_at"
24
23
  t.datetime "last_sign_in_at"
25
- t.string "current_sign_in_ip"
26
- t.string "last_sign_in_ip"
27
- t.datetime "created_at", :null => false
28
- t.datetime "updated_at", :null => false
29
- t.string "otp_secret_key"
30
- t.integer "second_factor_attempts_count", :default => 0
31
- t.string "nickname", :limit => 64
24
+ t.string "current_sign_in_ip"
25
+ t.string "last_sign_in_ip"
26
+ t.datetime "created_at", null: false
27
+ t.datetime "updated_at", null: false
28
+ t.index ["email"], name: "index_admins_on_email", unique: true
29
+ t.index ["reset_password_token"], name: "index_admins_on_reset_password_token", unique: true
32
30
  end
33
31
 
34
- add_index "users", ["email"], :name => "index_users_on_email", :unique => true
35
- add_index "users", ["otp_secret_key"], :name => "index_users_on_otp_secret_key", :unique => true
36
- add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true
32
+ create_table "users", force: :cascade do |t|
33
+ t.string "email", default: "", null: false
34
+ t.string "encrypted_password", default: "", null: false
35
+ t.string "reset_password_token"
36
+ t.datetime "reset_password_sent_at"
37
+ t.datetime "remember_created_at"
38
+ t.integer "sign_in_count", default: 0, null: false
39
+ t.datetime "current_sign_in_at"
40
+ t.datetime "last_sign_in_at"
41
+ t.string "current_sign_in_ip"
42
+ t.string "last_sign_in_ip"
43
+ t.datetime "created_at", null: false
44
+ t.datetime "updated_at", null: false
45
+ t.integer "second_factor_attempts_count", default: 0
46
+ t.string "nickname", limit: 64
47
+ t.string "encrypted_otp_secret_key"
48
+ t.string "encrypted_otp_secret_key_iv"
49
+ t.string "encrypted_otp_secret_key_salt"
50
+ t.index ["email"], name: "index_users_on_email", unique: true
51
+ t.index ["encrypted_otp_secret_key"], name: "index_users_on_encrypted_otp_secret_key", unique: true
52
+ t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
53
+ end
37
54
 
38
55
  end
data/spec/spec_helper.rb CHANGED
@@ -2,6 +2,8 @@ ENV["RAILS_ENV"] ||= "test"
2
2
  require File.expand_path("../rails_app/config/environment.rb", __FILE__)
3
3
 
4
4
  require 'rspec/rails'
5
+ require 'timecop'
6
+ require 'rack_session_access/capybara'
5
7
 
6
8
  # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
7
9
  RSpec.configure do |config|
@@ -17,6 +19,8 @@ RSpec.configure do |config|
17
19
  # the seed, which is printed after each run.
18
20
  # --seed 1234
19
21
  config.order = 'random'
22
+
23
+ config.after(:each) { Timecop.return }
20
24
  end
21
25
 
22
26
  Dir["#{Dir.pwd}/spec/support/**/*.rb"].each {|f| require f}
@@ -1,13 +1,18 @@
1
1
  module AuthenticatedModelHelper
2
-
3
2
  def build_guest_user
4
3
  GuestUser.new
5
4
  end
6
5
 
7
- def create_user(attributes={})
6
+ def create_user(type = 'encrypted', attributes = {})
7
+ create_table_for_nonencrypted_user if type == 'not_encrypted'
8
+
8
9
  User.create!(valid_attributes(attributes))
9
10
  end
10
11
 
12
+ def create_admin
13
+ Admin.create!(valid_attributes.except(:nickname))
14
+ end
15
+
11
16
  def valid_attributes(attributes={})
12
17
  {
13
18
  nickname: 'Marissa',
@@ -23,6 +28,32 @@ module AuthenticatedModelHelper
23
28
  "user#{@@email_count}@example.com"
24
29
  end
25
30
 
31
+ def create_table_for_nonencrypted_user
32
+ ActiveRecord::Migration.suppress_messages do
33
+ ActiveRecord::Schema.define(version: 1) do
34
+ create_table 'users', force: :cascade do |t|
35
+ t.string 'email', default: '', null: false
36
+ t.string 'encrypted_password', default: '', null: false
37
+ t.string 'reset_password_token'
38
+ t.datetime 'reset_password_sent_at'
39
+ t.datetime 'remember_created_at'
40
+ t.integer 'sign_in_count', default: 0, null: false
41
+ t.datetime 'current_sign_in_at'
42
+ t.datetime 'last_sign_in_at'
43
+ t.string 'current_sign_in_ip'
44
+ t.string 'last_sign_in_ip'
45
+ t.datetime 'created_at', null: false
46
+ t.datetime 'updated_at', null: false
47
+ t.integer 'second_factor_attempts_count', default: 0
48
+ t.string 'nickname', limit: 64
49
+ t.string 'otp_secret_key'
50
+ t.string 'direct_otp'
51
+ t.datetime 'direct_otp_sent_at'
52
+ t.timestamp 'totp_timestamp'
53
+ end
54
+ end
55
+ end
56
+ end
26
57
  end
27
58
 
28
59
  RSpec.configuration.send(:include, AuthenticatedModelHelper)
@@ -0,0 +1,16 @@
1
+ module ControllerHelper
2
+ def sign_in(user = create_user('not_encrypted'))
3
+ allow(warden).to receive(:authenticated?).with(:user).and_return(true)
4
+ allow(controller).to receive(:current_user).and_return(user)
5
+ warden.session(:user)[TwoFactorAuthentication::NEED_AUTHENTICATION] = true
6
+ end
7
+ end
8
+
9
+ RSpec.configure do |config|
10
+ config.include Devise::Test::ControllerHelpers, type: :controller
11
+ config.include ControllerHelper, type: :controller
12
+
13
+ config.before(:example, type: :controller) do
14
+ @request.env['devise.mapping'] = Devise.mappings[:user]
15
+ end
16
+ end
@@ -10,10 +10,33 @@ module FeaturesSpecHelper
10
10
  fill_in "Password", with: 'password'
11
11
  find('.actions input').click # 'Sign in' or 'Log in'
12
12
  end
13
+
14
+ def set_cookie key, value
15
+ page.driver.browser.set_cookie [key, value].join('=')
16
+ end
17
+
18
+ def get_cookie key
19
+ Capybara.current_session.driver.request.cookies[key]
20
+ end
21
+
22
+ def set_tfa_cookie value
23
+ set_cookie TwoFactorAuthentication::REMEMBER_TFA_COOKIE_NAME, value
24
+ end
25
+
26
+ def get_tfa_cookie
27
+ get_cookie TwoFactorAuthentication::REMEMBER_TFA_COOKIE_NAME
28
+ end
13
29
  end
14
30
 
15
31
  RSpec.configure do |config|
16
32
  config.include Warden::Test::Helpers, type: :feature
17
33
  config.include FeaturesSpecHelper, type: :feature
18
- end
19
34
 
35
+ config.before(:each) do
36
+ Warden.test_mode!
37
+ end
38
+
39
+ config.after(:each) do
40
+ Warden.test_reset!
41
+ end
42
+ end
@@ -0,0 +1,11 @@
1
+ # Helper class to simulate a user generating TOTP codes from a secret key
2
+ class TotpHelper
3
+ def initialize(secret_key, otp_length)
4
+ @secret_key = secret_key
5
+ @otp_length = otp_length
6
+ end
7
+
8
+ def totp_code(time = Time.now)
9
+ ROTP::TOTP.new(@secret_key, digits: @otp_length).at(time)
10
+ end
11
+ end
@@ -27,11 +27,13 @@ Gem::Specification.new do |s|
27
27
  s.add_runtime_dependency 'rails', '>= 3.1.1'
28
28
  s.add_runtime_dependency 'devise'
29
29
  s.add_runtime_dependency 'randexp'
30
- s.add_runtime_dependency 'rotp'
30
+ s.add_runtime_dependency 'rotp', '>= 4.0.0'
31
+ s.add_runtime_dependency 'encryptor'
31
32
 
32
33
  s.add_development_dependency 'bundler'
33
34
  s.add_development_dependency 'rake'
34
35
  s.add_development_dependency 'rspec-rails', '>= 3.0.1'
35
- s.add_development_dependency 'capybara', '2.4.1'
36
+ s.add_development_dependency 'capybara', '~> 2.5'
36
37
  s.add_development_dependency 'pry'
38
+ s.add_development_dependency 'timecop'
37
39
  end
metadata CHANGED
@@ -1,139 +1,167 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: two_factor_authentication
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitrii Golub
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-14 00:00:00.000000000 Z
11
+ date: 2019-01-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 3.1.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 3.1.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: devise
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: randexp
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rotp
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: 4.0.0
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: 4.0.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: encryptor
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
60
74
  - !ruby/object:Gem::Version
61
75
  version: '0'
62
76
  type: :runtime
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
- - - '>='
80
+ - - ">="
67
81
  - !ruby/object:Gem::Version
68
82
  version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: bundler
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
- - - '>='
87
+ - - ">="
74
88
  - !ruby/object:Gem::Version
75
89
  version: '0'
76
90
  type: :development
77
91
  prerelease: false
78
92
  version_requirements: !ruby/object:Gem::Requirement
79
93
  requirements:
80
- - - '>='
94
+ - - ">="
81
95
  - !ruby/object:Gem::Version
82
96
  version: '0'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: rake
85
99
  requirement: !ruby/object:Gem::Requirement
86
100
  requirements:
87
- - - '>='
101
+ - - ">="
88
102
  - !ruby/object:Gem::Version
89
103
  version: '0'
90
104
  type: :development
91
105
  prerelease: false
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
- - - '>='
108
+ - - ">="
95
109
  - !ruby/object:Gem::Version
96
110
  version: '0'
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: rspec-rails
99
113
  requirement: !ruby/object:Gem::Requirement
100
114
  requirements:
101
- - - '>='
115
+ - - ">="
102
116
  - !ruby/object:Gem::Version
103
117
  version: 3.0.1
104
118
  type: :development
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
107
121
  requirements:
108
- - - '>='
122
+ - - ">="
109
123
  - !ruby/object:Gem::Version
110
124
  version: 3.0.1
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: capybara
113
127
  requirement: !ruby/object:Gem::Requirement
114
128
  requirements:
115
- - - '='
129
+ - - "~>"
116
130
  - !ruby/object:Gem::Version
117
- version: 2.4.1
131
+ version: '2.5'
118
132
  type: :development
119
133
  prerelease: false
120
134
  version_requirements: !ruby/object:Gem::Requirement
121
135
  requirements:
122
- - - '='
136
+ - - "~>"
123
137
  - !ruby/object:Gem::Version
124
- version: 2.4.1
138
+ version: '2.5'
125
139
  - !ruby/object:Gem::Dependency
126
140
  name: pry
127
141
  requirement: !ruby/object:Gem::Requirement
128
142
  requirements:
129
- - - '>='
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: timecop
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
130
158
  - !ruby/object:Gem::Version
131
159
  version: '0'
132
160
  type: :development
133
161
  prerelease: false
134
162
  version_requirements: !ruby/object:Gem::Requirement
135
163
  requirements:
136
- - - '>='
164
+ - - ">="
137
165
  - !ruby/object:Gem::Version
138
166
  version: '0'
139
167
  description: |2
@@ -148,8 +176,11 @@ executables: []
148
176
  extensions: []
149
177
  extra_rdoc_files: []
150
178
  files:
151
- - .gitignore
152
- - .travis.yml
179
+ - ".codeclimate.yml"
180
+ - ".gitignore"
181
+ - ".rubocop.yml"
182
+ - ".travis.yml"
183
+ - CHANGELOG.md
153
184
  - Gemfile
154
185
  - LICENSE
155
186
  - README.md
@@ -158,6 +189,8 @@ files:
158
189
  - app/views/devise/two_factor_authentication/max_login_attempts_reached.html.erb
159
190
  - app/views/devise/two_factor_authentication/show.html.erb
160
191
  - config/locales/en.yml
192
+ - config/locales/es.yml
193
+ - config/locales/fr.yml
161
194
  - config/locales/ru.yml
162
195
  - lib/generators/active_record/templates/migration.rb
163
196
  - lib/generators/active_record/two_factor_authentication_generator.rb
@@ -171,8 +204,9 @@ files:
171
204
  - lib/two_factor_authentication/routes.rb
172
205
  - lib/two_factor_authentication/schema.rb
173
206
  - lib/two_factor_authentication/version.rb
174
- - spec/controllers/two_factor_auth_spec.rb
207
+ - spec/controllers/two_factor_authentication_controller_spec.rb
175
208
  - spec/features/two_factor_authenticatable_spec.rb
209
+ - spec/generators/active_record/two_factor_authentication_generator_spec.rb
176
210
  - spec/lib/two_factor_authentication/models/two_factor_authenticatable_spec.rb
177
211
  - spec/rails_app/.gitignore
178
212
  - spec/rails_app/README.md
@@ -184,6 +218,8 @@ files:
184
218
  - spec/rails_app/app/helpers/application_helper.rb
185
219
  - spec/rails_app/app/mailers/.gitkeep
186
220
  - spec/rails_app/app/models/.gitkeep
221
+ - spec/rails_app/app/models/admin.rb
222
+ - spec/rails_app/app/models/encrypted_user.rb
187
223
  - spec/rails_app/app/models/guest_user.rb
188
224
  - spec/rails_app/app/models/user.rb
189
225
  - spec/rails_app/app/views/home/dashboard.html.erb
@@ -211,6 +247,10 @@ files:
211
247
  - spec/rails_app/db/migrate/20140403184646_devise_create_users.rb
212
248
  - spec/rails_app/db/migrate/20140407172619_two_factor_authentication_add_to_users.rb
213
249
  - spec/rails_app/db/migrate/20140407215513_add_nickanme_to_users.rb
250
+ - spec/rails_app/db/migrate/20151224171231_add_encrypted_columns_to_user.rb
251
+ - spec/rails_app/db/migrate/20151224180310_populate_otp_column.rb
252
+ - spec/rails_app/db/migrate/20151228230340_remove_otp_secret_key_from_user.rb
253
+ - spec/rails_app/db/migrate/20160209032439_devise_create_admins.rb
214
254
  - spec/rails_app/db/schema.rb
215
255
  - spec/rails_app/lib/assets/.gitkeep
216
256
  - spec/rails_app/lib/sms_provider.rb
@@ -222,8 +262,10 @@ files:
222
262
  - spec/spec_helper.rb
223
263
  - spec/support/authenticated_model_helper.rb
224
264
  - spec/support/capybara.rb
265
+ - spec/support/controller_helper.rb
225
266
  - spec/support/features_spec_helper.rb
226
267
  - spec/support/sms_provider.rb
268
+ - spec/support/totp_helper.rb
227
269
  - two_factor_authentication.gemspec
228
270
  homepage: https://github.com/Houdini/two_factor_authentication
229
271
  licenses: []
@@ -234,19 +276,80 @@ require_paths:
234
276
  - lib
235
277
  required_ruby_version: !ruby/object:Gem::Requirement
236
278
  requirements:
237
- - - '>='
279
+ - - ">="
238
280
  - !ruby/object:Gem::Version
239
281
  version: '0'
240
282
  required_rubygems_version: !ruby/object:Gem::Requirement
241
283
  requirements:
242
- - - '>='
284
+ - - ">="
243
285
  - !ruby/object:Gem::Version
244
286
  version: '0'
245
287
  requirements: []
246
288
  rubyforge_project: two_factor_authentication
247
- rubygems_version: 2.2.2
289
+ rubygems_version: 2.6.14
248
290
  signing_key:
249
291
  specification_version: 4
250
292
  summary: Two factor authentication plugin for devise
251
- test_files: []
252
- has_rdoc:
293
+ test_files:
294
+ - spec/controllers/two_factor_authentication_controller_spec.rb
295
+ - spec/features/two_factor_authenticatable_spec.rb
296
+ - spec/generators/active_record/two_factor_authentication_generator_spec.rb
297
+ - spec/lib/two_factor_authentication/models/two_factor_authenticatable_spec.rb
298
+ - spec/rails_app/.gitignore
299
+ - spec/rails_app/README.md
300
+ - spec/rails_app/Rakefile
301
+ - spec/rails_app/app/assets/javascripts/application.js
302
+ - spec/rails_app/app/assets/stylesheets/application.css
303
+ - spec/rails_app/app/controllers/application_controller.rb
304
+ - spec/rails_app/app/controllers/home_controller.rb
305
+ - spec/rails_app/app/helpers/application_helper.rb
306
+ - spec/rails_app/app/mailers/.gitkeep
307
+ - spec/rails_app/app/models/.gitkeep
308
+ - spec/rails_app/app/models/admin.rb
309
+ - spec/rails_app/app/models/encrypted_user.rb
310
+ - spec/rails_app/app/models/guest_user.rb
311
+ - spec/rails_app/app/models/user.rb
312
+ - spec/rails_app/app/views/home/dashboard.html.erb
313
+ - spec/rails_app/app/views/home/index.html.erb
314
+ - spec/rails_app/app/views/layouts/application.html.erb
315
+ - spec/rails_app/config.ru
316
+ - spec/rails_app/config/application.rb
317
+ - spec/rails_app/config/boot.rb
318
+ - spec/rails_app/config/database.yml
319
+ - spec/rails_app/config/environment.rb
320
+ - spec/rails_app/config/environments/development.rb
321
+ - spec/rails_app/config/environments/production.rb
322
+ - spec/rails_app/config/environments/test.rb
323
+ - spec/rails_app/config/initializers/backtrace_silencers.rb
324
+ - spec/rails_app/config/initializers/cookies_serializer.rb
325
+ - spec/rails_app/config/initializers/devise.rb
326
+ - spec/rails_app/config/initializers/inflections.rb
327
+ - spec/rails_app/config/initializers/mime_types.rb
328
+ - spec/rails_app/config/initializers/secret_token.rb
329
+ - spec/rails_app/config/initializers/session_store.rb
330
+ - spec/rails_app/config/initializers/wrap_parameters.rb
331
+ - spec/rails_app/config/locales/devise.en.yml
332
+ - spec/rails_app/config/locales/en.yml
333
+ - spec/rails_app/config/routes.rb
334
+ - spec/rails_app/db/migrate/20140403184646_devise_create_users.rb
335
+ - spec/rails_app/db/migrate/20140407172619_two_factor_authentication_add_to_users.rb
336
+ - spec/rails_app/db/migrate/20140407215513_add_nickanme_to_users.rb
337
+ - spec/rails_app/db/migrate/20151224171231_add_encrypted_columns_to_user.rb
338
+ - spec/rails_app/db/migrate/20151224180310_populate_otp_column.rb
339
+ - spec/rails_app/db/migrate/20151228230340_remove_otp_secret_key_from_user.rb
340
+ - spec/rails_app/db/migrate/20160209032439_devise_create_admins.rb
341
+ - spec/rails_app/db/schema.rb
342
+ - spec/rails_app/lib/assets/.gitkeep
343
+ - spec/rails_app/lib/sms_provider.rb
344
+ - spec/rails_app/public/404.html
345
+ - spec/rails_app/public/422.html
346
+ - spec/rails_app/public/500.html
347
+ - spec/rails_app/public/favicon.ico
348
+ - spec/rails_app/script/rails
349
+ - spec/spec_helper.rb
350
+ - spec/support/authenticated_model_helper.rb
351
+ - spec/support/capybara.rb
352
+ - spec/support/controller_helper.rb
353
+ - spec/support/features_spec_helper.rb
354
+ - spec/support/sms_provider.rb
355
+ - spec/support/totp_helper.rb
@@ -1,18 +0,0 @@
1
- require 'spec_helper'
2
-
3
- include Warden::Test::Helpers
4
-
5
- describe HomeController, :type => :controller do
6
- context "passed only 1st factor auth" do
7
- let(:user) { create_user }
8
-
9
- describe "is_fully_authenticated helper" do
10
- it "should be true" do
11
- login_as user, scope: :user
12
- visit user_two_factor_authentication_path
13
-
14
- expect(controller.is_fully_authenticated?).to be_truthy
15
- end
16
- end
17
- end
18
- end