devise_two_factor_authentication 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/tests.yml +42 -0
  3. data/.gitignore +23 -0
  4. data/.rubocop.yml +293 -0
  5. data/CHANGELOG.md +119 -0
  6. data/Gemfile +35 -0
  7. data/LICENSE +19 -0
  8. data/README.md +401 -0
  9. data/Rakefile +16 -0
  10. data/app/controllers/devise/two_factor_authentication_controller.rb +88 -0
  11. data/app/views/devise/two_factor_authentication/max_login_attempts_reached.html.erb +3 -0
  12. data/app/views/devise/two_factor_authentication/show.html.erb +19 -0
  13. data/config/locales/de.yml +8 -0
  14. data/config/locales/en.yml +8 -0
  15. data/config/locales/es.yml +8 -0
  16. data/config/locales/fr.yml +8 -0
  17. data/config/locales/ru.yml +8 -0
  18. data/devise_two_factor_authentication.gemspec +40 -0
  19. data/lib/devise_two_factor_authentication/controllers/helpers.rb +54 -0
  20. data/lib/devise_two_factor_authentication/hooks/two_factor_authenticatable.rb +17 -0
  21. data/lib/devise_two_factor_authentication/models/two_factor_authenticatable.rb +206 -0
  22. data/lib/devise_two_factor_authentication/orm/active_record.rb +14 -0
  23. data/lib/devise_two_factor_authentication/rails.rb +7 -0
  24. data/lib/devise_two_factor_authentication/routes.rb +19 -0
  25. data/lib/devise_two_factor_authentication/schema.rb +31 -0
  26. data/lib/devise_two_factor_authentication/version.rb +3 -0
  27. data/lib/devise_two_factor_authentication.rb +52 -0
  28. data/lib/generators/active_record/templates/migration.rb +15 -0
  29. data/lib/generators/active_record/two_factor_authentication_generator.rb +14 -0
  30. data/lib/generators/two_factor_authentication/two_factor_authentication_generator.rb +17 -0
  31. data/spec/controllers/two_factor_authentication_controller_spec.rb +41 -0
  32. data/spec/features/two_factor_authenticatable_spec.rb +236 -0
  33. data/spec/generators/active_record/two_factor_authentication_generator_spec.rb +36 -0
  34. data/spec/lib/two_factor_authentication/models/two_factor_authenticatable_spec.rb +326 -0
  35. data/spec/rails_app/.gitignore +3 -0
  36. data/spec/rails_app/README.md +3 -0
  37. data/spec/rails_app/Rakefile +9 -0
  38. data/spec/rails_app/app/assets/config/manifest.js +2 -0
  39. data/spec/rails_app/app/assets/javascripts/application.js +1 -0
  40. data/spec/rails_app/app/assets/stylesheets/application.css +4 -0
  41. data/spec/rails_app/app/controllers/application_controller.rb +3 -0
  42. data/spec/rails_app/app/controllers/home_controller.rb +10 -0
  43. data/spec/rails_app/app/helpers/application_helper.rb +8 -0
  44. data/spec/rails_app/app/mailers/.gitkeep +0 -0
  45. data/spec/rails_app/app/models/.gitkeep +0 -0
  46. data/spec/rails_app/app/models/admin.rb +6 -0
  47. data/spec/rails_app/app/models/encrypted_user.rb +15 -0
  48. data/spec/rails_app/app/models/guest_user.rb +17 -0
  49. data/spec/rails_app/app/models/user.rb +14 -0
  50. data/spec/rails_app/app/views/home/dashboard.html.erb +11 -0
  51. data/spec/rails_app/app/views/home/index.html.erb +3 -0
  52. data/spec/rails_app/app/views/layouts/application.html.erb +20 -0
  53. data/spec/rails_app/config/application.rb +64 -0
  54. data/spec/rails_app/config/boot.rb +10 -0
  55. data/spec/rails_app/config/database.yml +19 -0
  56. data/spec/rails_app/config/environment.rb +5 -0
  57. data/spec/rails_app/config/environments/development.rb +28 -0
  58. data/spec/rails_app/config/environments/production.rb +68 -0
  59. data/spec/rails_app/config/environments/test.rb +41 -0
  60. data/spec/rails_app/config/initializers/backtrace_silencers.rb +7 -0
  61. data/spec/rails_app/config/initializers/cookies_serializer.rb +3 -0
  62. data/spec/rails_app/config/initializers/devise.rb +258 -0
  63. data/spec/rails_app/config/initializers/inflections.rb +15 -0
  64. data/spec/rails_app/config/initializers/mime_types.rb +5 -0
  65. data/spec/rails_app/config/initializers/secret_token.rb +7 -0
  66. data/spec/rails_app/config/initializers/session_store.rb +8 -0
  67. data/spec/rails_app/config/initializers/wrap_parameters.rb +14 -0
  68. data/spec/rails_app/config/locales/devise.en.yml +59 -0
  69. data/spec/rails_app/config/locales/en.yml +5 -0
  70. data/spec/rails_app/config/routes.rb +65 -0
  71. data/spec/rails_app/config.ru +4 -0
  72. data/spec/rails_app/db/migrate/20140403184646_devise_create_users.rb +42 -0
  73. data/spec/rails_app/db/migrate/20140407172619_two_factor_authentication_add_to_users.rb +15 -0
  74. data/spec/rails_app/db/migrate/20140407215513_add_nickanme_to_users.rb +7 -0
  75. data/spec/rails_app/db/migrate/20151224171231_add_encrypted_columns_to_user.rb +9 -0
  76. data/spec/rails_app/db/migrate/20151224180310_populate_otp_column.rb +19 -0
  77. data/spec/rails_app/db/migrate/20151228230340_remove_otp_secret_key_from_user.rb +5 -0
  78. data/spec/rails_app/db/migrate/20160209032439_devise_create_admins.rb +42 -0
  79. data/spec/rails_app/db/schema.rb +54 -0
  80. data/spec/rails_app/lib/assets/.gitkeep +0 -0
  81. data/spec/rails_app/lib/sms_provider.rb +17 -0
  82. data/spec/rails_app/public/404.html +26 -0
  83. data/spec/rails_app/public/422.html +26 -0
  84. data/spec/rails_app/public/500.html +25 -0
  85. data/spec/rails_app/public/favicon.ico +0 -0
  86. data/spec/rails_app/script/rails +9 -0
  87. data/spec/spec_helper.rb +27 -0
  88. data/spec/support/authenticated_model_helper.rb +59 -0
  89. data/spec/support/capybara.rb +3 -0
  90. data/spec/support/controller_helper.rb +16 -0
  91. data/spec/support/features_spec_helper.rb +42 -0
  92. data/spec/support/sms_provider.rb +5 -0
  93. data/spec/support/totp_helper.rb +11 -0
  94. metadata +294 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: cc1eedecf1041752af96cb9f193352b2fd6efd7a7b4326174ff5657e5ddd8614
4
+ data.tar.gz: '03680afadce61b1da7ef90444602c93a11eff7d97ff0a5ac9b86f28bf76a5fe2'
5
+ SHA512:
6
+ metadata.gz: 47bcb6d95408b88b7b5d7fa86f61bc8e6df39859bc96c96f72941adaf00af0dab03544a572e126ee4ff4832c8c8cdaa1bdc595d022eff24382458f8c831d3a71
7
+ data.tar.gz: 183d95d6fcf4ca1d84262989df4329d156e04fe49a2d812486a10d63c086c10016c6d82fd7691497729e046f28ebe13e180084fbafa949d7554d2e84b502004b
@@ -0,0 +1,42 @@
1
+ name: 'CI/CD Pipeline'
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ pull_request:
8
+ workflow_dispatch:
9
+
10
+ defaults:
11
+ run:
12
+ shell: bash
13
+
14
+ jobs:
15
+
16
+ test:
17
+ name: Test
18
+ runs-on: ubuntu-latest
19
+
20
+ env:
21
+ RAILS_ENV: test
22
+ GEMFILE_RUBY_VERSION: 3.0.3
23
+
24
+ # Rails verifies the time zone in DB is the same as the time zone of the Rails app
25
+ TZ: "Europe/London"
26
+
27
+
28
+ steps:
29
+ - name: Checkout
30
+ uses: actions/checkout@v2
31
+
32
+ - name: Set up Ruby
33
+ uses: ruby/setup-ruby@v1
34
+ with:
35
+ ruby-version: 3.0.3
36
+ # runs 'bundle install' and caches installed gems automatically
37
+ bundler-cache: true
38
+
39
+ - name: Run tests
40
+ run: |
41
+ bundle exec rake spec
42
+
data/.gitignore ADDED
@@ -0,0 +1,23 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
5
+
6
+ # Temporary files of every sort
7
+ .DS_Store
8
+ .idea
9
+ .rvmrc
10
+ .stgit*
11
+ *.swap
12
+ *.swo
13
+ *.swp
14
+ *~
15
+ bin/*
16
+ nbproject
17
+ patches-*
18
+ capybara-*.html
19
+ dump.rdb
20
+ *.ids
21
+ .rbenv-version
22
+ .ruby-gemset
23
+ .ruby-version
data/.rubocop.yml ADDED
@@ -0,0 +1,293 @@
1
+ AllCops:
2
+ Include:
3
+ - '**/Gemfile'
4
+ - '**/Rakefile'
5
+ UseCache: true
6
+
7
+ Layout/LineLength:
8
+ Description: Limit lines to 80 characters.
9
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#80-character-limits
10
+ Enabled: true
11
+ Max: 100
12
+ AllowURI: true
13
+ URISchemes:
14
+ - http
15
+ - https
16
+ Layout/DotPosition:
17
+ Description: Checks the position of the dot in multi-line method calls.
18
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains
19
+ Enabled: true
20
+ EnforcedStyle: trailing
21
+ SupportedStyles:
22
+ - leading
23
+ - trailing
24
+
25
+ Lint/AssignmentInCondition:
26
+ Description: Don't use assignment in conditions.
27
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#safe-assignment-in-condition
28
+ Enabled: true
29
+ AllowSafeAssignment: true
30
+ Lint/EachWithObjectArgument:
31
+ Description: Check for immutable argument given to each_with_object.
32
+ Enabled: true
33
+ Lint/SuppressedException:
34
+ Description: Don't suppress exception.
35
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#dont-hide-exceptions
36
+ Enabled: true
37
+ Lint/LiteralAsCondition:
38
+ Description: Checks of literals used in conditions.
39
+ Enabled: true
40
+ Lint/LiteralInInterpolation:
41
+ Description: Checks for literals used in interpolation.
42
+ Enabled: true
43
+ Lint/ParenthesesAsGroupedExpression:
44
+ Description: Checks for method calls with a space before the opening parenthesis.
45
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#parens-no-spaces
46
+ Enabled: true
47
+
48
+ Metrics/AbcSize:
49
+ Description: A calculated magnitude based on number of assignments, branches, and
50
+ conditions.
51
+ Enabled: true
52
+ Max: 15
53
+ Exclude:
54
+ - spec/**/*
55
+ Metrics/ClassLength:
56
+ Description: Avoid classes longer than 100 lines of code.
57
+ Enabled: true
58
+ CountComments: false
59
+ Max: 100
60
+ Exclude:
61
+ - spec/**/*
62
+ Metrics/CyclomaticComplexity:
63
+ Description: A complexity metric that is strongly correlated to the number of test
64
+ cases needed to validate a method.
65
+ Enabled: true
66
+ Max: 6
67
+ Metrics/MethodLength:
68
+ Description: Avoid methods longer than 10 lines of code.
69
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#short-methods
70
+ Enabled: true
71
+ CountComments: false
72
+ Max: 10
73
+ Exclude:
74
+ - spec/**/*
75
+ Metrics/ModuleLength:
76
+ CountComments: false
77
+ Max: 100
78
+ Description: Avoid modules longer than 100 lines of code.
79
+ Enabled: true
80
+ Exclude:
81
+ - spec/**/*
82
+ Metrics/ParameterLists:
83
+ Description: Avoid parameter lists longer than three or four parameters.
84
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#too-many-params
85
+ Enabled: true
86
+ Max: 5
87
+ CountKeywordArgs: true
88
+ Metrics/PerceivedComplexity:
89
+ Description: A complexity metric geared towards measuring complexity for a human
90
+ reader.
91
+ Enabled: true
92
+ Max: 7
93
+
94
+ Naming/AccessorMethodName:
95
+ Description: Check the naming of accessor methods for get_/set_.
96
+ Enabled: false
97
+ Naming/FileName:
98
+ Description: Use snake_case for source file names.
99
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#snake-case-files
100
+ Enabled: true
101
+ Exclude: []
102
+ Naming/PredicateName:
103
+ Description: Check the names of predicate methods.
104
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#bool-methods-qmark
105
+ Enabled: true
106
+ NamePrefix:
107
+ - is_
108
+ - has_
109
+ - have_
110
+ ForbiddenPrefixes:
111
+ - is_
112
+ Exclude:
113
+ - spec/**/*
114
+
115
+ Style/AndOr:
116
+ Description: Use &&/|| instead of and/or.
117
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-and-or-or
118
+ Enabled: true
119
+ EnforcedStyle: conditionals
120
+ SupportedStyles:
121
+ - always
122
+ - conditionals
123
+ Style/Alias:
124
+ Description: Use alias_method instead of alias.
125
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#alias-method
126
+ Enabled: true
127
+ Style/ClassAndModuleChildren:
128
+ EnforcedStyle: nested
129
+ SupportedStyles:
130
+ - nested
131
+ - compact
132
+ Style/CollectionMethods:
133
+ Description: Preferred collection methods.
134
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#map-find-select-reduce-size
135
+ Enabled: true
136
+ PreferredMethods:
137
+ collect: map
138
+ collect!: map!
139
+ find: detect
140
+ find_all: select
141
+ reduce: inject
142
+ Style/Documentation:
143
+ Description: Document classes and non-namespace modules.
144
+ Enabled: false
145
+ Style/DoubleNegation:
146
+ Description: Checks for uses of double negation (!!).
147
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-bang-bang
148
+ Enabled: true
149
+ Style/EachWithObject:
150
+ Description: Prefer `each_with_object` over `inject` or `reduce`.
151
+ Enabled: true
152
+ Style/EmptyLiteral:
153
+ Description: Prefer literals to Array.new/Hash.new/String.new.
154
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#literal-array-hash
155
+ Enabled: true
156
+ Style/GuardClause:
157
+ Description: Check for conditionals that can be replaced with guard clauses
158
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals
159
+ Enabled: true
160
+ MinBodyLength: 1
161
+ Style/IfUnlessModifier:
162
+ Description: Favor modifier if/unless usage when you have a single-line body.
163
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#if-as-a-modifier
164
+ Enabled: false
165
+ Style/InlineComment:
166
+ Description: Avoid inline comments.
167
+ Enabled: false
168
+ Style/ModuleFunction:
169
+ Description: Checks for usage of `extend self` in modules.
170
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#module-function
171
+ Enabled: false
172
+ Style/OneLineConditional:
173
+ Description: Favor the ternary operator(?:) over if/then/else/end constructs.
174
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#ternary-operator
175
+ Enabled: false
176
+ Style/OptionHash:
177
+ Description: Don't use option hashes when you can use keyword arguments.
178
+ Enabled: false
179
+ Style/PercentLiteralDelimiters:
180
+ Description: Use `%`-literal delimiters consistently
181
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#percent-literal-braces
182
+ Enabled: true
183
+ PreferredDelimiters:
184
+ "%": "()"
185
+ "%i": "()"
186
+ "%q": "()"
187
+ "%Q": "()"
188
+ "%r": "{}"
189
+ "%s": "()"
190
+ "%w": "()"
191
+ "%W": "()"
192
+ "%x": "()"
193
+ Style/PerlBackrefs:
194
+ Description: Avoid Perl-style regex back references.
195
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-perl-regexp-last-matchers
196
+ Enabled: false
197
+ Style/RaiseArgs:
198
+ Description: Checks the arguments passed to raise/fail.
199
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#exception-class-messages
200
+ Enabled: true
201
+ EnforcedStyle: exploded
202
+ SupportedStyles:
203
+ - compact
204
+ - exploded
205
+ Style/Send:
206
+ Description: Prefer `Object#__send__` or `Object#public_send` to `send`, as `send`
207
+ may overlap with existing methods.
208
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#prefer-public-send
209
+ Enabled: false
210
+ Style/SignalException:
211
+ Description: Checks for proper usage of fail and raise.
212
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#fail-method
213
+ Enabled: true
214
+ EnforcedStyle: semantic
215
+ SupportedStyles:
216
+ - only_raise
217
+ - only_fail
218
+ - semantic
219
+ Style/SingleLineBlockParams:
220
+ Description: Enforces the names of some block params.
221
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#reduce-blocks
222
+ Enabled: true
223
+ Methods:
224
+ - reduce:
225
+ - a
226
+ - e
227
+ - inject:
228
+ - a
229
+ - e
230
+ Style/SingleLineMethods:
231
+ Description: Avoid single-line methods.
232
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-single-line-methods
233
+ Enabled: true
234
+ AllowIfMethodIsEmpty: true
235
+ Style/SpecialGlobalVars:
236
+ Description: Avoid Perl-style global variables.
237
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-cryptic-perlisms
238
+ Enabled: false
239
+ Style/StringLiterals:
240
+ Description: Checks if uses of quotes match the configured preference.
241
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#consistent-string-literals
242
+ Enabled: true
243
+ EnforcedStyle: single_quotes
244
+ SupportedStyles:
245
+ - single_quotes
246
+ - double_quotes
247
+ Style/StringLiteralsInInterpolation:
248
+ Description: Checks if uses of quotes inside expressions in interpolated strings
249
+ match the configured preference.
250
+ Enabled: true
251
+ EnforcedStyle: single_quotes
252
+ SupportedStyles:
253
+ - single_quotes
254
+ - double_quotes
255
+ Style/TrailingCommaInArguments:
256
+ Description: 'Checks for trailing comma in argument lists.'
257
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
258
+ Enabled: true
259
+ EnforcedStyleForMultiline: no_comma
260
+ SupportedStyles:
261
+ - comma
262
+ - consistent_comma
263
+ - no_comma
264
+ Style/TrailingCommaInArrayLiteral:
265
+ Description: 'Checks for trailing comma in array and hash literals.'
266
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
267
+ Enabled: true
268
+ EnforcedStyleForMultiline: no_comma
269
+ SupportedStyles:
270
+ - comma
271
+ - consistent_comma
272
+ - no_comma
273
+ Style/TrailingCommaInHashLiteral:
274
+ Description: 'Checks for trailing comma in array and hash literals.'
275
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
276
+ Enabled: true
277
+ EnforcedStyleForMultiline: no_comma
278
+ SupportedStyles:
279
+ - comma
280
+ - consistent_comma
281
+ - no_comma
282
+ Style/VariableInterpolation:
283
+ Description: Don't interpolate global, instance and class variables directly in
284
+ strings.
285
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#curlies-interpolate
286
+ Enabled: false
287
+ Style/WhenThen:
288
+ Description: Use when x then ... for one-line cases.
289
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#one-line-cases
290
+ Enabled: false
291
+ Style/ZeroLengthPredicate:
292
+ Description: 'Use #empty? when testing for objects of length 0.'
293
+ Enabled: true
data/CHANGELOG.md ADDED
@@ -0,0 +1,119 @@
1
+ # Change Log
2
+
3
+ ## [Unreleased](https://github.com/Houdini/two_factor_authentication/tree/HEAD)
4
+
5
+ [Full Changelog](https://github.com/Houdini/two_factor_authentication/compare/v1.1.5...HEAD)
6
+
7
+ **Merged pull requests:**
8
+
9
+ - Fix class detection in reset\_otp\_state\_for\(user\) [\#69](https://github.com/Houdini/two_factor_authentication/pull/69) ([monfresh](https://github.com/monfresh))
10
+ - Add ability to resend code [\#52](https://github.com/Houdini/two_factor_authentication/pull/52) ([iDiogenes](https://github.com/iDiogenes))
11
+
12
+ ## [v1.1.5](https://github.com/Houdini/two_factor_authentication/tree/v1.1.5) (2016-02-01)
13
+ [Full Changelog](https://github.com/Houdini/two_factor_authentication/compare/v1.1.4...v1.1.5)
14
+
15
+ **Closed issues:**
16
+
17
+ - How should I integrate Devise two factor authentication with custom sessions controller? [\#60](https://github.com/Houdini/two_factor_authentication/issues/60)
18
+
19
+ **Merged pull requests:**
20
+
21
+ - added french translation [\#68](https://github.com/Houdini/two_factor_authentication/pull/68) ([qsypoq](https://github.com/qsypoq))
22
+ - Drop support for Ruby 1.9.3 & update .travis.yml [\#67](https://github.com/Houdini/two_factor_authentication/pull/67) ([monfresh](https://github.com/monfresh))
23
+ - Fix reset\_otp\_state specs [\#66](https://github.com/Houdini/two_factor_authentication/pull/66) ([monfresh](https://github.com/monfresh))
24
+ - Add a CHANGELOG.md [\#65](https://github.com/Houdini/two_factor_authentication/pull/65) ([monfresh](https://github.com/monfresh))
25
+ - Update bundler on Travis before installing gems [\#63](https://github.com/Houdini/two_factor_authentication/pull/63) ([monfresh](https://github.com/monfresh))
26
+ - Add support for OTP secret key encryption [\#62](https://github.com/Houdini/two_factor_authentication/pull/62) ([monfresh](https://github.com/monfresh))
27
+ - Allow executing code after sign in and before sign out [\#61](https://github.com/Houdini/two_factor_authentication/pull/61) ([monfresh](https://github.com/monfresh))
28
+
29
+ ## [v1.1.4](https://github.com/Houdini/two_factor_authentication/tree/v1.1.4) (2016-01-01)
30
+ [Full Changelog](https://github.com/Houdini/two_factor_authentication/compare/v1.1.3...v1.1.4)
31
+
32
+ **Closed issues:**
33
+
34
+ - Old OTP can be used after a new one has been generated [\#59](https://github.com/Houdini/two_factor_authentication/issues/59)
35
+ - Do we have any two\_factor\_method like authenticate\_user! [\#58](https://github.com/Houdini/two_factor_authentication/issues/58)
36
+ - Configuration [\#57](https://github.com/Houdini/two_factor_authentication/issues/57)
37
+
38
+ **Merged pull requests:**
39
+
40
+ - Abstract logic for two factor success and fail into separate methods.… [\#56](https://github.com/Houdini/two_factor_authentication/pull/56) ([kpheasey](https://github.com/kpheasey))
41
+ - Move require rotp library to the file where it is used [\#55](https://github.com/Houdini/two_factor_authentication/pull/55) ([gkopylov](https://github.com/gkopylov))
42
+ - Add support for remembering a user's 2FA session in a cookie [\#54](https://github.com/Houdini/two_factor_authentication/pull/54) ([boffbowsh](https://github.com/boffbowsh))
43
+ - Test against Ruby 2.2 and Rails 4.2 [\#53](https://github.com/Houdini/two_factor_authentication/pull/53) ([boffbowsh](https://github.com/boffbowsh))
44
+ - Eliminates appended '?' to redirects that have no query string [\#46](https://github.com/Houdini/two_factor_authentication/pull/46) ([daveriess](https://github.com/daveriess))
45
+
46
+ ## [v1.1.3](https://github.com/Houdini/two_factor_authentication/tree/v1.1.3) (2014-12-14)
47
+ [Full Changelog](https://github.com/Houdini/two_factor_authentication/compare/v1.1.2...v1.1.3)
48
+
49
+ **Closed issues:**
50
+
51
+ - rails g two\_factor\_authentication MODEL does not append .rb to end of migration [\#40](https://github.com/Houdini/two_factor_authentication/issues/40)
52
+
53
+ **Merged pull requests:**
54
+
55
+ - Allows length of OTP to be configured [\#44](https://github.com/Houdini/two_factor_authentication/pull/44) ([amoose](https://github.com/amoose))
56
+ - Missing translation. [\#43](https://github.com/Houdini/two_factor_authentication/pull/43) ([sadfuzzy](https://github.com/sadfuzzy))
57
+ - Preserve query parameters in \_return\_to for redirect. [\#42](https://github.com/Houdini/two_factor_authentication/pull/42) ([omb-awong](https://github.com/omb-awong))
58
+ - Add file extension to ActiveRecord generator [\#41](https://github.com/Houdini/two_factor_authentication/pull/41) ([jackturnbull](https://github.com/jackturnbull))
59
+
60
+ ## [v1.1.2](https://github.com/Houdini/two_factor_authentication/tree/v1.1.2) (2014-07-14)
61
+ [Full Changelog](https://github.com/Houdini/two_factor_authentication/compare/v1.1.1...v1.1.2)
62
+
63
+ **Closed issues:**
64
+
65
+ - NoMethodError \(undefined method `scan' for nil:NilClass\) [\#37](https://github.com/Houdini/two_factor_authentication/issues/37)
66
+
67
+ **Merged pull requests:**
68
+
69
+ - Updated readme with rake task to update existing users with OTP secret k... [\#39](https://github.com/Houdini/two_factor_authentication/pull/39) ([Znow](https://github.com/Znow))
70
+ - Updated readme with view overriding [\#38](https://github.com/Houdini/two_factor_authentication/pull/38) ([Znow](https://github.com/Znow))
71
+
72
+ ## [v1.1.1](https://github.com/Houdini/two_factor_authentication/tree/v1.1.1) (2014-05-31)
73
+ [Full Changelog](https://github.com/Houdini/two_factor_authentication/compare/v1.1...v1.1.1)
74
+
75
+ **Closed issues:**
76
+
77
+ - Override views [\#36](https://github.com/Houdini/two_factor_authentication/issues/36)
78
+ - NoMethodError in Devise::TwoFactorAuthenticationController\#update [\#30](https://github.com/Houdini/two_factor_authentication/issues/30)
79
+
80
+ **Merged pull requests:**
81
+
82
+ - Use Strings and not Symbols for keys when storing variable in warden session [\#35](https://github.com/Houdini/two_factor_authentication/pull/35) ([karolsarnacki](https://github.com/karolsarnacki))
83
+ - Chore/extract reused hash key [\#34](https://github.com/Houdini/two_factor_authentication/pull/34) ([rud](https://github.com/rud))
84
+ - Pad OTP codes with less than 6 digits [\#31](https://github.com/Houdini/two_factor_authentication/pull/31) ([brissmyr](https://github.com/brissmyr))
85
+
86
+ ## [v1.1](https://github.com/Houdini/two_factor_authentication/tree/v1.1) (2014-04-16)
87
+ **Closed issues:**
88
+
89
+ - Update [\#15](https://github.com/Houdini/two_factor_authentication/issues/15)
90
+ - Data in formats other than HTML left unprotected [\#6](https://github.com/Houdini/two_factor_authentication/issues/6)
91
+ - Wordlists [\#5](https://github.com/Houdini/two_factor_authentication/issues/5)
92
+ - devise - wrong number of arguments \(1 for 0\) [\#3](https://github.com/Houdini/two_factor_authentication/issues/3)
93
+ - gem? [\#1](https://github.com/Houdini/two_factor_authentication/issues/1)
94
+
95
+ **Merged pull requests:**
96
+
97
+ - added is\_fully\_authenticated helper for current version [\#28](https://github.com/Houdini/two_factor_authentication/pull/28) ([edg3r](https://github.com/edg3r))
98
+ - Adds integration spec to ensure authentication code is sent on sign in [\#27](https://github.com/Houdini/two_factor_authentication/pull/27) ([rossta](https://github.com/rossta))
99
+ - ensure return\_to location is properly stored [\#26](https://github.com/Houdini/two_factor_authentication/pull/26) ([rossta](https://github.com/rossta))
100
+ - travis badge in README [\#25](https://github.com/Houdini/two_factor_authentication/pull/25) ([rossta](https://github.com/rossta))
101
+ - Integration specs [\#24](https://github.com/Houdini/two_factor_authentication/pull/24) ([rossta](https://github.com/rossta))
102
+ - README updates [\#23](https://github.com/Houdini/two_factor_authentication/pull/23) ([rossta](https://github.com/rossta))
103
+ - extract method \#max\_login\_attempts [\#22](https://github.com/Houdini/two_factor_authentication/pull/22) ([rossta](https://github.com/rossta))
104
+ - extract method \#populate\_otp\_column [\#21](https://github.com/Houdini/two_factor_authentication/pull/21) ([rossta](https://github.com/rossta))
105
+ - specs for Model\#provisioning\_uri [\#20](https://github.com/Houdini/two_factor_authentication/pull/20) ([rossta](https://github.com/rossta))
106
+ - Provide options for \#provisioning\_uri [\#19](https://github.com/Houdini/two_factor_authentication/pull/19) ([rossta](https://github.com/rossta))
107
+ - Use time-based authentication codes [\#16](https://github.com/Houdini/two_factor_authentication/pull/16) ([mattmueller](https://github.com/mattmueller))
108
+ - Add ru locales and locales for max\_limit\_reached view [\#13](https://github.com/Houdini/two_factor_authentication/pull/13) ([edg3r](https://github.com/edg3r))
109
+ - Update README.md [\#11](https://github.com/Houdini/two_factor_authentication/pull/11) ([edg3r](https://github.com/edg3r))
110
+ - Changed route from user to admin\_user [\#10](https://github.com/Houdini/two_factor_authentication/pull/10) ([ilanstern](https://github.com/ilanstern))
111
+ - Changed :notice to :error when setting flash message on attempt failure. [\#9](https://github.com/Houdini/two_factor_authentication/pull/9) ([johnmichaelbradley](https://github.com/johnmichaelbradley))
112
+ - Typo and punctuation corrections. [\#8](https://github.com/Houdini/two_factor_authentication/pull/8) ([johnmichaelbradley](https://github.com/johnmichaelbradley))
113
+ - Respond with 401 for request non-HTML requests [\#7](https://github.com/Houdini/two_factor_authentication/pull/7) ([WojtekKruszewski](https://github.com/WojtekKruszewski))
114
+ - need\_two\_factor\_authentication? method should accept request param. [\#4](https://github.com/Houdini/two_factor_authentication/pull/4) ([VladimirMikhailov](https://github.com/VladimirMikhailov))
115
+ - Add generators to make it easier to install and fix deprecation warnings [\#2](https://github.com/Houdini/two_factor_authentication/pull/2) ([carvil](https://github.com/carvil))
116
+
117
+
118
+
119
+ \* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
data/Gemfile ADDED
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in devise_ip_filter.gemspec
6
+ gemspec
7
+
8
+ rails_version = ENV['RAILS_VERSION'] || 'default'
9
+
10
+ rails = case rails_version
11
+ when 'master'
12
+ { github: 'rails/rails' }
13
+ when 'default'
14
+ '~> 7.0.1'
15
+ else
16
+ "~> #{rails_version}"
17
+ end
18
+
19
+ gem 'rails', rails
20
+
21
+ if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.2.0')
22
+ gem 'test-unit', '~> 3.0'
23
+ end
24
+
25
+ group :test, :development do
26
+ gem 'pry'
27
+ gem 'rubocop'
28
+ gem 'sprockets-rails'
29
+ gem 'sqlite3'
30
+ end
31
+
32
+ group :test do
33
+ gem 'ammeter'
34
+ gem 'rack_session_access'
35
+ end
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (C) 2012 Dmitrii Golub
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
4
+ this software and associated documentation files (the "Software"), to deal in
5
+ the Software without restriction, including without limitation the rights to
6
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7
+ of the Software, and to permit persons to whom the Software is furnished to do
8
+ so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.