devise-multi-factor 3.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. checksums.yaml +7 -0
  2. data/.codeclimate.yml +21 -0
  3. data/.github/workflows/gem-push.yml +42 -0
  4. data/.gitignore +23 -0
  5. data/.rubocop.yml +295 -0
  6. data/.travis.yml +28 -0
  7. data/CHANGELOG.md +119 -0
  8. data/Gemfile +32 -0
  9. data/LICENSE +19 -0
  10. data/README.md +322 -0
  11. data/Rakefile +12 -0
  12. data/app/controllers/devise/totp_controller.rb +79 -0
  13. data/app/controllers/devise/two_factor_authentication_controller.rb +84 -0
  14. data/app/views/devise/two_factor_authentication/max_login_attempts_reached.html.erb +3 -0
  15. data/app/views/devise/two_factor_authentication/new.html.erb +14 -0
  16. data/app/views/devise/two_factor_authentication/show.html.erb +19 -0
  17. data/config/locales/de.yml +8 -0
  18. data/config/locales/en.yml +8 -0
  19. data/config/locales/es.yml +8 -0
  20. data/config/locales/fr.yml +8 -0
  21. data/config/locales/ru.yml +8 -0
  22. data/devise-multi-factor.gemspec +40 -0
  23. data/lib/devise-multi-factor.rb +1 -0
  24. data/lib/devise_multi_factor.rb +56 -0
  25. data/lib/devise_multi_factor/controllers/helpers.rb +57 -0
  26. data/lib/devise_multi_factor/hooks/two_factor_authenticatable.rb +17 -0
  27. data/lib/devise_multi_factor/models/totp_enrollable.rb +7 -0
  28. data/lib/devise_multi_factor/models/two_factor_authenticatable.rb +142 -0
  29. data/lib/devise_multi_factor/orm/active_record.rb +14 -0
  30. data/lib/devise_multi_factor/rails.rb +7 -0
  31. data/lib/devise_multi_factor/routes.rb +15 -0
  32. data/lib/devise_multi_factor/schema.rb +23 -0
  33. data/lib/devise_multi_factor/version.rb +3 -0
  34. data/lib/generators/active_record/devise_multi_factor_generator.rb +13 -0
  35. data/lib/generators/active_record/templates/migration.rb +11 -0
  36. data/lib/generators/devise_multi_factor/devise_multi_factor_generator.rb +17 -0
  37. data/spec/controllers/two_factor_authentication_controller_spec.rb +41 -0
  38. data/spec/features/two_factor_authenticatable_spec.rb +237 -0
  39. data/spec/generators/active_record/devise_multi_factor_generator_spec.rb +34 -0
  40. data/spec/lib/devise_multi_factor/models/two_factor_authenticatable_spec.rb +282 -0
  41. data/spec/rails_app/.gitignore +3 -0
  42. data/spec/rails_app/README.md +3 -0
  43. data/spec/rails_app/Rakefile +7 -0
  44. data/spec/rails_app/app/assets/config/manifest.js +2 -0
  45. data/spec/rails_app/app/assets/javascripts/application.js +1 -0
  46. data/spec/rails_app/app/assets/stylesheets/application.css +4 -0
  47. data/spec/rails_app/app/controllers/application_controller.rb +3 -0
  48. data/spec/rails_app/app/controllers/home_controller.rb +10 -0
  49. data/spec/rails_app/app/helpers/application_helper.rb +8 -0
  50. data/spec/rails_app/app/mailers/.gitkeep +0 -0
  51. data/spec/rails_app/app/models/.gitkeep +0 -0
  52. data/spec/rails_app/app/models/admin.rb +6 -0
  53. data/spec/rails_app/app/models/encrypted_user.rb +7 -0
  54. data/spec/rails_app/app/models/guest_user.rb +7 -0
  55. data/spec/rails_app/app/models/test_user.rb +38 -0
  56. data/spec/rails_app/app/models/user.rb +18 -0
  57. data/spec/rails_app/app/views/home/dashboard.html.erb +11 -0
  58. data/spec/rails_app/app/views/home/index.html.erb +3 -0
  59. data/spec/rails_app/app/views/layouts/application.html.erb +20 -0
  60. data/spec/rails_app/config.ru +4 -0
  61. data/spec/rails_app/config/application.rb +61 -0
  62. data/spec/rails_app/config/boot.rb +10 -0
  63. data/spec/rails_app/config/database.yml +19 -0
  64. data/spec/rails_app/config/environment.rb +5 -0
  65. data/spec/rails_app/config/environments/development.rb +28 -0
  66. data/spec/rails_app/config/environments/production.rb +68 -0
  67. data/spec/rails_app/config/environments/test.rb +41 -0
  68. data/spec/rails_app/config/initializers/backtrace_silencers.rb +7 -0
  69. data/spec/rails_app/config/initializers/cookies_serializer.rb +3 -0
  70. data/spec/rails_app/config/initializers/devise.rb +258 -0
  71. data/spec/rails_app/config/initializers/inflections.rb +15 -0
  72. data/spec/rails_app/config/initializers/mime_types.rb +5 -0
  73. data/spec/rails_app/config/initializers/secret_token.rb +7 -0
  74. data/spec/rails_app/config/initializers/session_store.rb +8 -0
  75. data/spec/rails_app/config/initializers/wrap_parameters.rb +14 -0
  76. data/spec/rails_app/config/locales/devise.en.yml +59 -0
  77. data/spec/rails_app/config/locales/en.yml +5 -0
  78. data/spec/rails_app/config/routes.rb +65 -0
  79. data/spec/rails_app/db/migrate/20140403184646_devise_create_users.rb +42 -0
  80. data/spec/rails_app/db/migrate/20140407172619_two_factor_authentication_add_to_users.rb +17 -0
  81. data/spec/rails_app/db/migrate/20140407215513_add_nickanme_to_users.rb +7 -0
  82. data/spec/rails_app/db/migrate/20151224171231_add_encrypted_columns_to_user.rb +7 -0
  83. data/spec/rails_app/db/migrate/20151224180310_populate_otp_column.rb +19 -0
  84. data/spec/rails_app/db/migrate/20151228230340_remove_otp_secret_key_from_user.rb +5 -0
  85. data/spec/rails_app/db/migrate/20160209032439_devise_create_admins.rb +42 -0
  86. data/spec/rails_app/db/schema.rb +55 -0
  87. data/spec/rails_app/lib/assets/.gitkeep +0 -0
  88. data/spec/rails_app/lib/sms_provider.rb +17 -0
  89. data/spec/rails_app/public/404.html +26 -0
  90. data/spec/rails_app/public/422.html +26 -0
  91. data/spec/rails_app/public/500.html +25 -0
  92. data/spec/rails_app/public/favicon.ico +0 -0
  93. data/spec/rails_app/script/rails +6 -0
  94. data/spec/spec_helper.rb +26 -0
  95. data/spec/support/authenticated_model_helper.rb +29 -0
  96. data/spec/support/capybara.rb +3 -0
  97. data/spec/support/controller_helper.rb +16 -0
  98. data/spec/support/features_spec_helper.rb +42 -0
  99. data/spec/support/sms_provider.rb +5 -0
  100. data/spec/support/totp_helper.rb +11 -0
  101. metadata +315 -0
@@ -0,0 +1,5 @@
1
+ RSpec.configure do |c|
2
+ c.before(:each) do
3
+ SMSProvider.messages.clear
4
+ end
5
+ 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
metadata ADDED
@@ -0,0 +1,315 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: devise-multi-factor
3
+ version: !ruby/object:Gem::Version
4
+ version: 3.1.5
5
+ platform: ruby
6
+ authors:
7
+ - Dmitrii Golub
8
+ - Alex Santos
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2021-02-22 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: 3.1.1
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: 3.1.1
28
+ - !ruby/object:Gem::Dependency
29
+ name: devise
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: randexp
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ type: :runtime
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: rotp
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: 4.0.0
63
+ type: :runtime
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: 4.0.0
70
+ - !ruby/object:Gem::Dependency
71
+ name: encryptor
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :runtime
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ - !ruby/object:Gem::Dependency
85
+ name: bundler
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ - !ruby/object:Gem::Dependency
99
+ name: rake
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ type: :development
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ - !ruby/object:Gem::Dependency
113
+ name: rspec-rails
114
+ requirement: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: 3.0.1
119
+ type: :development
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: 3.0.1
126
+ - !ruby/object:Gem::Dependency
127
+ name: capybara
128
+ requirement: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - "~>"
131
+ - !ruby/object:Gem::Version
132
+ version: '2.5'
133
+ type: :development
134
+ prerelease: false
135
+ version_requirements: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - "~>"
138
+ - !ruby/object:Gem::Version
139
+ version: '2.5'
140
+ - !ruby/object:Gem::Dependency
141
+ name: pry
142
+ requirement: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - ">="
145
+ - !ruby/object:Gem::Version
146
+ version: '0'
147
+ type: :development
148
+ prerelease: false
149
+ version_requirements: !ruby/object:Gem::Requirement
150
+ requirements:
151
+ - - ">="
152
+ - !ruby/object:Gem::Version
153
+ version: '0'
154
+ - !ruby/object:Gem::Dependency
155
+ name: rubocop
156
+ requirement: !ruby/object:Gem::Requirement
157
+ requirements:
158
+ - - ">="
159
+ - !ruby/object:Gem::Version
160
+ version: '0'
161
+ type: :development
162
+ prerelease: false
163
+ version_requirements: !ruby/object:Gem::Requirement
164
+ requirements:
165
+ - - ">="
166
+ - !ruby/object:Gem::Version
167
+ version: '0'
168
+ - !ruby/object:Gem::Dependency
169
+ name: timecop
170
+ requirement: !ruby/object:Gem::Requirement
171
+ requirements:
172
+ - - ">="
173
+ - !ruby/object:Gem::Version
174
+ version: '0'
175
+ type: :development
176
+ prerelease: false
177
+ version_requirements: !ruby/object:Gem::Requirement
178
+ requirements:
179
+ - - ">="
180
+ - !ruby/object:Gem::Version
181
+ version: '0'
182
+ description: |2
183
+ ### Features ###
184
+ * control sms code pattern
185
+ * configure max login attempts
186
+ * per user level control if he really need two factor authentication
187
+ * your own sms logic
188
+ email:
189
+ - hello@alexcsantos.com
190
+ executables: []
191
+ extensions: []
192
+ extra_rdoc_files: []
193
+ files:
194
+ - ".codeclimate.yml"
195
+ - ".github/workflows/gem-push.yml"
196
+ - ".gitignore"
197
+ - ".rubocop.yml"
198
+ - ".travis.yml"
199
+ - CHANGELOG.md
200
+ - Gemfile
201
+ - LICENSE
202
+ - README.md
203
+ - Rakefile
204
+ - app/controllers/devise/totp_controller.rb
205
+ - app/controllers/devise/two_factor_authentication_controller.rb
206
+ - app/views/devise/two_factor_authentication/max_login_attempts_reached.html.erb
207
+ - app/views/devise/two_factor_authentication/new.html.erb
208
+ - app/views/devise/two_factor_authentication/show.html.erb
209
+ - config/locales/de.yml
210
+ - config/locales/en.yml
211
+ - config/locales/es.yml
212
+ - config/locales/fr.yml
213
+ - config/locales/ru.yml
214
+ - devise-multi-factor.gemspec
215
+ - lib/devise-multi-factor.rb
216
+ - lib/devise_multi_factor.rb
217
+ - lib/devise_multi_factor/controllers/helpers.rb
218
+ - lib/devise_multi_factor/hooks/two_factor_authenticatable.rb
219
+ - lib/devise_multi_factor/models/totp_enrollable.rb
220
+ - lib/devise_multi_factor/models/two_factor_authenticatable.rb
221
+ - lib/devise_multi_factor/orm/active_record.rb
222
+ - lib/devise_multi_factor/rails.rb
223
+ - lib/devise_multi_factor/routes.rb
224
+ - lib/devise_multi_factor/schema.rb
225
+ - lib/devise_multi_factor/version.rb
226
+ - lib/generators/active_record/devise_multi_factor_generator.rb
227
+ - lib/generators/active_record/templates/migration.rb
228
+ - lib/generators/devise_multi_factor/devise_multi_factor_generator.rb
229
+ - spec/controllers/two_factor_authentication_controller_spec.rb
230
+ - spec/features/two_factor_authenticatable_spec.rb
231
+ - spec/generators/active_record/devise_multi_factor_generator_spec.rb
232
+ - spec/lib/devise_multi_factor/models/two_factor_authenticatable_spec.rb
233
+ - spec/rails_app/.gitignore
234
+ - spec/rails_app/README.md
235
+ - spec/rails_app/Rakefile
236
+ - spec/rails_app/app/assets/config/manifest.js
237
+ - spec/rails_app/app/assets/javascripts/application.js
238
+ - spec/rails_app/app/assets/stylesheets/application.css
239
+ - spec/rails_app/app/controllers/application_controller.rb
240
+ - spec/rails_app/app/controllers/home_controller.rb
241
+ - spec/rails_app/app/helpers/application_helper.rb
242
+ - spec/rails_app/app/mailers/.gitkeep
243
+ - spec/rails_app/app/models/.gitkeep
244
+ - spec/rails_app/app/models/admin.rb
245
+ - spec/rails_app/app/models/encrypted_user.rb
246
+ - spec/rails_app/app/models/guest_user.rb
247
+ - spec/rails_app/app/models/test_user.rb
248
+ - spec/rails_app/app/models/user.rb
249
+ - spec/rails_app/app/views/home/dashboard.html.erb
250
+ - spec/rails_app/app/views/home/index.html.erb
251
+ - spec/rails_app/app/views/layouts/application.html.erb
252
+ - spec/rails_app/config.ru
253
+ - spec/rails_app/config/application.rb
254
+ - spec/rails_app/config/boot.rb
255
+ - spec/rails_app/config/database.yml
256
+ - spec/rails_app/config/environment.rb
257
+ - spec/rails_app/config/environments/development.rb
258
+ - spec/rails_app/config/environments/production.rb
259
+ - spec/rails_app/config/environments/test.rb
260
+ - spec/rails_app/config/initializers/backtrace_silencers.rb
261
+ - spec/rails_app/config/initializers/cookies_serializer.rb
262
+ - spec/rails_app/config/initializers/devise.rb
263
+ - spec/rails_app/config/initializers/inflections.rb
264
+ - spec/rails_app/config/initializers/mime_types.rb
265
+ - spec/rails_app/config/initializers/secret_token.rb
266
+ - spec/rails_app/config/initializers/session_store.rb
267
+ - spec/rails_app/config/initializers/wrap_parameters.rb
268
+ - spec/rails_app/config/locales/devise.en.yml
269
+ - spec/rails_app/config/locales/en.yml
270
+ - spec/rails_app/config/routes.rb
271
+ - spec/rails_app/db/migrate/20140403184646_devise_create_users.rb
272
+ - spec/rails_app/db/migrate/20140407172619_two_factor_authentication_add_to_users.rb
273
+ - spec/rails_app/db/migrate/20140407215513_add_nickanme_to_users.rb
274
+ - spec/rails_app/db/migrate/20151224171231_add_encrypted_columns_to_user.rb
275
+ - spec/rails_app/db/migrate/20151224180310_populate_otp_column.rb
276
+ - spec/rails_app/db/migrate/20151228230340_remove_otp_secret_key_from_user.rb
277
+ - spec/rails_app/db/migrate/20160209032439_devise_create_admins.rb
278
+ - spec/rails_app/db/schema.rb
279
+ - spec/rails_app/lib/assets/.gitkeep
280
+ - spec/rails_app/lib/sms_provider.rb
281
+ - spec/rails_app/public/404.html
282
+ - spec/rails_app/public/422.html
283
+ - spec/rails_app/public/500.html
284
+ - spec/rails_app/public/favicon.ico
285
+ - spec/rails_app/script/rails
286
+ - spec/spec_helper.rb
287
+ - spec/support/authenticated_model_helper.rb
288
+ - spec/support/capybara.rb
289
+ - spec/support/controller_helper.rb
290
+ - spec/support/features_spec_helper.rb
291
+ - spec/support/sms_provider.rb
292
+ - spec/support/totp_helper.rb
293
+ homepage: https://github.com/Colex/devise_multi_factor
294
+ licenses: []
295
+ metadata: {}
296
+ post_install_message:
297
+ rdoc_options: []
298
+ require_paths:
299
+ - lib
300
+ required_ruby_version: !ruby/object:Gem::Requirement
301
+ requirements:
302
+ - - ">="
303
+ - !ruby/object:Gem::Version
304
+ version: '0'
305
+ required_rubygems_version: !ruby/object:Gem::Requirement
306
+ requirements:
307
+ - - ">="
308
+ - !ruby/object:Gem::Version
309
+ version: '0'
310
+ requirements: []
311
+ rubygems_version: 3.0.3
312
+ signing_key:
313
+ specification_version: 4
314
+ summary: Two factor authentication plugin for devise
315
+ test_files: []