devise 4.7.1 → 4.7.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6dc5ab8b0dc2a902bcf6f66b156b87cdb5348a336f05fb8605b6db1d1f688bc5
4
- data.tar.gz: 3be07eb3511c19857e9ddd2071b469833ac88d5c780c0a3c831c94523252663b
3
+ metadata.gz: 66728973d95b80cb0029344f3ea6e86d0c01d692f8a363e54e85e2ebe29bcdb4
4
+ data.tar.gz: b41344b9a521d72d48f8b1e8618767ddb237a10f81b9d272376e9c09afc1da54
5
5
  SHA512:
6
- metadata.gz: 599ee2531bd66335b49e7282d2af71be9e02594fc36733ec3c8f96110a256ee918e45a56c88640558b16e943a599881435cdd0dbaa2029636d830364cfbcfeb4
7
- data.tar.gz: e785db9c81e1275f283896d604124067b67685bced32267a75f0205f39d98a0985d68d40933859e31196cd773ccf260841cf1663a4ee9dcaab9c397af2f1c1b2
6
+ metadata.gz: '03294fe66db7023bac9f5940ccf4aecd65af65329485e4eb7cb864b71729feffc965b144125310c4b5654273e1b2275b31b260b09040d5c58c6e0e907de347a1'
7
+ data.tar.gz: f599102d1558b3dcf1ccc68f8665b3229400f6e4d4da861c67173bbcddb9b6c0b15e6f36d43ff48eb8f89edcd8bf15d3767c4f3252a8739926aca979002336de
@@ -1,4 +1,12 @@
1
- ### Unreleased
1
+ ### 4.7.1 - 2020-06-10
2
+
3
+ * enhancements
4
+ * Increase default stretches to 12 (by @sergey-alekseev)
5
+ * Ruby 2.7 support (kwarg warnings removed)
6
+
7
+ * bug fixes
8
+ * Generate scoped views with proper scoped errors partial (by @shobhitic)
9
+ * Allow to set scoped `already_authenticated` error messages (by @gurgelrenan)
2
10
 
3
11
  ### 4.7.1 - 2019-09-06
4
12
 
@@ -21,7 +29,7 @@
21
29
  ### 4.6.2 - 2019-03-26
22
30
 
23
31
  * bug fixes
24
- * Revert "Set `encrypted_password` to `nil` when `password` is set to `nil`" since it broke backward compatibility with existing applications. See more on https://github.com/plataformatec/devise/issues/5033#issuecomment-476386275 (by @mracos)
32
+ * Revert "Set `encrypted_password` to `nil` when `password` is set to `nil`" since it broke backward compatibility with existing applications. See more on https://github.com/heartcombo/devise/issues/5033#issuecomment-476386275 (by @mracos)
25
33
 
26
34
  ### 4.6.1 - 2019-02-11
27
35
 
@@ -68,7 +76,7 @@
68
76
  * Add `autocomplete="new-password"` to new password fields (by @gssbzn)
69
77
  * Add `autocomplete="current-password"` to current password fields (by @gssbzn)
70
78
  * Remove redundant `self` from `database_authenticatable` module (by @abhishekkanojia)
71
- * Update `simple_form` templates with changes from https://github.com/plataformatec/devise/commit/16b3d6d67c7e017d461ea17ed29ea9738dc77e83 and https://github.com/plataformatec/devise/commit/6260c29a867b9a656f1e1557abe347a523178fab (by @gssbzn)
79
+ * Update `simple_form` templates with changes from https://github.com/heartcombo/devise/commit/16b3d6d67c7e017d461ea17ed29ea9738dc77e83 and https://github.com/heartcombo/devise/commit/6260c29a867b9a656f1e1557abe347a523178fab (by @gssbzn)
72
80
  * Remove `:trackable` from the default modules in the generators, to be more GDPR-friendly (by @fakenine)
73
81
 
74
82
  * bug fixes
@@ -315,5 +323,5 @@ configured (by @joshpencheon)
315
323
  You can check more examples and explanations on the [README section](README.md#strong-parameters)
316
324
  and on the [ParameterSanitizer docs](lib/devise/parameter_sanitizer.rb).
317
325
 
318
- Please check [3-stable](https://github.com/plataformatec/devise/blob/3-stable/CHANGELOG.md)
326
+ Please check [3-stable](https://github.com/heartcombo/devise/blob/3-stable/CHANGELOG.md)
319
327
  for previous changes.
@@ -1,4 +1,5 @@
1
- Copyright 2009-2019 Plataformatec. http://plataformatec.com.br
1
+ Copyright 2020 Rafael França, Leonardo Tegon, Carlos Antônio da Silva.
2
+ Copyright 2009-2019 Plataformatec.
2
3
 
3
4
  Permission is hereby granted, free of charge, to any person obtaining
4
5
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,11 +1,7 @@
1
- ![Devise Logo](https://raw.github.com/plataformatec/devise/master/devise.png)
1
+ ![Devise Logo](https://raw.github.com/heartcombo/devise/master/devise.png)
2
2
 
3
- By [Plataformatec](http://plataformatec.com.br/).
4
-
5
- [![Build Status](https://api.travis-ci.org/plataformatec/devise.svg?branch=master)](http://travis-ci.org/plataformatec/devise)
6
- [![Code Climate](https://codeclimate.com/github/plataformatec/devise.svg)](https://codeclimate.com/github/plataformatec/devise)
7
-
8
- This README is [also available in a friendly navigable format](http://devise.plataformatec.com.br/).
3
+ [![Build Status](https://api.travis-ci.org/heartcombo/devise.svg?branch=master)](http://travis-ci.org/heartcombo/devise)
4
+ [![Code Climate](https://codeclimate.com/github/heartcombo/devise.svg)](https://codeclimate.com/github/heartcombo/devise)
9
5
 
10
6
  Devise is a flexible authentication solution for Rails based on Warden. It:
11
7
 
@@ -16,16 +12,16 @@ Devise is a flexible authentication solution for Rails based on Warden. It:
16
12
 
17
13
  It's composed of 10 modules:
18
14
 
19
- * [Database Authenticatable](http://www.rubydoc.info/github/plataformatec/devise/master/Devise/Models/DatabaseAuthenticatable): hashes and stores a password in the database to validate the authenticity of a user while signing in. The authentication can be done both through POST requests or HTTP Basic Authentication.
20
- * [Omniauthable](http://www.rubydoc.info/github/plataformatec/devise/master/Devise/Models/Omniauthable): adds OmniAuth (https://github.com/omniauth/omniauth) support.
21
- * [Confirmable](http://www.rubydoc.info/github/plataformatec/devise/master/Devise/Models/Confirmable): sends emails with confirmation instructions and verifies whether an account is already confirmed during sign in.
22
- * [Recoverable](http://www.rubydoc.info/github/plataformatec/devise/master/Devise/Models/Recoverable): resets the user password and sends reset instructions.
23
- * [Registerable](http://www.rubydoc.info/github/plataformatec/devise/master/Devise/Models/Registerable): handles signing up users through a registration process, also allowing them to edit and destroy their account.
24
- * [Rememberable](http://www.rubydoc.info/github/plataformatec/devise/master/Devise/Models/Rememberable): manages generating and clearing a token for remembering the user from a saved cookie.
25
- * [Trackable](http://www.rubydoc.info/github/plataformatec/devise/master/Devise/Models/Trackable): tracks sign in count, timestamps and IP address.
26
- * [Timeoutable](http://www.rubydoc.info/github/plataformatec/devise/master/Devise/Models/Timeoutable): expires sessions that have not been active in a specified period of time.
27
- * [Validatable](http://www.rubydoc.info/github/plataformatec/devise/master/Devise/Models/Validatable): provides validations of email and password. It's optional and can be customized, so you're able to define your own validations.
28
- * [Lockable](http://www.rubydoc.info/github/plataformatec/devise/master/Devise/Models/Lockable): locks an account after a specified number of failed sign-in attempts. Can unlock via email or after a specified time period.
15
+ * [Database Authenticatable](http://www.rubydoc.info/github/heartcombo/devise/master/Devise/Models/DatabaseAuthenticatable): hashes and stores a password in the database to validate the authenticity of a user while signing in. The authentication can be done both through POST requests or HTTP Basic Authentication.
16
+ * [Omniauthable](http://www.rubydoc.info/github/heartcombo/devise/master/Devise/Models/Omniauthable): adds OmniAuth (https://github.com/omniauth/omniauth) support.
17
+ * [Confirmable](http://www.rubydoc.info/github/heartcombo/devise/master/Devise/Models/Confirmable): sends emails with confirmation instructions and verifies whether an account is already confirmed during sign in.
18
+ * [Recoverable](http://www.rubydoc.info/github/heartcombo/devise/master/Devise/Models/Recoverable): resets the user password and sends reset instructions.
19
+ * [Registerable](http://www.rubydoc.info/github/heartcombo/devise/master/Devise/Models/Registerable): handles signing up users through a registration process, also allowing them to edit and destroy their account.
20
+ * [Rememberable](http://www.rubydoc.info/github/heartcombo/devise/master/Devise/Models/Rememberable): manages generating and clearing a token for remembering the user from a saved cookie.
21
+ * [Trackable](http://www.rubydoc.info/github/heartcombo/devise/master/Devise/Models/Trackable): tracks sign in count, timestamps and IP address.
22
+ * [Timeoutable](http://www.rubydoc.info/github/heartcombo/devise/master/Devise/Models/Timeoutable): expires sessions that have not been active in a specified period of time.
23
+ * [Validatable](http://www.rubydoc.info/github/heartcombo/devise/master/Devise/Models/Validatable): provides validations of email and password. It's optional and can be customized, so you're able to define your own validations.
24
+ * [Lockable](http://www.rubydoc.info/github/heartcombo/devise/master/Devise/Models/Lockable): locks an account after a specified number of failed sign-in attempts. Can unlock via email or after a specified time period.
29
25
 
30
26
  ## Table of Contents
31
27
 
@@ -73,15 +69,15 @@ It's composed of 10 modules:
73
69
 
74
70
  The Devise Wiki has lots of additional information about Devise including many "how-to" articles and answers to the most frequently asked questions. Please browse the Wiki after finishing this README:
75
71
 
76
- https://github.com/plataformatec/devise/wiki
72
+ https://github.com/heartcombo/devise/wiki
77
73
 
78
74
  ### Bug reports
79
75
 
80
76
  If you discover a problem with Devise, we would like to know about it. However, we ask that you please review these guidelines before submitting a bug report:
81
77
 
82
- https://github.com/plataformatec/devise/wiki/Bug-reports
78
+ https://github.com/heartcombo/devise/wiki/Bug-reports
83
79
 
84
- If you have discovered a security related bug, please do *NOT* use the GitHub issue tracker. Send an email to opensource@plataformatec.com.br.
80
+ If you have discovered a security related bug, please do *NOT* use the GitHub issue tracker. Send an email to heartcombo@googlegroups.com.
85
81
 
86
82
  ### StackOverflow and Mailing List
87
83
 
@@ -97,7 +93,7 @@ https://groups.google.com/group/plataformatec-devise
97
93
 
98
94
  You can view the Devise documentation in RDoc format here:
99
95
 
100
- http://rubydoc.info/github/plataformatec/devise/master/frames
96
+ http://rubydoc.info/github/heartcombo/devise/master/frames
101
97
 
102
98
  If you need to use Devise with previous versions of Rails, you can always run "gem server" from the command line after you install the gem to access the old documentation.
103
99
 
@@ -105,19 +101,19 @@ If you need to use Devise with previous versions of Rails, you can always run "g
105
101
 
106
102
  There are a few example applications available on GitHub that demonstrate various features of Devise with different versions of Rails. You can view them here:
107
103
 
108
- https://github.com/plataformatec/devise/wiki/Example-Applications
104
+ https://github.com/heartcombo/devise/wiki/Example-Applications
109
105
 
110
106
  ### Extensions
111
107
 
112
108
  Our community has created a number of extensions that add functionality above and beyond what is included with Devise. You can view a list of available extensions and add your own here:
113
109
 
114
- https://github.com/plataformatec/devise/wiki/Extensions
110
+ https://github.com/heartcombo/devise/wiki/Extensions
115
111
 
116
112
  ### Contributing
117
113
 
118
114
  We hope that you will consider contributing to Devise. Please read this short overview for some information about how to get started:
119
115
 
120
- https://github.com/plataformatec/devise/wiki/Contributing
116
+ https://github.com/heartcombo/devise/wiki/Contributing
121
117
 
122
118
  You will usually want to write tests for your changes. To run the test suite, go into Devise's top-level directory and run `bundle install` and `bin/test`.
123
119
  Devise works with multiple Ruby and Rails versions, and ActiveRecord and Mongoid ORMs, which means you can run the test suite with some modifiers: `DEVISE_ORM` and `BUNDLE_GEMFILE`.
@@ -136,7 +132,7 @@ Please note that the command output will show the variable value being used.
136
132
 
137
133
  ### BUNDLE_GEMFILE
138
134
  We can use this variable to tell bundler what Gemfile it should use (instead of the one in the current directory).
139
- Inside the [gemfiles](https://github.com/plataformatec/devise/tree/master/gemfiles) directory, we have one for each version of Rails we support. When you send us a pull request, it may happen that the test suite breaks on Travis using some of them. If that's the case, you can simulate the same environment using the `BUNDLE_GEMFILE` variable.
135
+ Inside the [gemfiles](https://github.com/heartcombo/devise/tree/master/gemfiles) directory, we have one for each version of Rails we support. When you send us a pull request, it may happen that the test suite breaks on Travis using some of them. If that's the case, you can simulate the same environment using the `BUNDLE_GEMFILE` variable.
140
136
  For example, if the tests broke using Ruby 2.4.2 and Rails 4.1, you can do the following:
141
137
  ```bash
142
138
  rbenv shell 2.4.2 # or rvm use 2.4.2
@@ -170,10 +166,10 @@ bin/test test/models/trackable_test.rb:16
170
166
 
171
167
  ## Starting with Rails?
172
168
 
173
- If you are building your first Rails application, we recommend you *do not* use Devise. Devise requires a good understanding of the Rails Framework. In such cases, we advise you to start a simple authentication system from scratch. Today, we have three resources that should help you get started:
169
+ If you are building your first Rails application, we recommend you *do not* use Devise. Devise requires a good understanding of the Rails Framework. In such cases, we advise you to start a simple authentication system from scratch. Here's a few resources that should help you get started:
174
170
 
175
171
  * Michael Hartl's online book: https://www.railstutorial.org/book/modeling_users
176
- * Ryan Bates' Railscast: http://railscasts.com/episodes/250-authentication-from-scratch
172
+ * Ryan Bates' Railscasts: http://railscasts.com/episodes/250-authentication-from-scratch and http://railscasts.com/episodes/250-authentication-from-scratch-revised
177
173
  * Codecademy's Ruby on Rails: Authentication and Authorization: https://www.codecademy.com/learn/rails-auth
178
174
 
179
175
  Once you have solidified your understanding of Rails and authentication mechanisms, we assure you Devise will be very pleasant to work with. :smiley:
@@ -270,7 +266,7 @@ member_session
270
266
  The Devise method in your models also accepts some options to configure its modules. For example, you can choose the cost of the hashing algorithm with:
271
267
 
272
268
  ```ruby
273
- devise :database_authenticatable, :registerable, :confirmable, :recoverable, stretches: 12
269
+ devise :database_authenticatable, :registerable, :confirmable, :recoverable, stretches: 13
274
270
  ```
275
271
 
276
272
  Besides `:stretches`, you can define `:pepper`, `:encryptor`, `:confirm_within`, `:remember_for`, `:timeout_in`, `:unlock_in` among other options. For more details, see the initializer file that was created when you invoked the "devise:install" generator described above. This file is usually located at `/config/initializers/devise.rb`.
@@ -279,7 +275,7 @@ Besides `:stretches`, you can define `:pepper`, `:encryptor`, `:confirm_within`,
279
275
 
280
276
  ![The Parameter Sanitizer API has changed for Devise 4](http://messages.hellobits.com/warning.svg?message=The%20Parameter%20Sanitizer%20API%20has%20changed%20for%20Devise%204)
281
277
 
282
- *For previous Devise versions see https://github.com/plataformatec/devise/tree/3-stable#strong-parameters*
278
+ *For previous Devise versions see https://github.com/heartcombo/devise/tree/3-stable#strong-parameters*
283
279
 
284
280
  When you customize your own views, you may end up adding new attributes to forms. Rails 4 moved the parameter sanitization from the model to the controller, causing Devise to handle this concern at the controller as well.
285
281
 
@@ -289,7 +285,7 @@ There are just three actions in Devise that allow any set of parameters to be pa
289
285
  * `sign_up` (`Devise::RegistrationsController#create`) - Permits authentication keys plus `password` and `password_confirmation`
290
286
  * `account_update` (`Devise::RegistrationsController#update`) - Permits authentication keys plus `password`, `password_confirmation` and `current_password`
291
287
 
292
- In case you want to permit additional parameters (the lazy way™), you can do so using a simple before filter in your `ApplicationController`:
288
+ In case you want to permit additional parameters (the lazy way™), you can do so using a simple before action in your `ApplicationController`:
293
289
 
294
290
  ```ruby
295
291
  class ApplicationController < ActionController::Base
@@ -464,7 +460,7 @@ Devise also ships with default routes. If you need to customize them, you should
464
460
  devise_for :users, path: 'auth', path_names: { sign_in: 'login', sign_out: 'logout', password: 'secret', confirmation: 'verification', unlock: 'unblock', registration: 'register', sign_up: 'cmon_let_me_in' }
465
461
  ```
466
462
 
467
- Be sure to check `devise_for` [documentation](http://www.rubydoc.info/github/plataformatec/devise/master/ActionDispatch/Routing/Mapper%3Adevise_for) for details.
463
+ Be sure to check `devise_for` [documentation](http://www.rubydoc.info/github/heartcombo/devise/master/ActionDispatch/Routing/Mapper%3Adevise_for) for details.
468
464
 
469
465
  If you have the need for more deep customization, for instance to also allow "/sign_in" besides "/users/sign_in", all you need to do is create your routes normally and wrap them in a `devise_scope` block in the router:
470
466
 
@@ -520,7 +516,7 @@ en:
520
516
 
521
517
  Take a look at our locale file to check all available messages. You may also be interested in one of the many translations that are available on our wiki:
522
518
 
523
- https://github.com/plataformatec/devise/wiki/I18n
519
+ https://github.com/heartcombo/devise/wiki/I18n
524
520
 
525
521
  Caution: Devise Controllers inherit from ApplicationController. If your app uses multiple locales, you should be sure to set I18n.locale in ApplicationController.
526
522
 
@@ -532,15 +528,21 @@ cases/specs.
532
528
 
533
529
  ### Controller tests
534
530
 
535
- Controller tests require that you include `Devise::Test::ControllerHelpers` on
531
+ Controller tests require that you include `Devise::Test::IntegrationHelpers` on
536
532
  your test case or its parent `ActionController::TestCase` superclass.
537
- For Rails 5, include `Devise::Test::IntegrationHelpers` instead, since the superclass
538
- for controller tests has been changed to ActionDispatch::IntegrationTest
533
+ For Rails versions prior to 5, include `Devise::Test::ControllerHelpers` instead, since the superclass
534
+ for controller tests was changed to ActionDispatch::IntegrationTest
539
535
  (for more details, see the [Integration tests](#integration-tests) section).
540
536
 
541
537
  ```ruby
542
538
  class PostsControllerTest < ActionController::TestCase
543
- include Devise::Test::ControllerHelpers
539
+ include Devise::Test::IntegrationHelpers # Rails >= 5
540
+ end
541
+ ```
542
+
543
+ ```ruby
544
+ class PostsControllerTest < ActionController::TestCase
545
+ include Devise::Test::ControllerHelpers # Rails < 5
544
546
  end
545
547
  ```
546
548
 
@@ -620,7 +622,7 @@ are executed in your tests.
620
622
 
621
623
  You can read more about testing your Rails 3 - Rails 4 controllers with RSpec in the wiki:
622
624
 
623
- * https://github.com/plataformatec/devise/wiki/How-To:-Test-controllers-with-Rails-(and-RSpec)
625
+ * https://github.com/heartcombo/devise/wiki/How-To:-Test-controllers-with-Rails-(and-RSpec)
624
626
 
625
627
  ### OmniAuth
626
628
 
@@ -632,7 +634,7 @@ config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
632
634
 
633
635
  You can read more about OmniAuth support in the wiki:
634
636
 
635
- * https://github.com/plataformatec/devise/wiki/OmniAuth:-Overview
637
+ * https://github.com/heartcombo/devise/wiki/OmniAuth:-Overview
636
638
 
637
639
  ### Configuring multiple models
638
640
 
@@ -679,7 +681,7 @@ end
679
681
 
680
682
  ### Password reset tokens and Rails logs
681
683
 
682
- If you enable the [Recoverable](http://rubydoc.info/github/plataformatec/devise/master/Devise/Models/Recoverable) module, note that a stolen password reset token could give an attacker access to your application. Devise takes effort to generate random, secure tokens, and stores only token digests in the database, never plaintext. However the default logging behavior in Rails can cause plaintext tokens to leak into log files:
684
+ If you enable the [Recoverable](http://rubydoc.info/github/heartcombo/devise/master/Devise/Models/Recoverable) module, note that a stolen password reset token could give an attacker access to your application. Devise takes effort to generate random, secure tokens, and stores only token digests in the database, never plaintext. However the default logging behavior in Rails can cause plaintext tokens to leak into log files:
683
685
 
684
686
  1. Action Mailer logs the entire contents of all outgoing emails to the DEBUG level. Password reset tokens delivered to users in email will be leaked.
685
687
  2. Active Job logs all arguments to every enqueued job at the INFO level. If you configure Devise to use `deliver_later` to send password reset emails, password reset tokens will be leaked.
@@ -697,41 +699,48 @@ Devise supports ActiveRecord (default) and Mongoid. To select another ORM, simpl
697
699
 
698
700
  ### Rails API Mode
699
701
 
700
- Rails 5+ has a built-in [API Mode](https://edgeguides.rubyonrails.org/api_app.html) which optimizes Rails for use as an API (only). One of the side effects is that it changes the order of the middleware stack, and this can cause problems for `Devise::Test::IntegrationHelpers`. This problem usually surfaces as an ```undefined method `[]=' for nil:NilClass``` error when using integration test helpers, such as `#sign_in`. The solution is simply to reorder the middlewares by adding the following to test.rb:
702
+ Rails 5+ has a built-in [API Mode](https://edgeguides.rubyonrails.org/api_app.html) which optimizes Rails for use as an API (only). Devise is _somewhat_ able to handle applications that are built in this mode without additional modifications in the sense that it should not raise exceptions and the like. But some issues may still arise during `development`/`testing`, as we still don't know the full extent of this compatibility. (For more information, see [issue #4947](https://github.com/heartcombo/devise/issues/4947/))
701
703
 
702
- ```ruby
703
- Rails.application.config.middleware.insert_before Warden::Manager, ActionDispatch::Cookies
704
- Rails.application.config.middleware.insert_before Warden::Manager, ActionDispatch::Session::CookieStore
705
- ```
704
+ #### Supported Authentication Strategies
705
+ API-only applications don't support browser-based authentication via cookies, which is devise's default. Yet, devise can still provide authentication out of the box in those cases with the `http_authenticatable` strategy, which uses HTTP Basic Auth and authenticates the user on each request. (For more info, see this wiki article for [How To: Use HTTP Basic Authentication](https://github.com/heartcombo/devise/wiki/How-To:-Use-HTTP-Basic-Authentication))
706
706
 
707
- For a deeper understanding of this, review [this issue](https://github.com/plataformatec/devise/issues/4696).
707
+ The devise default for HTTP Auth is disabled, so it will need to be enabled in the devise initializer for the database strategy:
708
708
 
709
- ## Additional information
709
+ ```ruby
710
+ config.http_authenticatable = [:database]
711
+ ```
710
712
 
711
- ### Heroku
713
+ This restriction does not limit you from implementing custom warden strategies, either in your application or via gem-based extensions for devise.
714
+ A common authentication strategy for APIs is token-based authentication. For more information on extending devise to support this type of authentication and others, see the wiki article for [Simple Token Authentication Examples and alternatives](https://github.com/heartcombo/devise/wiki/How-To:-Simple-Token-Authentication-Example#alternatives) or this blog post on [Custom authentication methods with Devise](http://blog.plataformatec.com.br/2019/01/custom-authentication-methods-with-devise/).
712
715
 
713
- Using Devise on Heroku with Ruby on Rails 3.2 requires setting:
716
+ #### Testing
717
+ API Mode changes the order of the middleware stack, and this can cause problems for `Devise::Test::IntegrationHelpers`. This problem usually surfaces as an ```undefined method `[]=' for nil:NilClass``` error when using integration test helpers, such as `#sign_in`. The solution is simply to reorder the middlewares by adding the following to test.rb:
714
718
 
715
719
  ```ruby
716
- config.assets.initialize_on_precompile = false
720
+ Rails.application.config.middleware.insert_before Warden::Manager, ActionDispatch::Cookies
721
+ Rails.application.config.middleware.insert_before Warden::Manager, ActionDispatch::Session::CookieStore
717
722
  ```
718
723
 
719
- Read more about the potential issues at http://guides.rubyonrails.org/asset_pipeline.html
724
+ For a deeper understanding of this, review [this issue](https://github.com/heartcombo/devise/issues/4696).
725
+
726
+ Additionally be mindful that without views supported, some email-based flows from Confirmable, Recoverable and Lockable are not supported directly at this time.
727
+
728
+ ## Additional information
720
729
 
721
730
  ### Warden
722
731
 
723
732
  Devise is based on Warden, which is a general Rack authentication framework created by Daniel Neighman. We encourage you to read more about Warden here:
724
733
 
725
- https://github.com/hassox/warden
734
+ https://github.com/wardencommunity/warden
726
735
 
727
736
  ### Contributors
728
737
 
729
738
  We have a long list of valued contributors. Check them all at:
730
739
 
731
- https://github.com/plataformatec/devise/graphs/contributors
740
+ https://github.com/heartcombo/devise/graphs/contributors
732
741
 
733
742
  ## License
734
743
 
735
- MIT License. Copyright 2009-2019 Plataformatec. http://plataformatec.com.br
744
+ MIT License. Copyright 2020 Rafael França, Leaonardo Tegon, Carlos Antônio da Silva. Copyright 2009-2019 Plataformatec.
736
745
 
737
- You are not granted rights or licenses to the trademarks of Plataformatec, including without limitation the Devise name or logo.
746
+ The Devise logo is licensed under [Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License](https://creativecommons.org/licenses/by-nc-nd/4.0/).
@@ -112,7 +112,7 @@ MESSAGE
112
112
  end
113
113
 
114
114
  if authenticated && resource = warden.user(resource_name)
115
- flash[:alert] = I18n.t("devise.failure.already_authenticated")
115
+ set_flash_message(:alert, 'already_authenticated', scope: 'devise.failure')
116
116
  redirect_to after_sign_in_path_for(resource)
117
117
  end
118
118
  end
@@ -184,7 +184,7 @@ MESSAGE
184
184
  options[:default] = Array(options[:default]).unshift(kind.to_sym)
185
185
  options[:resource_name] = resource_name
186
186
  options = devise_i18n_options(options)
187
- I18n.t("#{options[:resource_name]}.#{kind}", options)
187
+ I18n.t("#{options[:resource_name]}.#{kind}", **options)
188
188
  end
189
189
 
190
190
  # Controllers inheriting DeviseController are advised to override this
@@ -1,4 +1,4 @@
1
- # Additional translations at https://github.com/plataformatec/devise/wiki/I18n
1
+ # Additional translations at https://github.com/heartcombo/devise/wiki/I18n
2
2
 
3
3
  en:
4
4
  devise:
@@ -71,7 +71,7 @@ module Devise
71
71
 
72
72
  # The number of times to hash the password.
73
73
  mattr_accessor :stretches
74
- @@stretches = 11
74
+ @@stretches = 12
75
75
 
76
76
  # The default key used when authenticating over http auth.
77
77
  mattr_accessor :http_authentication_key
@@ -297,10 +297,6 @@ module Devise
297
297
  mattr_accessor :sign_in_after_change_password
298
298
  @@sign_in_after_change_password = true
299
299
 
300
- def self.rails51? # :nodoc:
301
- Rails.gem_version >= Gem::Version.new("5.1.x")
302
- end
303
-
304
300
  def self.activerecord51? # :nodoc:
305
301
  defined?(ActiveRecord) && ActiveRecord.gem_version >= Gem::Version.new("5.1.x")
306
302
  end
@@ -21,7 +21,7 @@ module Devise
21
21
  # to the set_user method in warden.
22
22
  # If you are using a custom warden strategy and the timeoutable module, you have to
23
23
  # set `env["devise.skip_timeout"] = true` in the request to use this method, like we do
24
- # in the sessions controller: https://github.com/plataformatec/devise/blob/master/app/controllers/devise/sessions_controller.rb#L7
24
+ # in the sessions controller: https://github.com/heartcombo/devise/blob/master/app/controllers/devise/sessions_controller.rb#L7
25
25
  #
26
26
  # Examples:
27
27
  #
@@ -107,7 +107,7 @@ module Devise
107
107
  options[:authentication_keys] = keys.join(I18n.translate(:"support.array.words_connector"))
108
108
  options = i18n_options(options)
109
109
 
110
- I18n.t(:"#{scope}.#{message}", options)
110
+ I18n.t(:"#{scope}.#{message}", **options)
111
111
  else
112
112
  message.to_s
113
113
  end
@@ -152,7 +152,7 @@ module Devise
152
152
 
153
153
  # We need to add the rootpath to `script_name` manually for applications that use a Rails
154
154
  # version lower than 5.1. Otherwise, it is going to generate a wrong path for Engines
155
- # that use Devise. Remove it when the support of Rails 5.0 is droped.
155
+ # that use Devise. Remove it when the support of Rails 5.0 is dropped.
156
156
  elsif root_path_defined?(context) && !rails_51_and_up?
157
157
  rootpath = context.routes.url_helpers.root_path
158
158
  opts[:script_name] = rootpath.chomp('/') if rootpath.length > 1
@@ -21,8 +21,8 @@ Warden::Manager.after_set_user do |record, warden, options|
21
21
 
22
22
  proxy = Devise::Hooks::Proxy.new(warden)
23
23
 
24
- if record.timedout?(last_request_at) &&
25
- !env['devise.skip_timeout'] &&
24
+ if !env['devise.skip_timeout'] &&
25
+ record.timedout?(last_request_at) &&
26
26
  !proxy.remember_me_is_active?(record)
27
27
  Devise.sign_out_all_scopes ? proxy.sign_out : proxy.sign_out(scope)
28
28
  throw :warden, scope: scope, message: :timeout
@@ -152,7 +152,8 @@ module Devise
152
152
  # # If the record is new or changed then delay the
153
153
  # # delivery until the after_commit callback otherwise
154
154
  # # send now because after_commit will not be called.
155
- # if new_record? || changed?
155
+ # # For Rails < 6 use `changed?` instead of `saved_changes?`.
156
+ # if new_record? || saved_changes?
156
157
  # pending_devise_notifications << [notification, args]
157
158
  # else
158
159
  # render_and_send_devise_message(notification, *args)
@@ -7,6 +7,10 @@ module Devise
7
7
  # Authenticatable Module, responsible for hashing the password and
8
8
  # validating the authenticity of a user while signing in.
9
9
  #
10
+ # This module defines a `password=` method. This method will hash the argument
11
+ # and store it in the `encrypted_password` column, bypassing any pre-existing
12
+ # `password` column if it exists.
13
+ #
10
14
  # == Options
11
15
  #
12
16
  # DatabaseAuthenticatable adds the following options to devise_for:
@@ -195,7 +199,7 @@ module Devise
195
199
  # Hashes the password using bcrypt. Custom hash functions should override
196
200
  # this method to apply their own algorithm.
197
201
  #
198
- # See https://github.com/plataformatec/devise-encryptable for examples
202
+ # See https://github.com/heartcombo/devise-encryptable for examples
199
203
  # of other hashing engines.
200
204
  def password_digest(password)
201
205
  Devise::Encryptor.digest(self.class, password)
@@ -102,7 +102,7 @@ module Devise
102
102
 
103
103
  def remember_me?(token, generated_at)
104
104
  # TODO: Normalize the JSON type coercion along with the Timeoutable hook
105
- # in a single place https://github.com/plataformatec/devise/blob/ffe9d6d406e79108cf32a2c6a1d0b3828849c40b/lib/devise/hooks/timeoutable.rb#L14-L18
105
+ # in a single place https://github.com/heartcombo/devise/blob/ffe9d6d406e79108cf32a2c6a1d0b3828849c40b/lib/devise/hooks/timeoutable.rb#L14-L18
106
106
  if generated_at.is_a?(String)
107
107
  generated_at = time_from_json(generated_at)
108
108
  end
@@ -33,7 +33,7 @@ module Devise
33
33
  def update_tracked_fields!(request)
34
34
  # We have to check if the user is already persisted before running
35
35
  # `save` here because invalid users can be saved if we don't.
36
- # See https://github.com/plataformatec/devise/issues/4673 for more details.
36
+ # See https://github.com/heartcombo/devise/issues/4673 for more details.
37
37
  return if new_record?
38
38
 
39
39
  update_tracked_fields(request)
@@ -37,6 +37,8 @@ module Devise
37
37
  @response
38
38
  end
39
39
 
40
+ ruby2_keywords(:process) if respond_to?(:ruby2_keywords, true)
41
+
40
42
  # We need to set up the environment variables and the response in the controller.
41
43
  def setup_controller_for_warden #:nodoc:
42
44
  @request.env['action_controller.instance'] = @controller
@@ -28,7 +28,7 @@ module Devise
28
28
  end
29
29
  end
30
30
 
31
- # Signs in a specific resource, mimicking a successfull sign in
31
+ # Signs in a specific resource, mimicking a successful sign in
32
32
  # operation through +Devise::SessionsController#create+.
33
33
  #
34
34
  # * +resource+ - The resource that should be authenticated
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Devise
4
- VERSION = "4.7.1".freeze
4
+ VERSION = "4.7.2".freeze
5
5
  end
@@ -13,7 +13,7 @@ module Devise
13
13
  desc "Generates a model with the given NAME (if one does not exist) with devise " \
14
14
  "configuration plus a migration file and devise routes."
15
15
 
16
- hook_for :orm
16
+ hook_for :orm, type: :boolean
17
17
 
18
18
  class_option :routes, desc: "Generate routes", type: :boolean, default: true
19
19
 
@@ -37,10 +37,6 @@ module Devise
37
37
  def show_readme
38
38
  readme "README" if behavior == :invoke
39
39
  end
40
-
41
- def rails_4?
42
- Rails::VERSION::MAJOR == 4
43
- end
44
40
  end
45
41
  end
46
42
  end
@@ -42,7 +42,7 @@ module Devise
42
42
  def view_directory(name, _target_path = nil)
43
43
  directory name.to_s, _target_path || "#{target_path}/#{name}" do |content|
44
44
  if scope
45
- content.gsub "devise/shared/links", "#{plural_scope}/shared/links"
45
+ content.gsub("devise/shared", "#{plural_scope}/shared")
46
46
  else
47
47
  content
48
48
  end
@@ -1,6 +1,6 @@
1
1
  ===============================================================================
2
2
 
3
- Some setup you must do manually if you haven't yet:
3
+ Depending on your application's configuration some manual setup may be required:
4
4
 
5
5
  1. Ensure you have defined default url options in your environments files. Here
6
6
  is an example of default_url_options appropriate for a development environment
@@ -10,10 +10,14 @@ Some setup you must do manually if you haven't yet:
10
10
 
11
11
  In production, :host should be set to the actual host of your application.
12
12
 
13
+ * Required for all applications. *
14
+
13
15
  2. Ensure you have defined root_url to *something* in your config/routes.rb.
14
16
  For example:
15
17
 
16
18
  root to: "home#index"
19
+
20
+ * Not required for API-only Applications *
17
21
 
18
22
  3. Ensure you have flash messages in app/views/layouts/application.html.erb.
19
23
  For example:
@@ -21,8 +25,12 @@ Some setup you must do manually if you haven't yet:
21
25
  <p class="notice"><%= notice %></p>
22
26
  <p class="alert"><%= alert %></p>
23
27
 
28
+ * Not required for API-only Applications *
29
+
24
30
  4. You can copy Devise views (for customization) to your app by running:
25
31
 
26
32
  rails g devise:views
33
+
34
+ * Not required *
27
35
 
28
36
  ===============================================================================
@@ -9,7 +9,7 @@ class <%= @scope_prefix %>OmniauthCallbacksController < Devise::OmniauthCallback
9
9
  # end
10
10
 
11
11
  # More info at:
12
- # https://github.com/plataformatec/devise#omniauth
12
+ # https://github.com/heartcombo/devise#omniauth
13
13
 
14
14
  # GET|POST /resource/auth/twitter
15
15
  # def passthru
@@ -1,5 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # Assuming you have not yet modified this file, each configuration option below
4
+ # is set to its default value. Note that some are commented out while others
5
+ # are not: uncommented lines are intended to protect your configuration from
6
+ # breaking changes in upgrades (i.e., in the event that future versions of
7
+ # Devise change the default values for those options).
8
+ #
3
9
  # Use this hook to configure devise mailer, warden hooks and so forth.
4
10
  # Many of these configuration options can be set straight in your model.
5
11
  Devise.setup do |config|
@@ -68,7 +74,10 @@ Devise.setup do |config|
68
74
  # Tell if authentication through HTTP Auth is enabled. False by default.
69
75
  # It can be set to an array that will enable http authentication only for the
70
76
  # given strategies, for example, `config.http_authenticatable = [:database]` will
71
- # enable it only for database authentication. The supported strategies are:
77
+ # enable it only for database authentication.
78
+ # For API-only applications to support authentication "out-of-the-box", you will likely want to
79
+ # enable this with :database unless you are using a custom strategy.
80
+ # The supported strategies are:
72
81
  # :database = Support basic authentication with authentication key + password
73
82
  # config.http_authenticatable = false
74
83
 
@@ -103,15 +112,18 @@ Devise.setup do |config|
103
112
  # config.reload_routes = true
104
113
 
105
114
  # ==> Configuration for :database_authenticatable
106
- # For bcrypt, this is the cost for hashing the password and defaults to 11. If
115
+ # For bcrypt, this is the cost for hashing the password and defaults to 12. If
107
116
  # using other algorithms, it sets how many times you want the password to be hashed.
117
+ # The number of stretches used for generating the hashed password are stored
118
+ # with the hashed password. This allows you to change the stretches without
119
+ # invalidating existing passwords.
108
120
  #
109
121
  # Limiting the stretches to just one in testing will increase the performance of
110
122
  # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
111
123
  # a value less than 10 in other environments. Note that, for bcrypt (the default
112
124
  # algorithm), the cost increases exponentially with the number of stretches (e.g.
113
125
  # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
114
- config.stretches = Rails.env.test? ? 1 : 11
126
+ config.stretches = Rails.env.test? ? 1 : 12
115
127
 
116
128
  # Set up a pepper to generate the hashed password.
117
129
  # config.pepper = '<%= SecureRandom.hex(64) %>'
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devise
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.7.1
4
+ version: 4.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - José Valim
8
8
  - Carlos Antônio
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-09-06 00:00:00.000000000 Z
12
+ date: 2020-06-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: warden
@@ -82,7 +82,7 @@ dependencies:
82
82
  - !ruby/object:Gem::Version
83
83
  version: '0'
84
84
  description: Flexible authentication solution for Rails with Warden
85
- email: contact@plataformatec.com.br
85
+ email: heartcombo@googlegroups.com
86
86
  executables: []
87
87
  extensions: []
88
88
  extra_rdoc_files: []
@@ -198,11 +198,11 @@ files:
198
198
  - lib/generators/templates/simple_form_for/registrations/new.html.erb
199
199
  - lib/generators/templates/simple_form_for/sessions/new.html.erb
200
200
  - lib/generators/templates/simple_form_for/unlocks/new.html.erb
201
- homepage: https://github.com/plataformatec/devise
201
+ homepage: https://github.com/heartcombo/devise
202
202
  licenses:
203
203
  - MIT
204
204
  metadata: {}
205
- post_install_message:
205
+ post_install_message:
206
206
  rdoc_options: []
207
207
  require_paths:
208
208
  - lib
@@ -217,8 +217,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
217
217
  - !ruby/object:Gem::Version
218
218
  version: '0'
219
219
  requirements: []
220
- rubygems_version: 3.0.6
221
- signing_key:
220
+ rubygems_version: 3.0.3
221
+ signing_key:
222
222
  specification_version: 4
223
223
  summary: Flexible authentication solution for Rails with Warden
224
224
  test_files: []