devise-authy 1.10.0 → 1.11.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c2944ca880949d1d99ba1116f87399c9be0043cc210d29c4d5c500b08b74a3ba
4
- data.tar.gz: 400fe93a97c18c62904d7f3b2795193bdfe724b4022c677bf20a507f12881cab
3
+ metadata.gz: b4dcb41db3fa90c5055347a840927fe3480f2eb6622499775dac3996f9d3683a
4
+ data.tar.gz: e7d144883aa6ac75efb34ef13f1a9145529604d6dc9fc648a2427f9749e8f719
5
5
  SHA512:
6
- metadata.gz: 394a6c85daf4d32bd9a7f8be985cdb81dbc6aad4578b317bfbf2cd0514226bbef466fe0f3831b85034d7de6d99d7be2f4c461243705bb1936491e9454d595360
7
- data.tar.gz: a5defe4716260f048cf8080bd40fa47d4fb13da62ed42a75461b62c46c0b4b7eba25d6d8896064666e8252364d6da159b4375111019174591dc1f2b046f370ed
6
+ metadata.gz: 89a291d8930edb905bae19949b253b645f7aaa319ff631fe0ec19da5133a363d0fcbbaa54e706e1f1495d8a219f8c4e2925309f9f22cfba94a531fb9413e3425
7
+ data.tar.gz: a89caa9abd9fbbcc088175b66949f945602a7758dc120b12a274bd0967ea41d9a42fc13b86561e51dfd269c33bb4174b6b024b499c2d98b93d0e7746b64f6dca
@@ -1,7 +1,12 @@
1
1
  language: ruby
2
- before_install: cd spec/rails-app && bundle install
2
+ before_install:
3
+ - "find /home/travis/.rvm/rubies -wholename '*default/bundler-*.gemspec' -delete"
4
+ - rvm @global do gem uninstall bundler -a -x
5
+ - rvm @global do yes | gem install bundler -v '< 2.0.0'
6
+ - cd spec/rails-app && BUNDLE_GEMFILE=$TRAVIS_BUILD_DIR/spec/rails-app/Gemfile bundle install && cd ../..
3
7
  script: bundle exec rspec
4
8
  rvm:
9
+ - 2.6
5
10
  - 2.5
6
11
  - 2.4
7
12
  - 2.3
@@ -10,3 +15,4 @@ rvm:
10
15
  matrix:
11
16
  allow_failures:
12
17
  - rvm: ruby-head
18
+ - rvm: 2.2
@@ -9,49 +9,84 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
9
9
 
10
10
  ...
11
11
 
12
+ ## [1.11.0] - 2019-02-01
13
+
14
+ ### Fixed
15
+
16
+ - Corrects for label in verify_authy view (#103 thanks @mstruebing)
17
+ - Corrects heading in verify_authy view (#104 thanks @mstruebing)
18
+
19
+ ### Changed
20
+
21
+ - Allows you to define paths for request_sms and request_phone_call (#108 thanks @dedene)
22
+
23
+ ### Added
24
+
25
+ - Now sets a distinct user agent through the Authy gem (#110)
26
+
12
27
  ## [1.10.0] - 2018-09-26
13
28
 
14
29
  ### Changed
30
+
15
31
  - Moves OneTouch approval request copy to locale file.
16
32
 
17
33
  ### Removed
34
+
18
35
  - Demo app now lives in its own repo
19
36
 
20
37
  ## [1.9.0] - 2018-09-04
21
38
 
22
39
  ### Fixed
40
+
23
41
  - Generated migration now includes version number for Rails 5
24
42
 
25
43
  ### Changed
44
+
26
45
  - Removes Jeweler in favour of administering the gemspec by hand
27
46
  - Removes demo app files from gem package
28
47
 
29
48
  ## [1.8.3] - 2018-07-05
49
+
30
50
  ### Fixed
51
+
31
52
  - Fixes Ruby interpolation in HAML for onetouch (thanks @muan)
32
53
  - Records Authy authentication after install verification (thanks @nukturnal)
33
54
  - Forgets remember device cookie when disabling Authy (thanks @senekis)
34
55
 
35
56
  ### Changed
57
+
36
58
  - Updated testing Rubies in CI
37
59
 
38
60
  ## Older releases
39
61
 
40
- __*The following releases happened before the changelog was started. Some history will be added for clarity.*__
62
+ **_The following releases happened before the changelog was started. Some history will be added for clarity._**
41
63
 
42
64
  ## [1.8.2] - 2017-12-22
65
+
43
66
  ## [1.8.1] - 2016-12-06
67
+
44
68
  ## [1.8.0] - 2016-10-25
69
+
45
70
  ## [1.7.0] - 2015-12-22
71
+
46
72
  ## [1.6.0] - 2015-01-07
73
+
47
74
  ## [1.5.3] - 2014-06-11
75
+
48
76
  ## [1.5.2] - 2014-06-11
77
+
49
78
  ## [1.5.1] - 2014-04-24
79
+
50
80
  ## [1.5.0] - 2014-01-07
81
+
51
82
  ## [1.4.0] - 2013-12-17
83
+
52
84
  ## [1.3.0] - 2013-11-16
85
+
53
86
  ## [1.2.2] - 2013-09-04
87
+
54
88
  ## [1.2.1] - 2013-04-22
89
+
55
90
  ## [1.2.0] - 2013-04-22 [YANKED]
56
- ## [1.0.0] - 2013-04-10
57
91
 
92
+ ## [1.0.0] - 2013-04-10
data/README.md CHANGED
@@ -38,17 +38,55 @@ Add `Devise Authy` to your App:
38
38
 
39
39
  ### Configuring Models
40
40
 
41
- Configure your Devise user model:
41
+ You can add devise_authy to your user model in two ways.
42
42
 
43
- rails g devise_authy [MODEL_NAME]
43
+ #### With the generator
44
44
 
45
- or add the following line to your `User` model
45
+ This is the easiest way and is recommended. Run the following command:
46
+
47
+ ```bash
48
+ rails g devise_authy [MODEL_NAME]
49
+ ```
50
+
51
+ #### Manually
52
+
53
+ Add `:authy_authenticatable` to the `devise` options in your Devise user model:
46
54
 
47
55
  ```ruby
48
56
  devise :authy_authenticatable, :database_authenticatable
49
57
  ```
50
58
 
51
- Update the default routes to point to something like:
59
+ Also add a new migration. For example, if you are adding to the `User` model, use this migration:
60
+
61
+ ```ruby
62
+ class DeviseAuthyAddToUsers < ActiveRecord::Migration[5.2]
63
+ def self.up
64
+ change_table :users do |t|
65
+ t.string :authy_id
66
+ t.datetime :last_sign_in_with_authy
67
+ t.boolean :authy_enabled, :default => false
68
+ end
69
+
70
+ add_index :users, :authy_id
71
+ end
72
+
73
+ def self.down
74
+ change_table :users do |t|
75
+ t.remove :authy_id, :last_sign_in_with_authy, :authy_enabled
76
+ end
77
+ end
78
+ end
79
+ ```
80
+
81
+ #### Final steps
82
+
83
+ For either method above, run the migrations:
84
+
85
+ ```bash
86
+ rake db:migrate
87
+ ```
88
+
89
+ **[Optional]** Update the default routes to point to something like:
52
90
 
53
91
  ```ruby
54
92
  devise_for :users, :path_names => {
@@ -59,10 +97,6 @@ devise_for :users, :path_names => {
59
97
  }
60
98
  ```
61
99
 
62
- Then run the migrations:
63
-
64
- rake db:migrate
65
-
66
100
  Now whenever a user wants to enable two-factor authentication they can go to:
67
101
 
68
102
  http://your-app/users/enable-two-factor
@@ -71,7 +105,6 @@ And when the user logs in they will be redirected to:
71
105
 
72
106
  http://your-app/users/verify-token
73
107
 
74
-
75
108
  ## Custom Views
76
109
 
77
110
  If you want to customise your views, you can modify the files that are located at:
@@ -118,7 +151,6 @@ And tell the router to use this controller
118
151
  devise_for :users, controllers: {devise_authy: 'my_custom_module/devise_authy'}
119
152
  ```
120
153
 
121
-
122
154
  ## I18n
123
155
 
124
156
  The install generator also copies a `Devise Authy` i18n file which you can find at:
@@ -145,10 +177,22 @@ To enable [Authy push authentication](https://www.twilio.com/authy/features/push
145
177
  config.authy_enable_onetouch = true
146
178
  ```
147
179
 
180
+ ## Rails 5 CSRF protection
181
+
182
+ In Rails 5 `protect_from_forgery` is no longer prepended to the `before_action` chain. If you call `authenticate_user` before `protect_from_forgery` your request will result in a "Can't verify CSRF token authenticity" error.
183
+
184
+ To remedy this, add `prepend: true` to your `protect_from_forgery` call, like in this example from the [Authy Devise demo app](https://github.com/twilio/authy-devise-demo):
185
+
186
+ ```ruby
187
+ class ApplicationController < ActionController::Base
188
+ protect_from_forgery with: :exception, prepend: true
189
+ end
190
+ ```
148
191
 
149
192
  ## Running Tests
150
193
 
151
194
  To prepare the tests run the following commands:
195
+
152
196
  ```bash
153
197
  $ cd spec/rails-app
154
198
  $ bundle install
@@ -156,6 +200,7 @@ $ RAILS_ENV=test bundle exec rake db:migrate
156
200
  ```
157
201
 
158
202
  Now on the project root run the following commands:
203
+
159
204
  ```bash
160
205
  $ bundle exec rspec spec/
161
206
  ```
@@ -1,10 +1,10 @@
1
1
  <h2>
2
- <%= I18n.t('authy_register_title', {:scope => 'devise'}) %>
2
+ <%= I18n.t('submit_token_title', {:scope => 'devise'}) %>
3
3
  </h2>
4
4
 
5
5
  <%= verify_authy_form do %>
6
6
  <legend><%= I18n.t('submit_token_title', {:scope => 'devise'}) %></legend>
7
- <%= label_tag :token %>
7
+ <%= label_tag 'authy-token' %>
8
8
  <%= text_field_tag :token, "", :autocomplete => :off, :id => 'authy-token' %>
9
9
  <label>
10
10
  <%= check_box_tag :remember_device %>
@@ -3,7 +3,7 @@
3
3
  = verify_authy_form do
4
4
  %legend= I18n.t('submit_token_title', {:scope => 'devise'})
5
5
  = hidden_field_tag :"#{resource_name}_id", @resource.id
6
- = label_tag :token
6
+ = label_tag 'authy-token'
7
7
  = text_field_tag :token, "", :autocomplete => :off, :id => 'authy-token'
8
8
  %label
9
9
  = check_box_tag :remember_device
@@ -29,9 +29,9 @@ Gem::Specification.new do |spec|
29
29
  spec.require_paths = ["lib"]
30
30
 
31
31
  spec.add_dependency "devise", ">= 3.0.0"
32
- spec.add_dependency "authy", ">= 2.7.2"
32
+ spec.add_dependency "authy", ">= 2.7.5"
33
33
 
34
- spec.add_development_dependency "bundler", "~> 1.16"
34
+ spec.add_development_dependency "bundler", ">= 1.16"
35
35
  spec.add_development_dependency "rake", "~> 10.0"
36
36
  spec.add_development_dependency "rspec", "~> 3.0"
37
37
  spec.add_development_dependency "yard", "~> 0.9.11"
@@ -3,6 +3,8 @@ require 'active_support/core_ext/integer/time'
3
3
  require 'devise'
4
4
  require 'authy'
5
5
 
6
+ Authy.user_agent = "DeviseAuthy/#{DeviseAuthy::VERSION} - #{Authy.user_agent}"
7
+
6
8
  module Devise
7
9
  mattr_accessor :authy_remember_device, :authy_enable_onetouch
8
10
  @@authy_remember_device = 1.month
@@ -6,5 +6,12 @@ module DeviseAuthy
6
6
  options[:controllers][:passwords] ||= "devise_authy/passwords"
7
7
  super
8
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
15
+ end
9
16
  end
10
17
  end
@@ -16,8 +16,8 @@ module ActionDispatch::Routing
16
16
 
17
17
  match "/#{mapping.path_names[:authy_onetouch_status]}", :controller => controllers[:devise_authy], :action => :GET_authy_onetouch_status, as: :authy_onetouch_status, via: :get
18
18
 
19
- match "/request-sms", :controller => controllers[:devise_authy], :action => :request_sms, :as => :request_sms, :via => :post
20
- 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
21
21
  end
22
22
  end
23
23
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DeviseAuthy
4
- VERSION = '1.10.0'
4
+ VERSION = '1.11.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devise-authy
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.0
4
+ version: 1.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Authy Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-26 00:00:00.000000000 Z
11
+ date: 2019-01-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: devise
@@ -30,26 +30,26 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 2.7.2
33
+ version: 2.7.5
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
- version: 2.7.2
40
+ version: 2.7.5
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '1.16'
48
48
  type: :development
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: '1.16'
55
55
  - !ruby/object:Gem::Dependency
@@ -189,8 +189,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
189
189
  - !ruby/object:Gem::Version
190
190
  version: '0'
191
191
  requirements: []
192
- rubyforge_project:
193
- rubygems_version: 2.7.6
192
+ rubygems_version: 3.0.1
194
193
  signing_key:
195
194
  specification_version: 4
196
195
  summary: Authy plugin for Devise.