devise 4.3.0 → 4.4.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of devise might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.travis.yml +10 -5
- data/CHANGELOG.md +20 -0
- data/Gemfile +2 -3
- data/Gemfile.lock +2 -3
- data/ISSUE_TEMPLATE.md +19 -0
- data/README.md +66 -2
- data/Rakefile +1 -0
- data/app/controllers/devise/confirmations_controller.rb +2 -0
- data/app/controllers/devise/omniauth_callbacks_controller.rb +3 -1
- data/app/controllers/devise/passwords_controller.rb +2 -0
- data/app/controllers/devise/registrations_controller.rb +5 -3
- data/app/controllers/devise/sessions_controller.rb +3 -1
- data/app/controllers/devise/unlocks_controller.rb +2 -0
- data/app/controllers/devise_controller.rb +2 -0
- data/app/helpers/devise_helper.rb +2 -0
- data/app/mailers/devise/mailer.rb +2 -0
- data/app/views/devise/confirmations/new.html.erb +1 -1
- data/app/views/devise/passwords/new.html.erb +1 -1
- data/app/views/devise/registrations/edit.html.erb +1 -1
- data/app/views/devise/registrations/new.html.erb +1 -1
- data/app/views/devise/sessions/new.html.erb +1 -1
- data/app/views/devise/unlocks/new.html.erb +1 -1
- data/devise.gemspec +2 -0
- data/gemfiles/Gemfile.rails-4.1-stable +3 -1
- data/gemfiles/Gemfile.rails-4.1-stable.lock +3 -3
- data/gemfiles/Gemfile.rails-4.2-stable +3 -1
- data/gemfiles/Gemfile.rails-4.2-stable.lock +3 -3
- data/gemfiles/Gemfile.rails-5.0-stable +2 -3
- data/gemfiles/Gemfile.rails-5.0-stable.lock +2 -3
- data/guides/bug_report_templates/integration_test.rb +2 -0
- data/lib/devise.rb +3 -1
- data/lib/devise/controllers/helpers.rb +7 -5
- data/lib/devise/controllers/rememberable.rb +2 -0
- data/lib/devise/controllers/scoped_views.rb +2 -0
- data/lib/devise/controllers/sign_in_out.rb +2 -0
- data/lib/devise/controllers/store_location.rb +24 -6
- data/lib/devise/controllers/url_helpers.rb +2 -0
- data/lib/devise/delegator.rb +2 -0
- data/lib/devise/encryptor.rb +2 -0
- data/lib/devise/failure_app.rb +2 -0
- data/lib/devise/hooks/activatable.rb +2 -0
- data/lib/devise/hooks/csrf_cleaner.rb +2 -0
- data/lib/devise/hooks/forgetable.rb +2 -0
- data/lib/devise/hooks/lockable.rb +2 -0
- data/lib/devise/hooks/proxy.rb +2 -0
- data/lib/devise/hooks/rememberable.rb +2 -0
- data/lib/devise/hooks/timeoutable.rb +2 -0
- data/lib/devise/hooks/trackable.rb +2 -0
- data/lib/devise/mailers/helpers.rb +2 -0
- data/lib/devise/mapping.rb +2 -0
- data/lib/devise/models.rb +2 -0
- data/lib/devise/models/authenticatable.rb +4 -2
- data/lib/devise/models/confirmable.rb +3 -1
- data/lib/devise/models/database_authenticatable.rb +3 -1
- data/lib/devise/models/lockable.rb +8 -2
- data/lib/devise/models/omniauthable.rb +2 -0
- data/lib/devise/models/recoverable.rb +2 -0
- data/lib/devise/models/registerable.rb +2 -0
- data/lib/devise/models/rememberable.rb +3 -1
- data/lib/devise/models/timeoutable.rb +2 -0
- data/lib/devise/models/trackable.rb +3 -1
- data/lib/devise/models/validatable.rb +3 -1
- data/lib/devise/modules.rb +2 -0
- data/lib/devise/omniauth.rb +2 -0
- data/lib/devise/omniauth/config.rb +2 -0
- data/lib/devise/omniauth/url_helpers.rb +2 -0
- data/lib/devise/orm/active_record.rb +2 -0
- data/lib/devise/orm/mongoid.rb +2 -0
- data/lib/devise/parameter_filter.rb +2 -0
- data/lib/devise/parameter_sanitizer.rb +2 -0
- data/lib/devise/rails.rb +2 -0
- data/lib/devise/rails/routes.rb +2 -0
- data/lib/devise/rails/warden_compat.rb +2 -0
- data/lib/devise/strategies/authenticatable.rb +2 -0
- data/lib/devise/strategies/base.rb +2 -0
- data/lib/devise/strategies/database_authenticatable.rb +2 -0
- data/lib/devise/strategies/rememberable.rb +2 -0
- data/lib/devise/test/controller_helpers.rb +2 -0
- data/lib/devise/test/integration_helpers.rb +2 -0
- data/lib/devise/test_helpers.rb +2 -0
- data/lib/devise/time_inflector.rb +2 -0
- data/lib/devise/token_generator.rb +2 -0
- data/lib/devise/version.rb +3 -1
- data/lib/generators/active_record/devise_generator.rb +15 -2
- data/lib/generators/active_record/templates/migration.rb +3 -1
- data/lib/generators/active_record/templates/migration_existing.rb +2 -0
- data/lib/generators/devise/controllers_generator.rb +2 -0
- data/lib/generators/devise/devise_generator.rb +4 -2
- data/lib/generators/devise/install_generator.rb +2 -0
- data/lib/generators/devise/orm_helpers.rb +7 -1
- data/lib/generators/devise/views_generator.rb +7 -8
- data/lib/generators/mongoid/devise_generator.rb +2 -0
- data/lib/generators/templates/controllers/confirmations_controller.rb +2 -0
- data/lib/generators/templates/controllers/omniauth_callbacks_controller.rb +2 -0
- data/lib/generators/templates/controllers/passwords_controller.rb +2 -0
- data/lib/generators/templates/controllers/registrations_controller.rb +2 -0
- data/lib/generators/templates/controllers/sessions_controller.rb +2 -0
- data/lib/generators/templates/controllers/unlocks_controller.rb +2 -0
- data/lib/generators/templates/devise.rb +2 -0
- data/test/controllers/custom_registrations_controller_test.rb +2 -0
- data/test/controllers/custom_strategy_test.rb +2 -0
- data/test/controllers/helper_methods_test.rb +2 -0
- data/test/controllers/helpers_test.rb +2 -0
- data/test/controllers/inherited_controller_i18n_messages_test.rb +2 -0
- data/test/controllers/internal_helpers_test.rb +2 -0
- data/test/controllers/load_hooks_controller_test.rb +2 -0
- data/test/controllers/passwords_controller_test.rb +2 -0
- data/test/controllers/sessions_controller_test.rb +2 -0
- data/test/controllers/url_helpers_test.rb +2 -0
- data/test/delegator_test.rb +2 -0
- data/test/devise_test.rb +2 -0
- data/test/failure_app_test.rb +2 -0
- data/test/generators/active_record_generator_test.rb +47 -0
- data/test/generators/controllers_generator_test.rb +2 -0
- data/test/generators/devise_generator_test.rb +2 -0
- data/test/generators/install_generator_test.rb +2 -0
- data/test/generators/mongoid_generator_test.rb +2 -0
- data/test/generators/views_generator_test.rb +2 -0
- data/test/helpers/devise_helper_test.rb +2 -0
- data/test/integration/authenticatable_test.rb +15 -1
- data/test/integration/confirmable_test.rb +2 -0
- data/test/integration/database_authenticatable_test.rb +2 -0
- data/test/integration/http_authenticatable_test.rb +2 -0
- data/test/integration/lockable_test.rb +5 -3
- data/test/integration/mounted_engine_test.rb +2 -0
- data/test/integration/omniauthable_test.rb +2 -0
- data/test/integration/recoverable_test.rb +2 -0
- data/test/integration/registerable_test.rb +2 -0
- data/test/integration/rememberable_test.rb +2 -0
- data/test/integration/timeoutable_test.rb +2 -0
- data/test/integration/trackable_test.rb +2 -0
- data/test/mailers/confirmation_instructions_test.rb +2 -0
- data/test/mailers/email_changed_test.rb +2 -0
- data/test/mailers/mailer_test.rb +2 -0
- data/test/mailers/reset_password_instructions_test.rb +2 -0
- data/test/mailers/unlock_instructions_test.rb +2 -0
- data/test/mapping_test.rb +2 -0
- data/test/models/authenticatable_test.rb +2 -0
- data/test/models/confirmable_test.rb +2 -0
- data/test/models/database_authenticatable_test.rb +2 -0
- data/test/models/lockable_test.rb +2 -0
- data/test/models/omniauthable_test.rb +2 -0
- data/test/models/recoverable_test.rb +2 -0
- data/test/models/registerable_test.rb +2 -0
- data/test/models/rememberable_test.rb +2 -0
- data/test/models/serializable_test.rb +6 -0
- data/test/models/timeoutable_test.rb +2 -0
- data/test/models/trackable_test.rb +11 -0
- data/test/models/validatable_test.rb +4 -2
- data/test/models_test.rb +2 -0
- data/test/omniauth/config_test.rb +2 -0
- data/test/omniauth/url_helpers_test.rb +2 -0
- data/test/orm/active_record.rb +2 -0
- data/test/orm/mongoid.rb +3 -1
- data/test/parameter_sanitizer_test.rb +2 -0
- data/test/rails_app/app/active_record/admin.rb +2 -0
- data/test/rails_app/app/active_record/shim.rb +2 -0
- data/test/rails_app/app/active_record/user.rb +4 -0
- data/test/rails_app/app/active_record/user_on_engine.rb +2 -0
- data/test/rails_app/app/active_record/user_on_main_app.rb +2 -0
- data/test/rails_app/app/active_record/user_with_validations.rb +12 -0
- data/test/rails_app/app/active_record/user_without_email.rb +2 -0
- data/test/rails_app/app/controllers/admins/sessions_controller.rb +2 -0
- data/test/rails_app/app/controllers/admins_controller.rb +2 -0
- data/test/rails_app/app/controllers/application_controller.rb +2 -0
- data/test/rails_app/app/controllers/application_with_fake_engine.rb +2 -0
- data/test/rails_app/app/controllers/custom/registrations_controller.rb +2 -0
- data/test/rails_app/app/controllers/home_controller.rb +2 -0
- data/test/rails_app/app/controllers/publisher/registrations_controller.rb +2 -0
- data/test/rails_app/app/controllers/publisher/sessions_controller.rb +2 -0
- data/test/rails_app/app/controllers/users/omniauth_callbacks_controller.rb +2 -0
- data/test/rails_app/app/controllers/users_controller.rb +2 -0
- data/test/rails_app/app/helpers/application_helper.rb +2 -0
- data/test/rails_app/app/mailers/users/from_proc_mailer.rb +2 -0
- data/test/rails_app/app/mailers/users/mailer.rb +2 -0
- data/test/rails_app/app/mailers/users/reply_to_mailer.rb +2 -0
- data/test/rails_app/app/mongoid/admin.rb +2 -0
- data/test/rails_app/app/mongoid/shim.rb +2 -0
- data/test/rails_app/app/mongoid/user.rb +2 -0
- data/test/rails_app/app/mongoid/user_on_engine.rb +2 -0
- data/test/rails_app/app/mongoid/user_on_main_app.rb +2 -0
- data/test/rails_app/app/mongoid/user_with_validations.rb +37 -0
- data/test/rails_app/app/mongoid/user_without_email.rb +2 -0
- data/test/rails_app/config/application.rb +2 -0
- data/test/rails_app/config/boot.rb +2 -0
- data/test/rails_app/config/environment.rb +2 -0
- data/test/rails_app/config/environments/development.rb +2 -0
- data/test/rails_app/config/environments/production.rb +2 -0
- data/test/rails_app/config/environments/test.rb +2 -0
- data/test/rails_app/config/initializers/backtrace_silencers.rb +2 -0
- data/test/rails_app/config/initializers/devise.rb +2 -0
- data/test/rails_app/config/initializers/inflections.rb +2 -0
- data/test/rails_app/config/initializers/secret_token.rb +2 -0
- data/test/rails_app/config/initializers/session_store.rb +2 -0
- data/test/rails_app/config/routes.rb +2 -0
- data/test/rails_app/db/migrate/20100401102949_create_tables.rb +2 -0
- data/test/rails_app/db/schema.rb +2 -0
- data/test/rails_app/lib/shared_admin.rb +2 -0
- data/test/rails_app/lib/shared_user.rb +2 -0
- data/test/rails_app/lib/shared_user_without_email.rb +2 -0
- data/test/rails_app/lib/shared_user_without_omniauth.rb +2 -0
- data/test/rails_test.rb +2 -0
- data/test/routes_test.rb +2 -0
- data/test/support/action_controller/record_identifier.rb +2 -0
- data/test/support/assertions.rb +2 -0
- data/test/support/helpers.rb +6 -0
- data/test/support/http_method_compatibility.rb +2 -0
- data/test/support/integration.rb +2 -0
- data/test/support/webrat/integrations/rails.rb +2 -0
- data/test/test/controller_helpers_test.rb +2 -0
- data/test/test/integration_helpers_test.rb +2 -0
- data/test/test_helper.rb +2 -0
- data/test/test_models.rb +2 -0
- metadata +8 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 88289e9acf977a7ec40baba9cc607ad802dd6d7e
|
4
|
+
data.tar.gz: b197dc5fb03fed5d94eae9ac6e3a740d7cb3f10a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 84eef3b02c2b5ca07e7562ac7fa7bb310d465618e25aaa739e94ed96d1a4e4abfcaa997d61d6ca247d7580b661b1f81a9d49229c65deae0673254f5edee02ac8
|
7
|
+
data.tar.gz: e52854fb48db7795e89c3542df182842499982332a5f11c0a8f802262b3d67049f21bbed01311763f1b160e8e514077f1d75ce8c2ea8b1eb9828eba6f248f6c6
|
data/.travis.yml
CHANGED
@@ -2,9 +2,10 @@ language: ruby
|
|
2
2
|
|
3
3
|
rvm:
|
4
4
|
- 2.1.10
|
5
|
-
- 2.2.
|
6
|
-
- 2.3.
|
7
|
-
- 2.4.
|
5
|
+
- 2.2.8
|
6
|
+
- 2.3.5
|
7
|
+
- 2.4.2
|
8
|
+
- 2.5.0
|
8
9
|
- ruby-head
|
9
10
|
|
10
11
|
gemfile:
|
@@ -17,7 +18,9 @@ matrix:
|
|
17
18
|
exclude:
|
18
19
|
- rvm: 2.1.10
|
19
20
|
gemfile: Gemfile
|
20
|
-
- rvm: 2.
|
21
|
+
- rvm: 2.5.0
|
22
|
+
gemfile: gemfiles/Gemfile.rails-4.1-stable
|
23
|
+
- rvm: 2.4.2
|
21
24
|
gemfile: gemfiles/Gemfile.rails-4.1-stable
|
22
25
|
- rvm: ruby-head
|
23
26
|
gemfile: gemfiles/Gemfile.rails-4.1-stable
|
@@ -43,7 +46,9 @@ env:
|
|
43
46
|
- DEVISE_ORM=active_record
|
44
47
|
- DEVISE_ORM=mongoid
|
45
48
|
|
46
|
-
before_install:
|
49
|
+
before_install:
|
50
|
+
- "rm ${BUNDLE_GEMFILE}.lock"
|
51
|
+
- gem update --system
|
47
52
|
|
48
53
|
before_script: "bundle update"
|
49
54
|
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,23 @@
|
|
1
|
+
### Unreleased
|
2
|
+
|
3
|
+
### 4.4.0 - 2017-12-29
|
4
|
+
|
5
|
+
* enhancements
|
6
|
+
* Add `frozen_string_literal` pragma comment to all Ruby files. (by @pat)
|
7
|
+
* Use `set_flash_method!` instead of `set_flash_method` in `Devise::OmniauthCallbacksController#failure`. (by @saichander17)
|
8
|
+
* Clarify how `store_location_for` modifies URIs. (by @olivierlacan)
|
9
|
+
* Move `failed_attempts` increment into its own function. by (@mobilutz)
|
10
|
+
* Add `autocomplete="email"` to email fields. by (@MikeRogers0)
|
11
|
+
* Add the ability to change the default migrations path introduced in Rails 5.0.3. (by @alexhifer)
|
12
|
+
* Delete unnecessary condition for helper method. (by @davydovanton)
|
13
|
+
* Support `id: :uuid` option for migrations. (by @filip373)
|
14
|
+
|
15
|
+
* bug fixes
|
16
|
+
* Fix syntax for MRI 2.5.0. (by @pat)
|
17
|
+
* Validations were being ignored on singup in the `Trackable#update_tracked_fields!` method. (by @AshleyFoster)
|
18
|
+
* Do not modify options for `#serializable_hash`. (by @guigs)
|
19
|
+
* Email confirmations were being sent on sign in/sign out for application using `mongoid` and `mongoid-paperclip` gems. This is because previously we were checking if a model is from Active Record by checking if the method `after_commit` was defined - since `mongoid` doesn' have one - but `mongoid-paperclip` gem does define one, which cause this issue. (by @fjg)
|
20
|
+
|
1
21
|
### 4.3.0 - 2017-05-14
|
2
22
|
|
3
23
|
* Enhancements
|
data/Gemfile
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
source "https://rubygems.org"
|
2
4
|
|
3
5
|
gemspec
|
@@ -14,9 +16,6 @@ gem "rails-controller-testing"
|
|
14
16
|
|
15
17
|
gem "responders", "~> 2.1"
|
16
18
|
|
17
|
-
# TODO: Remove this line when Rails 5.1.1 is released
|
18
|
-
gem "minitest", "< 5.10.2"
|
19
|
-
|
20
19
|
group :test do
|
21
20
|
gem "omniauth-facebook"
|
22
21
|
gem "omniauth-openid"
|
data/Gemfile.lock
CHANGED
@@ -10,7 +10,7 @@ GIT
|
|
10
10
|
PATH
|
11
11
|
remote: .
|
12
12
|
specs:
|
13
|
-
devise (4.
|
13
|
+
devise (4.4.0)
|
14
14
|
bcrypt (~> 3.0)
|
15
15
|
orm_adapter (~> 0.1)
|
16
16
|
railties (>= 4.1.0, < 5.2)
|
@@ -176,7 +176,6 @@ DEPENDENCIES
|
|
176
176
|
activerecord-jdbcsqlite3-adapter
|
177
177
|
devise!
|
178
178
|
jruby-openssl
|
179
|
-
minitest (< 5.10.2)
|
180
179
|
mocha (~> 1.1)
|
181
180
|
oauth2
|
182
181
|
omniauth (~> 1.3)
|
@@ -191,4 +190,4 @@ DEPENDENCIES
|
|
191
190
|
webrat (= 0.7.3)
|
192
191
|
|
193
192
|
BUNDLED WITH
|
194
|
-
1.
|
193
|
+
1.15.3
|
data/ISSUE_TEMPLATE.md
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
## Precheck
|
2
|
+
|
3
|
+
- Do not use the issues tracker for help or support, try Stack Overflow.
|
4
|
+
- For bugs, do a quick search and make sure the bug has not yet been reported
|
5
|
+
- Finally, be nice and have fun!
|
6
|
+
|
7
|
+
## Environment
|
8
|
+
|
9
|
+
- Ruby **[version]**
|
10
|
+
- Rails **[version]**
|
11
|
+
- Devise **[version]**
|
12
|
+
|
13
|
+
## Current behavior
|
14
|
+
|
15
|
+
Include code samples, errors, steps to reproduce the error and stacktraces if appropriate.
|
16
|
+
|
17
|
+
Will be even more helpful if you provide a sample application or a test case that reproduces the error.
|
18
|
+
|
19
|
+
## Expected behavior
|
data/README.md
CHANGED
@@ -27,6 +27,50 @@ It's composed of 10 modules:
|
|
27
27
|
* [Validatable](http://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
28
|
* [Lockable](http://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.
|
29
29
|
|
30
|
+
## Table of Contents
|
31
|
+
|
32
|
+
<!-- TOC depthFrom:1 depthTo:6 withLinks:1 orderedList:0 -->
|
33
|
+
|
34
|
+
- [Information](#information)
|
35
|
+
- [The Devise wiki](#the-devise-wiki)
|
36
|
+
- [Bug reports](#bug-reports)
|
37
|
+
- [StackOverflow and Mailing List](#stackoverflow-and-mailing-list)
|
38
|
+
- [RDocs](#rdocs)
|
39
|
+
- [Example applications](#example-applications)
|
40
|
+
- [Extensions](#extensions)
|
41
|
+
- [Contributing](#contributing)
|
42
|
+
- [Starting with Rails?](#starting-with-rails)
|
43
|
+
- [Getting started](#getting-started)
|
44
|
+
- [Controller filters and helpers](#controller-filters-and-helpers)
|
45
|
+
- [Configuring Models](#configuring-models)
|
46
|
+
- [Strong Parameters](#strong-parameters)
|
47
|
+
- [Configuring views](#configuring-views)
|
48
|
+
- [Configuring controllers](#configuring-controllers)
|
49
|
+
- [Configuring routes](#configuring-routes)
|
50
|
+
- [I18n](#i18n)
|
51
|
+
- [Test helpers](#test-helpers)
|
52
|
+
- [Controller tests](#controller-tests)
|
53
|
+
- [Integration tests](#integration-tests)
|
54
|
+
- [OmniAuth](#omniauth)
|
55
|
+
- [Configuring multiple models](#configuring-multiple-models)
|
56
|
+
- [Create a migration with the required fields](#create-a-migration-with-the-required-fields)
|
57
|
+
- [Inside your Admin model](#inside-your-admin-model)
|
58
|
+
- [Inside your routes](#inside-your-routes)
|
59
|
+
- [Inside your protected controller](#inside-your-protected-controller)
|
60
|
+
- [Inside your controllers and views](#inside-your-controllers-and-views)
|
61
|
+
- [ActiveJob Integration](#activejob-integration)
|
62
|
+
- [Password reset tokens and Rails logs](#password-reset-tokens-and-rails-logs)
|
63
|
+
- [Other ORMs](#other-orms)
|
64
|
+
- [Additional information](#additional-information)
|
65
|
+
- [Heroku](#heroku)
|
66
|
+
- [Warden](#warden)
|
67
|
+
- [Contributors](#contributors)
|
68
|
+
- [License](#license)
|
69
|
+
|
70
|
+
<!-- /TOC -->
|
71
|
+
|
72
|
+
|
73
|
+
|
30
74
|
## Information
|
31
75
|
|
32
76
|
### The Devise wiki
|
@@ -126,7 +170,7 @@ Next, check the MODEL for any additional configuration options you might want to
|
|
126
170
|
|
127
171
|
Then run `rails db:migrate`
|
128
172
|
|
129
|
-
You should restart your application after changing Devise's configuration options. Otherwise, you will run into strange errors, for example, users being unable to login and route helpers being undefined.
|
173
|
+
You should restart your application after changing Devise's configuration options (this includes stopping spring). Otherwise, you will run into strange errors, for example, users being unable to login and route helpers being undefined.
|
130
174
|
|
131
175
|
### Controller filters and helpers
|
132
176
|
|
@@ -216,7 +260,21 @@ class ApplicationController < ActionController::Base
|
|
216
260
|
end
|
217
261
|
```
|
218
262
|
|
219
|
-
The above works for any additional fields where the parameters are simple scalar types. If you have nested attributes (say you're using `accepts_nested_attributes_for`), then you will need to tell devise about those nestings and types
|
263
|
+
The above works for any additional fields where the parameters are simple scalar types. If you have nested attributes (say you're using `accepts_nested_attributes_for`), then you will need to tell devise about those nestings and types:
|
264
|
+
|
265
|
+
```ruby
|
266
|
+
class ApplicationController < ActionController::Base
|
267
|
+
before_action :configure_permitted_parameters, if: :devise_controller?
|
268
|
+
|
269
|
+
protected
|
270
|
+
|
271
|
+
def configure_permitted_parameters
|
272
|
+
devise_parameter_sanitizer.permit(:sign_up, keys: [:first_name, :last_name, address_attributes: [:country, :state, :city, :area, :postal_code]])
|
273
|
+
end
|
274
|
+
end
|
275
|
+
```
|
276
|
+
|
277
|
+
Devise allows you to completely change Devise defaults or invoke custom behaviour by passing a block:
|
220
278
|
|
221
279
|
To permit simple scalar values for username and email, use this
|
222
280
|
|
@@ -374,6 +432,12 @@ end
|
|
374
432
|
|
375
433
|
This way, you tell Devise to use the scope `:user` when "/sign_in" is accessed. Notice `devise_scope` is also aliased as `as` in your router.
|
376
434
|
|
435
|
+
Please note: You will still need to add `devise_for` in your routes in order to use helper methods such as `current_user`.
|
436
|
+
|
437
|
+
```ruby
|
438
|
+
devise_for :users, skip: :all
|
439
|
+
```
|
440
|
+
|
377
441
|
### I18n
|
378
442
|
|
379
443
|
Devise uses flash messages with I18n, in conjunction with the flash keys :notice and :alert. To customize your app, you can set up your locale file:
|
data/Rakefile
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class Devise::OmniauthCallbacksController < DeviseController
|
2
4
|
prepend_before_action { request.env["devise.skip_timeout"] = true }
|
3
5
|
|
@@ -6,7 +8,7 @@ class Devise::OmniauthCallbacksController < DeviseController
|
|
6
8
|
end
|
7
9
|
|
8
10
|
def failure
|
9
|
-
set_flash_message :alert, :failure, kind: OmniAuth::Utils.camelize(failed_strategy.name), reason: failure_message
|
11
|
+
set_flash_message! :alert, :failure, kind: OmniAuth::Utils.camelize(failed_strategy.name), reason: failure_message
|
10
12
|
redirect_to after_omniauth_failure_path_for(resource_name)
|
11
13
|
end
|
12
14
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class Devise::RegistrationsController < DeviseController
|
2
4
|
prepend_before_action :require_no_authentication, only: [:new, :create, :cancel]
|
3
5
|
prepend_before_action :authenticate_scope!, only: [:edit, :update, :destroy]
|
@@ -5,7 +7,7 @@ class Devise::RegistrationsController < DeviseController
|
|
5
7
|
|
6
8
|
# GET /resource/sign_up
|
7
9
|
def new
|
8
|
-
build_resource
|
10
|
+
build_resource
|
9
11
|
yield resource if block_given?
|
10
12
|
respond_with resource
|
11
13
|
end
|
@@ -97,8 +99,8 @@ class Devise::RegistrationsController < DeviseController
|
|
97
99
|
|
98
100
|
# Build a devise resource passing in the session. Useful to move
|
99
101
|
# temporary session data to the newly created user.
|
100
|
-
def build_resource(hash=
|
101
|
-
self.resource = resource_class.new_with_session(hash
|
102
|
+
def build_resource(hash = {})
|
103
|
+
self.resource = resource_class.new_with_session(hash, session)
|
102
104
|
end
|
103
105
|
|
104
106
|
# Signs in a user on sign up. You can overwrite this method in your own
|
@@ -1,8 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class Devise::SessionsController < DeviseController
|
2
4
|
prepend_before_action :require_no_authentication, only: [:new, :create]
|
3
5
|
prepend_before_action :allow_params_authentication!, only: :create
|
4
6
|
prepend_before_action :verify_signed_out_user, only: :destroy
|
5
|
-
prepend_before_action
|
7
|
+
prepend_before_action(only: [:create, :destroy]) { request.env["devise.skip_timeout"] = true }
|
6
8
|
|
7
9
|
# GET /resource/sign_in
|
8
10
|
def new
|
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
<div class="field">
|
7
7
|
<%= f.label :email %><br />
|
8
|
-
<%= f.email_field :email, autofocus: true, value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) %>
|
8
|
+
<%= f.email_field :email, autofocus: true, autocomplete: "email", value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) %>
|
9
9
|
</div>
|
10
10
|
|
11
11
|
<div class="actions">
|
@@ -3,7 +3,7 @@
|
|
3
3
|
<%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
|
4
4
|
<div class="field">
|
5
5
|
<%= f.label :email %><br />
|
6
|
-
<%= f.email_field :email, autofocus: true %>
|
6
|
+
<%= f.email_field :email, autofocus: true, autocomplete: "email" %>
|
7
7
|
</div>
|
8
8
|
|
9
9
|
<div class="field">
|
data/devise.gemspec
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
source "https://rubygems.org"
|
2
4
|
|
3
5
|
gemspec path: ".."
|
@@ -5,7 +7,7 @@ gemspec path: ".."
|
|
5
7
|
gem "rails", github: "rails/rails", branch: "4-1-stable"
|
6
8
|
gem "omniauth"
|
7
9
|
gem "omniauth-oauth2"
|
8
|
-
gem "rdoc"
|
10
|
+
gem "rdoc", "~> 5.1"
|
9
11
|
|
10
12
|
group :test do
|
11
13
|
gem "omniauth-facebook"
|
@@ -21,7 +21,7 @@ GIT
|
|
21
21
|
PATH
|
22
22
|
remote: ..
|
23
23
|
specs:
|
24
|
-
devise (4.
|
24
|
+
devise (4.4.0)
|
25
25
|
bcrypt (~> 3.0)
|
26
26
|
orm_adapter (~> 0.1)
|
27
27
|
railties (>= 4.1.0, < 5.2)
|
@@ -162,10 +162,10 @@ DEPENDENCIES
|
|
162
162
|
omniauth-oauth2
|
163
163
|
omniauth-openid
|
164
164
|
rails!
|
165
|
-
rdoc
|
165
|
+
rdoc (~> 5.1)
|
166
166
|
sqlite3
|
167
167
|
test_after_commit
|
168
168
|
webrat (= 0.7.3)
|
169
169
|
|
170
170
|
BUNDLED WITH
|
171
|
-
1.
|
171
|
+
1.15.3
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
source "https://rubygems.org"
|
2
4
|
|
3
5
|
gemspec path: ".."
|
@@ -5,7 +7,7 @@ gemspec path: ".."
|
|
5
7
|
gem "rails", github: "rails/rails", branch: "4-2-stable"
|
6
8
|
gem "omniauth"
|
7
9
|
gem "omniauth-oauth2"
|
8
|
-
gem "rdoc"
|
10
|
+
gem "rdoc", "~> 5.1"
|
9
11
|
|
10
12
|
group :test do
|
11
13
|
gem "omniauth-facebook"
|