devise-authy 1.7.0 → 2.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (180) hide show
  1. checksums.yaml +5 -13
  2. data/.github/workflows/build.yml +32 -0
  3. data/.gitignore +45 -0
  4. data/.rspec +1 -0
  5. data/Appraisals +22 -0
  6. data/CHANGELOG.md +152 -0
  7. data/Gemfile +2 -23
  8. data/LICENSE.txt +1 -1
  9. data/README.md +147 -36
  10. data/Rakefile +1 -14
  11. data/app/controllers/devise/devise_authy_controller.rb +90 -30
  12. data/app/controllers/devise_authy/passwords_controller.rb +18 -0
  13. data/app/views/devise/enable_authy.html.erb +2 -2
  14. data/app/views/devise/enable_authy.html.haml +2 -2
  15. data/app/views/devise/verify_authy.html.erb +23 -6
  16. data/app/views/devise/verify_authy.html.haml +21 -6
  17. data/app/views/devise/verify_authy_installation.html.erb +14 -6
  18. data/app/views/devise/verify_authy_installation.html.haml +12 -4
  19. data/config/locales/en.yml +8 -4
  20. data/config.ru +9 -0
  21. data/devise-authy.gemspec +44 -239
  22. data/gemfiles/.bundle/config +2 -0
  23. data/gemfiles/rails_5_2.gemfile +14 -0
  24. data/gemfiles/rails_6.gemfile +15 -0
  25. data/lib/devise-authy/controllers/helpers.rb +31 -12
  26. data/lib/devise-authy/controllers/view_helpers.rb +13 -7
  27. data/lib/devise-authy/mapping.rb +10 -7
  28. data/lib/devise-authy/models/authy_authenticatable.rb +2 -2
  29. data/lib/devise-authy/rails.rb +1 -1
  30. data/lib/devise-authy/routes.rb +3 -2
  31. data/lib/devise-authy/version.rb +5 -0
  32. data/lib/devise-authy.rb +8 -1
  33. data/lib/generators/active_record/devise_authy_generator.rb +11 -1
  34. data/lib/generators/active_record/templates/migration.rb +1 -1
  35. data/lib/generators/devise_authy/devise_authy_generator.rb +8 -8
  36. data/lib/generators/devise_authy/install_generator.rb +19 -5
  37. metadata +173 -205
  38. data/Gemfile.lock +0 -194
  39. data/VERSION +0 -1
  40. data/authy-devise-demo/.gitignore +0 -15
  41. data/authy-devise-demo/Gemfile +0 -40
  42. data/authy-devise-demo/Gemfile.lock +0 -141
  43. data/authy-devise-demo/README.md +0 -64
  44. data/authy-devise-demo/Rakefile +0 -7
  45. data/authy-devise-demo/app/assets/images/rails.png +0 -0
  46. data/authy-devise-demo/app/assets/javascripts/application.js +0 -15
  47. data/authy-devise-demo/app/assets/javascripts/devise_authy.js +0 -12
  48. data/authy-devise-demo/app/assets/javascripts/welcome.js.coffee +0 -3
  49. data/authy-devise-demo/app/assets/stylesheets/application.css +0 -13
  50. data/authy-devise-demo/app/assets/stylesheets/devise_authy.css +0 -26
  51. data/authy-devise-demo/app/assets/stylesheets/welcome.css.scss +0 -3
  52. data/authy-devise-demo/app/controllers/application_controller.rb +0 -3
  53. data/authy-devise-demo/app/controllers/welcome_controller.rb +0 -15
  54. data/authy-devise-demo/app/helpers/application_helper.rb +0 -2
  55. data/authy-devise-demo/app/helpers/welcome_helper.rb +0 -2
  56. data/authy-devise-demo/app/mailers/.gitkeep +0 -0
  57. data/authy-devise-demo/app/models/.gitkeep +0 -0
  58. data/authy-devise-demo/app/models/admin.rb +0 -10
  59. data/authy-devise-demo/app/models/user.rb +0 -10
  60. data/authy-devise-demo/app/views/devise/devise_authy/enable_authy.html.erb +0 -7
  61. data/authy-devise-demo/app/views/devise/devise_authy/verify_authy.html.erb +0 -22
  62. data/authy-devise-demo/app/views/devise/devise_authy/verify_authy_installation.html.erb +0 -10
  63. data/authy-devise-demo/app/views/layouts/application.html.erb +0 -28
  64. data/authy-devise-demo/app/views/welcome/admin_page.html.erb +0 -12
  65. data/authy-devise-demo/app/views/welcome/index.html.erb +0 -5
  66. data/authy-devise-demo/app/views/welcome/user_page.html.erb +0 -5
  67. data/authy-devise-demo/config/application.rb +0 -62
  68. data/authy-devise-demo/config/boot.rb +0 -6
  69. data/authy-devise-demo/config/database.yml +0 -25
  70. data/authy-devise-demo/config/environment.rb +0 -5
  71. data/authy-devise-demo/config/environments/development.rb +0 -39
  72. data/authy-devise-demo/config/environments/production.rb +0 -67
  73. data/authy-devise-demo/config/environments/test.rb +0 -37
  74. data/authy-devise-demo/config/initializers/authy.rb +0 -1
  75. data/authy-devise-demo/config/initializers/backtrace_silencers.rb +0 -7
  76. data/authy-devise-demo/config/initializers/devise.rb +0 -237
  77. data/authy-devise-demo/config/initializers/inflections.rb +0 -15
  78. data/authy-devise-demo/config/initializers/mime_types.rb +0 -5
  79. data/authy-devise-demo/config/initializers/secret_token.rb +0 -7
  80. data/authy-devise-demo/config/initializers/session_store.rb +0 -8
  81. data/authy-devise-demo/config/initializers/wrap_parameters.rb +0 -14
  82. data/authy-devise-demo/config/locales/devise.authy.en.yml +0 -24
  83. data/authy-devise-demo/config/locales/devise.en.yml +0 -58
  84. data/authy-devise-demo/config/locales/en.yml +0 -5
  85. data/authy-devise-demo/config/routes.rb +0 -65
  86. data/authy-devise-demo/config.ru +0 -4
  87. data/authy-devise-demo/db/migrate/20130409234357_devise_create_users.rb +0 -46
  88. data/authy-devise-demo/db/migrate/20141202000744_devise_create_admins.rb +0 -46
  89. data/authy-devise-demo/db/migrate/20141202004246_devise_authy_add_to_admins.rb +0 -21
  90. data/authy-devise-demo/db/schema.rb +0 -62
  91. data/authy-devise-demo/db/seeds.rb +0 -7
  92. data/authy-devise-demo/lib/assets/.gitkeep +0 -0
  93. data/authy-devise-demo/lib/tasks/.gitkeep +0 -0
  94. data/authy-devise-demo/log/.gitkeep +0 -0
  95. data/authy-devise-demo/public/404.html +0 -26
  96. data/authy-devise-demo/public/422.html +0 -26
  97. data/authy-devise-demo/public/500.html +0 -25
  98. data/authy-devise-demo/public/favicon.ico +0 -0
  99. data/authy-devise-demo/public/robots.txt +0 -5
  100. data/authy-devise-demo/script/rails +0 -6
  101. data/authy-devise-demo/test/fixtures/.gitkeep +0 -0
  102. data/authy-devise-demo/test/fixtures/users.yml +0 -11
  103. data/authy-devise-demo/test/functional/.gitkeep +0 -0
  104. data/authy-devise-demo/test/functional/welcome_controller_test.rb +0 -9
  105. data/authy-devise-demo/test/integration/.gitkeep +0 -0
  106. data/authy-devise-demo/test/performance/browsing_test.rb +0 -12
  107. data/authy-devise-demo/test/test_helper.rb +0 -13
  108. data/authy-devise-demo/test/unit/.gitkeep +0 -0
  109. data/authy-devise-demo/test/unit/helpers/welcome_helper_test.rb +0 -4
  110. data/authy-devise-demo/test/unit/user_test.rb +0 -7
  111. data/authy-devise-demo/vendor/assets/javascripts/.gitkeep +0 -0
  112. data/authy-devise-demo/vendor/assets/stylesheets/.gitkeep +0 -0
  113. data/authy-devise-demo/vendor/plugins/.gitkeep +0 -0
  114. data/spec/controllers/devise_authy_controller_spec.rb +0 -271
  115. data/spec/controllers/passwords_controller_spec.rb +0 -48
  116. data/spec/features/authy_authenticatable_spec.rb +0 -90
  117. data/spec/features/authy_lockable_spec.rb +0 -70
  118. data/spec/generators_spec.rb +0 -30
  119. data/spec/models/authy_authenticatable_spec.rb +0 -17
  120. data/spec/models/authy_lockable_spec.rb +0 -81
  121. data/spec/orm/active_record.rb +0 -4
  122. data/spec/rails-app/Gemfile +0 -9
  123. data/spec/rails-app/Gemfile.lock +0 -115
  124. data/spec/rails-app/Rakefile +0 -7
  125. data/spec/rails-app/app/assets/images/rails.png +0 -0
  126. data/spec/rails-app/app/assets/javascripts/application.js +0 -15
  127. data/spec/rails-app/app/assets/javascripts/devise_authy.js +0 -12
  128. data/spec/rails-app/app/assets/javascripts/welcome.js +0 -2
  129. data/spec/rails-app/app/assets/stylesheets/application.css +0 -13
  130. data/spec/rails-app/app/assets/stylesheets/devise_authy.css +0 -26
  131. data/spec/rails-app/app/assets/stylesheets/welcome.css.scss +0 -3
  132. data/spec/rails-app/app/controllers/application_controller.rb +0 -3
  133. data/spec/rails-app/app/controllers/welcome_controller.rb +0 -13
  134. data/spec/rails-app/app/helpers/application_helper.rb +0 -2
  135. data/spec/rails-app/app/helpers/welcome_helper.rb +0 -2
  136. data/spec/rails-app/app/mailers/.gitkeep +0 -0
  137. data/spec/rails-app/app/models/.gitkeep +0 -0
  138. data/spec/rails-app/app/models/lockable_user.rb +0 -7
  139. data/spec/rails-app/app/models/user.rb +0 -11
  140. data/spec/rails-app/app/views/devise/devise_authy/enable_authy.html.erb +0 -7
  141. data/spec/rails-app/app/views/devise/devise_authy/verify_authy.html.erb +0 -21
  142. data/spec/rails-app/app/views/devise/devise_authy/verify_authy_installation.html.erb +0 -10
  143. data/spec/rails-app/app/views/layouts/application.html.erb +0 -28
  144. data/spec/rails-app/app/views/welcome/index.html.erb +0 -5
  145. data/spec/rails-app/config/application.rb +0 -49
  146. data/spec/rails-app/config/boot.rb +0 -6
  147. data/spec/rails-app/config/database.yml +0 -25
  148. data/spec/rails-app/config/environment.rb +0 -5
  149. data/spec/rails-app/config/environments/development.rb +0 -39
  150. data/spec/rails-app/config/environments/production.rb +0 -67
  151. data/spec/rails-app/config/environments/test.rb +0 -39
  152. data/spec/rails-app/config/initializers/authy.rb +0 -2
  153. data/spec/rails-app/config/initializers/backtrace_silencers.rb +0 -7
  154. data/spec/rails-app/config/initializers/devise.rb +0 -245
  155. data/spec/rails-app/config/initializers/inflections.rb +0 -15
  156. data/spec/rails-app/config/initializers/mime_types.rb +0 -5
  157. data/spec/rails-app/config/initializers/secret_token.rb +0 -7
  158. data/spec/rails-app/config/initializers/session_store.rb +0 -8
  159. data/spec/rails-app/config/initializers/wrap_parameters.rb +0 -14
  160. data/spec/rails-app/config/locales/devise.authy.en.yml +0 -24
  161. data/spec/rails-app/config/locales/devise.en.yml +0 -59
  162. data/spec/rails-app/config/locales/en.yml +0 -5
  163. data/spec/rails-app/config/routes.rb +0 -8
  164. data/spec/rails-app/config.ru +0 -4
  165. data/spec/rails-app/db/development.sqlite3 +0 -0
  166. data/spec/rails-app/db/migrate/20130419164907_devise_create_users.rb +0 -46
  167. data/spec/rails-app/db/migrate/20130419164936_devise_authy_add_to_users.rb +0 -18
  168. data/spec/rails-app/db/schema.rb +0 -41
  169. data/spec/rails-app/db/seeds.rb +0 -7
  170. data/spec/rails-app/lib/assets/.gitkeep +0 -0
  171. data/spec/rails-app/lib/tasks/.gitkeep +0 -0
  172. data/spec/rails-app/public/404.html +0 -26
  173. data/spec/rails-app/public/422.html +0 -26
  174. data/spec/rails-app/public/500.html +0 -25
  175. data/spec/rails-app/public/favicon.ico +0 -0
  176. data/spec/rails-app/public/robots.txt +0 -5
  177. data/spec/rails-app/script/rails +0 -6
  178. data/spec/routing/routes_spec.rb +0 -31
  179. data/spec/spec_helper.rb +0 -29
  180. data/spec/support/helpers.rb +0 -78
data/devise-authy.gemspec CHANGED
@@ -1,245 +1,50 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
- # -*- encoding: utf-8 -*-
5
- # stub: devise-authy 1.7.0 ruby lib
1
+ # frozen_string_literal: true
6
2
 
7
- Gem::Specification.new do |s|
8
- s.name = "devise-authy"
9
- s.version = "1.7.0"
3
+ lib = File.expand_path("../lib", __FILE__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require "devise-authy/version"
10
6
 
11
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
- s.require_paths = ["lib"]
13
- s.authors = ["Authy Inc."]
14
- s.date = "2015-12-22"
15
- s.description = "Authy plugin for Devise"
16
- s.email = "support@authy.com"
17
- s.extra_rdoc_files = [
18
- "LICENSE.txt",
19
- "README.md"
20
- ]
21
- s.files = [
22
- ".document",
23
- ".rspec",
24
- "Gemfile",
25
- "Gemfile.lock",
26
- "LICENSE.txt",
27
- "README.md",
28
- "Rakefile",
29
- "VERSION",
30
- "app/assets/javascripts/devise_authy.js",
31
- "app/assets/stylesheets/devise_authy.css",
32
- "app/assets/stylesheets/devise_authy.sass",
33
- "app/controllers/devise/devise_authy_controller.rb",
34
- "app/controllers/devise_authy/passwords_controller.rb",
35
- "app/views/devise/enable_authy.html.erb",
36
- "app/views/devise/enable_authy.html.haml",
37
- "app/views/devise/verify_authy.html.erb",
38
- "app/views/devise/verify_authy.html.haml",
39
- "app/views/devise/verify_authy_installation.html.erb",
40
- "app/views/devise/verify_authy_installation.html.haml",
41
- "authy-devise-demo/.gitignore",
42
- "authy-devise-demo/Gemfile",
43
- "authy-devise-demo/Gemfile.lock",
44
- "authy-devise-demo/README.md",
45
- "authy-devise-demo/Rakefile",
46
- "authy-devise-demo/app/assets/images/rails.png",
47
- "authy-devise-demo/app/assets/javascripts/application.js",
48
- "authy-devise-demo/app/assets/javascripts/devise_authy.js",
49
- "authy-devise-demo/app/assets/javascripts/welcome.js.coffee",
50
- "authy-devise-demo/app/assets/stylesheets/application.css",
51
- "authy-devise-demo/app/assets/stylesheets/devise_authy.css",
52
- "authy-devise-demo/app/assets/stylesheets/welcome.css.scss",
53
- "authy-devise-demo/app/controllers/application_controller.rb",
54
- "authy-devise-demo/app/controllers/welcome_controller.rb",
55
- "authy-devise-demo/app/helpers/application_helper.rb",
56
- "authy-devise-demo/app/helpers/welcome_helper.rb",
57
- "authy-devise-demo/app/mailers/.gitkeep",
58
- "authy-devise-demo/app/models/.gitkeep",
59
- "authy-devise-demo/app/models/admin.rb",
60
- "authy-devise-demo/app/models/user.rb",
61
- "authy-devise-demo/app/views/devise/devise_authy/enable_authy.html.erb",
62
- "authy-devise-demo/app/views/devise/devise_authy/verify_authy.html.erb",
63
- "authy-devise-demo/app/views/devise/devise_authy/verify_authy_installation.html.erb",
64
- "authy-devise-demo/app/views/layouts/application.html.erb",
65
- "authy-devise-demo/app/views/welcome/admin_page.html.erb",
66
- "authy-devise-demo/app/views/welcome/index.html.erb",
67
- "authy-devise-demo/app/views/welcome/user_page.html.erb",
68
- "authy-devise-demo/config.ru",
69
- "authy-devise-demo/config/application.rb",
70
- "authy-devise-demo/config/boot.rb",
71
- "authy-devise-demo/config/database.yml",
72
- "authy-devise-demo/config/environment.rb",
73
- "authy-devise-demo/config/environments/development.rb",
74
- "authy-devise-demo/config/environments/production.rb",
75
- "authy-devise-demo/config/environments/test.rb",
76
- "authy-devise-demo/config/initializers/authy.rb",
77
- "authy-devise-demo/config/initializers/backtrace_silencers.rb",
78
- "authy-devise-demo/config/initializers/devise.rb",
79
- "authy-devise-demo/config/initializers/inflections.rb",
80
- "authy-devise-demo/config/initializers/mime_types.rb",
81
- "authy-devise-demo/config/initializers/secret_token.rb",
82
- "authy-devise-demo/config/initializers/session_store.rb",
83
- "authy-devise-demo/config/initializers/wrap_parameters.rb",
84
- "authy-devise-demo/config/locales/devise.authy.en.yml",
85
- "authy-devise-demo/config/locales/devise.en.yml",
86
- "authy-devise-demo/config/locales/en.yml",
87
- "authy-devise-demo/config/routes.rb",
88
- "authy-devise-demo/db/migrate/20130409234357_devise_create_users.rb",
89
- "authy-devise-demo/db/migrate/20141202000744_devise_create_admins.rb",
90
- "authy-devise-demo/db/migrate/20141202004246_devise_authy_add_to_admins.rb",
91
- "authy-devise-demo/db/schema.rb",
92
- "authy-devise-demo/db/seeds.rb",
93
- "authy-devise-demo/lib/assets/.gitkeep",
94
- "authy-devise-demo/lib/tasks/.gitkeep",
95
- "authy-devise-demo/log/.gitkeep",
96
- "authy-devise-demo/public/404.html",
97
- "authy-devise-demo/public/422.html",
98
- "authy-devise-demo/public/500.html",
99
- "authy-devise-demo/public/favicon.ico",
100
- "authy-devise-demo/public/robots.txt",
101
- "authy-devise-demo/script/rails",
102
- "authy-devise-demo/test/fixtures/.gitkeep",
103
- "authy-devise-demo/test/fixtures/users.yml",
104
- "authy-devise-demo/test/functional/.gitkeep",
105
- "authy-devise-demo/test/functional/welcome_controller_test.rb",
106
- "authy-devise-demo/test/integration/.gitkeep",
107
- "authy-devise-demo/test/performance/browsing_test.rb",
108
- "authy-devise-demo/test/test_helper.rb",
109
- "authy-devise-demo/test/unit/.gitkeep",
110
- "authy-devise-demo/test/unit/helpers/welcome_helper_test.rb",
111
- "authy-devise-demo/test/unit/user_test.rb",
112
- "authy-devise-demo/vendor/assets/javascripts/.gitkeep",
113
- "authy-devise-demo/vendor/assets/stylesheets/.gitkeep",
114
- "authy-devise-demo/vendor/plugins/.gitkeep",
115
- "config/locales/en.yml",
116
- "devise-authy.gemspec",
117
- "lib/devise-authy.rb",
118
- "lib/devise-authy/controllers/helpers.rb",
119
- "lib/devise-authy/controllers/view_helpers.rb",
120
- "lib/devise-authy/hooks/authy_authenticatable.rb",
121
- "lib/devise-authy/mapping.rb",
122
- "lib/devise-authy/models/authy_authenticatable.rb",
123
- "lib/devise-authy/models/authy_lockable.rb",
124
- "lib/devise-authy/rails.rb",
125
- "lib/devise-authy/routes.rb",
126
- "lib/generators/active_record/devise_authy_generator.rb",
127
- "lib/generators/active_record/templates/migration.rb",
128
- "lib/generators/devise_authy/devise_authy_generator.rb",
129
- "lib/generators/devise_authy/install_generator.rb",
130
- "spec/controllers/devise_authy_controller_spec.rb",
131
- "spec/controllers/passwords_controller_spec.rb",
132
- "spec/features/authy_authenticatable_spec.rb",
133
- "spec/features/authy_lockable_spec.rb",
134
- "spec/generators_spec.rb",
135
- "spec/models/authy_authenticatable_spec.rb",
136
- "spec/models/authy_lockable_spec.rb",
137
- "spec/orm/active_record.rb",
138
- "spec/rails-app/Gemfile",
139
- "spec/rails-app/Gemfile.lock",
140
- "spec/rails-app/Rakefile",
141
- "spec/rails-app/app/assets/images/rails.png",
142
- "spec/rails-app/app/assets/javascripts/application.js",
143
- "spec/rails-app/app/assets/javascripts/devise_authy.js",
144
- "spec/rails-app/app/assets/javascripts/welcome.js",
145
- "spec/rails-app/app/assets/stylesheets/application.css",
146
- "spec/rails-app/app/assets/stylesheets/devise_authy.css",
147
- "spec/rails-app/app/assets/stylesheets/welcome.css.scss",
148
- "spec/rails-app/app/controllers/application_controller.rb",
149
- "spec/rails-app/app/controllers/welcome_controller.rb",
150
- "spec/rails-app/app/helpers/application_helper.rb",
151
- "spec/rails-app/app/helpers/welcome_helper.rb",
152
- "spec/rails-app/app/mailers/.gitkeep",
153
- "spec/rails-app/app/models/.gitkeep",
154
- "spec/rails-app/app/models/lockable_user.rb",
155
- "spec/rails-app/app/models/user.rb",
156
- "spec/rails-app/app/views/devise/devise_authy/enable_authy.html.erb",
157
- "spec/rails-app/app/views/devise/devise_authy/verify_authy.html.erb",
158
- "spec/rails-app/app/views/devise/devise_authy/verify_authy_installation.html.erb",
159
- "spec/rails-app/app/views/layouts/application.html.erb",
160
- "spec/rails-app/app/views/welcome/index.html.erb",
161
- "spec/rails-app/config.ru",
162
- "spec/rails-app/config/application.rb",
163
- "spec/rails-app/config/boot.rb",
164
- "spec/rails-app/config/database.yml",
165
- "spec/rails-app/config/environment.rb",
166
- "spec/rails-app/config/environments/development.rb",
167
- "spec/rails-app/config/environments/production.rb",
168
- "spec/rails-app/config/environments/test.rb",
169
- "spec/rails-app/config/initializers/authy.rb",
170
- "spec/rails-app/config/initializers/backtrace_silencers.rb",
171
- "spec/rails-app/config/initializers/devise.rb",
172
- "spec/rails-app/config/initializers/inflections.rb",
173
- "spec/rails-app/config/initializers/mime_types.rb",
174
- "spec/rails-app/config/initializers/secret_token.rb",
175
- "spec/rails-app/config/initializers/session_store.rb",
176
- "spec/rails-app/config/initializers/wrap_parameters.rb",
177
- "spec/rails-app/config/locales/devise.authy.en.yml",
178
- "spec/rails-app/config/locales/devise.en.yml",
179
- "spec/rails-app/config/locales/en.yml",
180
- "spec/rails-app/config/routes.rb",
181
- "spec/rails-app/db/development.sqlite3",
182
- "spec/rails-app/db/migrate/20130419164907_devise_create_users.rb",
183
- "spec/rails-app/db/migrate/20130419164936_devise_authy_add_to_users.rb",
184
- "spec/rails-app/db/schema.rb",
185
- "spec/rails-app/db/seeds.rb",
186
- "spec/rails-app/lib/assets/.gitkeep",
187
- "spec/rails-app/lib/tasks/.gitkeep",
188
- "spec/rails-app/public/404.html",
189
- "spec/rails-app/public/422.html",
190
- "spec/rails-app/public/500.html",
191
- "spec/rails-app/public/favicon.ico",
192
- "spec/rails-app/public/robots.txt",
193
- "spec/rails-app/script/rails",
194
- "spec/routing/routes_spec.rb",
195
- "spec/spec_helper.rb",
196
- "spec/support/helpers.rb"
197
- ]
198
- s.homepage = "https://github.com/authy/authy-devise"
199
- s.licenses = ["MIT"]
200
- s.rubygems_version = "2.4.8"
201
- s.summary = "Authy plugin for Devise"
7
+ Gem::Specification.new do |spec|
8
+ spec.name = "devise-authy"
9
+ spec.version = DeviseAuthy::VERSION
10
+ spec.authors = ["Authy Inc."]
11
+ spec.email = ["support@authy.com"]
202
12
 
203
- if s.respond_to? :specification_version then
204
- s.specification_version = 4
13
+ spec.summary = %q{Deprecated: please see README for details}
14
+ spec.description = %q{Authy plugin to add two factor authentication to Devise. This gem is deprecated, please see the README for details.}
15
+ spec.homepage = "https://github.com/twilio/authy-devise"
16
+ spec.license = "MIT"
205
17
 
206
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
207
- s.add_runtime_dependency(%q<devise>, [">= 0"])
208
- s.add_runtime_dependency(%q<authy>, [">= 0"])
209
- s.add_development_dependency(%q<rspec>, [">= 0"])
210
- s.add_development_dependency(%q<yard>, [">= 0"])
211
- s.add_development_dependency(%q<rdoc>, [">= 0"])
212
- s.add_development_dependency(%q<bundler>, [">= 0"])
213
- s.add_development_dependency(%q<jeweler>, [">= 2.0.1"])
214
- s.add_development_dependency(%q<simplecov>, [">= 0"])
215
- s.add_development_dependency(%q<sass-rails>, [">= 0"])
216
- s.add_development_dependency(%q<jquery-rails>, [">= 0"])
217
- s.add_development_dependency(%q<pry>, [">= 0"])
218
- else
219
- s.add_dependency(%q<devise>, [">= 0"])
220
- s.add_dependency(%q<authy>, [">= 0"])
221
- s.add_dependency(%q<rspec>, [">= 0"])
222
- s.add_dependency(%q<yard>, [">= 0"])
223
- s.add_dependency(%q<rdoc>, [">= 0"])
224
- s.add_dependency(%q<bundler>, [">= 0"])
225
- s.add_dependency(%q<jeweler>, [">= 2.0.1"])
226
- s.add_dependency(%q<simplecov>, [">= 0"])
227
- s.add_dependency(%q<sass-rails>, [">= 0"])
228
- s.add_dependency(%q<jquery-rails>, [">= 0"])
229
- s.add_dependency(%q<pry>, [">= 0"])
230
- end
231
- else
232
- s.add_dependency(%q<devise>, [">= 0"])
233
- s.add_dependency(%q<authy>, [">= 0"])
234
- s.add_dependency(%q<rspec>, [">= 0"])
235
- s.add_dependency(%q<yard>, [">= 0"])
236
- s.add_dependency(%q<rdoc>, [">= 0"])
237
- s.add_dependency(%q<bundler>, [">= 0"])
238
- s.add_dependency(%q<jeweler>, [">= 2.0.1"])
239
- s.add_dependency(%q<simplecov>, [">= 0"])
240
- s.add_dependency(%q<sass-rails>, [">= 0"])
241
- s.add_dependency(%q<jquery-rails>, [">= 0"])
242
- s.add_dependency(%q<pry>, [">= 0"])
18
+ spec.metadata = {
19
+ "bug_tracker_uri" => "https://github.com/twilio/authy-devise/issues",
20
+ "change_log_uri" => "https://github.com/twilio/authy-devise/blob/master/CHANGELOG.md",
21
+ "documentation_uri" => "https://github.com/twilio/authy-devise",
22
+ "homepage_uri" => "https://github.com/twilio/authy-devise",
23
+ "source_code_uri" => "https://github.com/twilio/authy-devise"
24
+ }
25
+
26
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
27
+ f.match(%r{^(test|spec|features)/})
243
28
  end
244
- end
29
+ spec.require_paths = ["lib"]
245
30
 
31
+ spec.add_dependency "devise", ">= 4.0.0"
32
+ spec.add_dependency "authy", "~> 3.0"
33
+
34
+ spec.add_development_dependency "appraisal", "~> 2.2"
35
+ spec.add_development_dependency "bundler", ">= 1.16"
36
+ spec.add_development_dependency "rake"
37
+ spec.add_development_dependency "combustion", "~> 1.1"
38
+ spec.add_development_dependency "rspec", "~> 3.0"
39
+ spec.add_development_dependency "rspec-rails"
40
+ spec.add_development_dependency "rails-controller-testing", "~> 1.0"
41
+ spec.add_development_dependency "yard", "~> 0.9.11"
42
+ spec.add_development_dependency "rdoc", "~> 4.3.0"
43
+ spec.add_development_dependency "simplecov", "~> 0.17.1"
44
+ spec.add_development_dependency "webmock", "~> 3.11.0"
45
+ spec.add_development_dependency "rails", ">= 5"
46
+ spec.add_development_dependency "sqlite3"
47
+ spec.add_development_dependency "generator_spec"
48
+ spec.add_development_dependency "database_cleaner", "~> 1.7"
49
+ spec.add_development_dependency "factory_bot_rails", "~> 5.1.1"
50
+ end
@@ -0,0 +1,2 @@
1
+ ---
2
+ BUNDLE_RETRY: "1"
@@ -0,0 +1,14 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rails", "~> 5.2.0"
6
+ gem "sqlite3", "~> 1.3.13"
7
+
8
+ group :development, :test do
9
+ gem "factory_girl_rails", require: false
10
+ gem "rspec-rails", "~>4.0.0.beta3", require: false
11
+ gem "database_cleaner", require: false
12
+ end
13
+
14
+ gemspec path: "../"
@@ -0,0 +1,15 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rails", "~> 6.0.0"
6
+ gem "sqlite3", "~> 1.4"
7
+ gem "net-smtp"
8
+
9
+ group :development, :test do
10
+ gem "factory_girl_rails", require: false
11
+ gem "rspec-rails", "~>4.0.0.beta3", require: false
12
+ gem "database_cleaner", require: false
13
+ end
14
+
15
+ gemspec path: "../"
@@ -4,26 +4,35 @@ module DeviseAuthy
4
4
  extend ActiveSupport::Concern
5
5
 
6
6
  included do
7
- before_filter :check_request_and_redirect_to_verify_token, :if => :is_signing_in?
7
+ before_action :check_request_and_redirect_to_verify_token, :if => :is_signing_in?
8
8
  end
9
9
 
10
10
  private
11
- def remember_device
11
+
12
+ def remember_device(id)
12
13
  cookies.signed[:remember_device] = {
13
- :value => Time.now.to_i,
14
+ :value => {expires: Time.now.to_i, id: id}.to_json,
14
15
  :secure => !(Rails.env.test? || Rails.env.development?),
16
+ :httponly => !(Rails.env.test? || Rails.env.development?),
15
17
  :expires => resource_class.authy_remember_device.from_now
16
18
  }
17
19
  end
18
20
 
21
+ def forget_device
22
+ cookies.delete :remember_device
23
+ end
24
+
19
25
  def require_token?
20
- if cookies.signed[:remember_device].present? &&
21
- (Time.now.to_i - cookies.signed[:remember_device].to_i) < \
22
- resource_class.authy_remember_device.to_i
23
- return false
24
- end
26
+ id = warden.session(resource_name)[:id]
27
+ cookie = cookies.signed[:remember_device]
28
+ return true if cookie.blank?
29
+
30
+ # require token for old cookies which just have expiration time and no id
31
+ return true if cookie.to_s =~ %r{\A\d+\z}
25
32
 
26
- return true
33
+ cookie = JSON.parse(cookie) rescue ""
34
+ return cookie.blank? || (Time.now.to_i - cookie['expires'].to_i) > \
35
+ resource_class.authy_remember_device.to_i || cookie['id'] != id
27
36
  end
28
37
 
29
38
  def is_devise_sessions_controller?
@@ -31,7 +40,7 @@ module DeviseAuthy
31
40
  end
32
41
 
33
42
  def is_signing_in?
34
- if devise_controller? && signed_in?(resource_name) &&
43
+ if devise_controller? &&
35
44
  is_devise_sessions_controller? &&
36
45
  self.action_name == "create"
37
46
  return true
@@ -49,8 +58,7 @@ module DeviseAuthy
49
58
 
50
59
  remember_me = (params.fetch(resource_name, {})[:remember_me].to_s == "1")
51
60
  return_to = session["#{resource_name}_return_to"]
52
- warden.logout
53
- warden.reset_session! # make sure the session resetted
61
+ sign_out
54
62
 
55
63
  session["#{resource_name}_id"] = id
56
64
  # this is safe to put in the session because the cookie is signed
@@ -67,6 +75,17 @@ module DeviseAuthy
67
75
  scope = Devise::Mapping.find_scope!(resource_or_scope)
68
76
  send(:"#{scope}_verify_authy_path")
69
77
  end
78
+
79
+ def send_one_touch_request(authy_id)
80
+ Authy::OneTouch.send_approval_request(id: authy_id, message: I18n.t('request_to_login', scope: 'devise'))
81
+ end
82
+
83
+ def record_authy_authentication
84
+ @resource.update_attribute(:last_sign_in_with_authy, DateTime.now)
85
+ session["#{resource_name}_authy_token_checked"] = true
86
+ sign_in(resource_name, @resource)
87
+ set_flash_message(:notice, :signed_in) if is_navigational_format?
88
+ end
70
89
  end
71
90
  end
72
91
  end
@@ -2,6 +2,9 @@ module DeviseAuthy
2
2
  module Views
3
3
  module Helpers
4
4
  def authy_request_phone_call_link(opts = {})
5
+ title = opts.delete(:title) do
6
+ I18n.t('request_phone_call', scope: 'devise')
7
+ end
5
8
  opts = {
6
9
  :id => "authy-request-phone-call-link",
7
10
  :method => :post,
@@ -9,13 +12,16 @@ module DeviseAuthy
9
12
  }.merge(opts)
10
13
 
11
14
  link_to(
12
- I18n.t('request_phone_call', { :scope => 'devise' }),
13
- url_for([resource_name, :request_phone_call]),
15
+ title,
16
+ url_for([resource_name.to_sym, :request_phone_call]),
14
17
  opts
15
18
  )
16
19
  end
17
20
 
18
21
  def authy_request_sms_link(opts = {})
22
+ title = opts.delete(:title) do
23
+ I18n.t('request_sms', scope: 'devise')
24
+ end
19
25
  opts = {
20
26
  :id => "authy-request-sms-link",
21
27
  :method => :post,
@@ -23,15 +29,15 @@ module DeviseAuthy
23
29
  }.merge(opts)
24
30
 
25
31
  link_to(
26
- I18n.t('request_sms', {:scope => 'devise'}),
27
- url_for([resource_name, :request_sms]),
32
+ title,
33
+ url_for([resource_name.to_sym, :request_sms]),
28
34
  opts
29
35
  )
30
36
  end
31
37
 
32
38
  def verify_authy_form(opts = {}, &block)
33
39
  opts = default_opts.merge(:id => 'devise_authy').merge(opts)
34
- form_tag([resource_name, :verify_authy], opts) do
40
+ form_tag([resource_name.to_sym, :verify_authy], opts) do
35
41
  buffer = hidden_field_tag(:"#{resource_name}_id", @resource.id)
36
42
  buffer << capture(&block)
37
43
  end
@@ -39,14 +45,14 @@ module DeviseAuthy
39
45
 
40
46
  def enable_authy_form(opts = {}, &block)
41
47
  opts = default_opts.merge(opts)
42
- form_tag([resource_name, :enable_authy], opts) do
48
+ form_tag([resource_name.to_sym, :enable_authy], opts) do
43
49
  capture(&block)
44
50
  end
45
51
  end
46
52
 
47
53
  def verify_authy_installation_form(opts = {}, &block)
48
54
  opts = default_opts.merge(opts)
49
- form_tag([resource_name, :verify_authy_installation], opts) do
55
+ form_tag([resource_name.to_sym, :verify_authy_installation], opts) do
50
56
  capture(&block)
51
57
  end
52
58
  end
@@ -1,14 +1,17 @@
1
1
  module DeviseAuthy
2
2
  module Mapping
3
- def self.included(base)
4
- base.alias_method_chain :default_controllers, :authy_authenticatable
5
- end
6
-
7
3
  private
8
- def default_controllers_with_authy_authenticatable(options)
4
+ def default_controllers(options)
9
5
  options[:controllers] ||= {}
10
6
  options[:controllers][:passwords] ||= "devise_authy/passwords"
11
- default_controllers_without_authy_authenticatable(options)
7
+ super
8
+ end
9
+
10
+ def default_path_names(options)
11
+ options[:path_names] ||= {}
12
+ options[:path_names][:request_sms] ||= 'request-sms'
13
+ options[:path_names][:request_phone_call] ||= 'request-phone-call'
14
+ super
12
15
  end
13
16
  end
14
- end
17
+ end
@@ -14,10 +14,10 @@ module Devise
14
14
 
15
15
  module ClassMethods
16
16
  def find_by_authy_id(authy_id)
17
- find(:first, :conditions => {:authy_id => authy_id})
17
+ where(authy_id: authy_id).first
18
18
  end
19
19
 
20
- Devise::Models.config(self, :authy_remember_device)
20
+ Devise::Models.config(self, :authy_remember_device, :authy_enable_onetouch, :authy_enable_qr_code)
21
21
  end
22
22
  end
23
23
  end
@@ -9,7 +9,7 @@ module DeviseAuthy
9
9
 
10
10
  # extend mapping with after_initialize because it's not reloaded
11
11
  config.after_initialize do
12
- Devise::Mapping.send :include, DeviseAuthy::Mapping
12
+ Devise::Mapping.send :prepend, DeviseAuthy::Mapping
13
13
  end
14
14
  end
15
15
  end
@@ -14,9 +14,10 @@ module ActionDispatch::Routing
14
14
  match "/#{mapping.path_names[:verify_authy_installation]}", :controller => controllers[:devise_authy], :action => :GET_verify_authy_installation, :as => :verify_authy_installation, :via => :get
15
15
  match "/#{mapping.path_names[:verify_authy_installation]}", :controller => controllers[:devise_authy], :action => :POST_verify_authy_installation, :as => nil, :via => :post
16
16
 
17
+ match "/#{mapping.path_names[:authy_onetouch_status]}", :controller => controllers[:devise_authy], :action => :GET_authy_onetouch_status, as: :authy_onetouch_status, via: :get
17
18
 
18
- match "/request-sms", :controller => controllers[:devise_authy], :action => :request_sms, :as => :request_sms, :via => :post
19
- match "/request-phone-call", :controller => controllers[:devise_authy], :action => :request_phone_call, :as => :request_phone_call, :via => :post
19
+ match "/#{mapping.path_names[:request_sms]}", :controller => controllers[:devise_authy], :action => :request_sms, :as => :request_sms, :via => :post
20
+ match "/#{mapping.path_names[:request_phone_call]}", :controller => controllers[:devise_authy], :action => :request_phone_call, :as => :request_phone_call, :via => :post
20
21
  end
21
22
  end
22
23
  end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DeviseAuthy
4
+ VERSION = '2.3.1'
5
+ end
data/lib/devise-authy.rb CHANGED
@@ -4,8 +4,10 @@ require 'devise'
4
4
  require 'authy'
5
5
 
6
6
  module Devise
7
- mattr_accessor :authy_remember_device
7
+ mattr_accessor :authy_remember_device, :authy_enable_onetouch, :authy_enable_qr_code
8
8
  @@authy_remember_device = 1.month
9
+ @@authy_enable_onetouch = false
10
+ @@authy_enable_qr_code = false
9
11
  end
10
12
 
11
13
  module DeviseAuthy
@@ -25,6 +27,11 @@ require 'devise-authy/routes'
25
27
  require 'devise-authy/rails'
26
28
  require 'devise-authy/models/authy_authenticatable'
27
29
  require 'devise-authy/models/authy_lockable'
30
+ require 'devise-authy/version'
31
+
32
+ Authy.user_agent = "DeviseAuthy/#{DeviseAuthy::VERSION} - #{Authy.user_agent}"
28
33
 
29
34
  Devise.add_module :authy_authenticatable, :model => 'devise-authy/models/authy_authenticatable', :controller => :devise_authy, :route => :authy
30
35
  Devise.add_module :authy_lockable, :model => 'devise-authy/models/authy_lockable'
36
+
37
+ warn "DEPRECATION WARNING: The authy-devise library is no longer actively maintained. The Authy API is being replaced by the Twilio Verify API. Please see the README for more details."
@@ -6,7 +6,17 @@ module ActiveRecord
6
6
  source_root File.expand_path("../templates", __FILE__)
7
7
 
8
8
  def copy_devise_migration
9
- migration_template "migration.rb", "db/migrate/devise_authy_add_to_#{table_name}.rb"
9
+ migration_template "migration.rb", "db/migrate/devise_authy_add_to_#{table_name}.rb", migration_version: migration_version
10
+ end
11
+
12
+ private
13
+
14
+ def versioned_migrations?
15
+ Rails::VERSION::MAJOR >= 5
16
+ end
17
+
18
+ def migration_version
19
+ "[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]" if versioned_migrations?
10
20
  end
11
21
  end
12
22
  end
@@ -1,4 +1,4 @@
1
- class DeviseAuthyAddTo<%= table_name.camelize %> < ActiveRecord::Migration
1
+ class DeviseAuthyAddTo<%= table_name.camelize %> < ActiveRecord::Migration<%= migration_version %>
2
2
  def self.up
3
3
  change_table :<%= table_name %> do |t|
4
4
  t.string :authy_id
@@ -1,30 +1,30 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module DeviseAuthy
2
4
  module Generators
3
5
  class DeviseAuthyGenerator < Rails::Generators::NamedBase
4
-
5
6
  namespace "devise_authy"
6
7
 
7
8
  desc "Add :authy_authenticatable directive in the given model, plus accessors. Also generate migration for ActiveRecord"
8
9
 
9
10
  def inject_devise_authy_content
10
- path = File.join("app","models","#{file_path}.rb")
11
- if File.exists?(path) &&
12
- !File.read(path).include?("authy_authenticatable")
11
+ path = File.join(destination_root, "app", "models", "#{file_path}.rb")
12
+ if File.exist?(path) &&
13
+ !File.read(path).include?("authy_authenticatable")
13
14
  inject_into_file(path,
14
15
  "authy_authenticatable, :",
15
16
  :after => "devise :")
16
17
  end
17
18
 
18
- if File.exists?(path) &&
19
- !File.read(path).include?(":authy_id")
19
+ if File.exist?(path) &&
20
+ !File.read(path).include?(":authy_id")
20
21
  inject_into_file(path,
21
22
  ":authy_id, :last_sign_in_with_authy, ",
22
- :after => "attr_accessible ")
23
+ :after => "attr_accessible ")
23
24
  end
24
25
  end
25
26
 
26
27
  hook_for :orm
27
-
28
28
  end
29
29
  end
30
30
  end