mirror of
https://github.com/heartcombo/devise.git
synced 2026-01-09 15:47:59 -05:00
Compare commits
243 Commits
v4.7.3
...
731074bf09
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
731074bf09 | ||
|
|
35920d27e5 | ||
|
|
00a97782cb | ||
|
|
119a40f9d3 | ||
|
|
1096b60967 | ||
|
|
fc466316df | ||
|
|
356b094312 | ||
|
|
9a149ff139 | ||
|
|
05bbc71446 | ||
|
|
8054ad55c3 | ||
|
|
d13ef89afb | ||
|
|
051f94a498 | ||
|
|
cd9c21a067 | ||
|
|
6f8f38d795 | ||
|
|
c8a64b549c | ||
|
|
95618806c4 | ||
|
|
47e8716493 | ||
|
|
c6b08ae7e1 | ||
|
|
ef2d4831ef | ||
|
|
97cf37eb56 | ||
|
|
b0867c998c | ||
|
|
fa052e5064 | ||
|
|
dd7ee27f74 | ||
|
|
b76d18d277 | ||
|
|
f150357c1c | ||
|
|
d60f810086 | ||
|
|
5a82ad5740 | ||
|
|
1cf31d45eb | ||
|
|
141ef37339 | ||
|
|
dbc8e77ea0 | ||
|
|
9c5e4d3c4e | ||
|
|
fa4749dddc | ||
|
|
b02bb5b75a | ||
|
|
23058dcc62 | ||
|
|
cf93de390a | ||
|
|
46cae66baf | ||
|
|
a78ad3f20c | ||
|
|
fec67f98f2 | ||
|
|
560a1cb16f | ||
|
|
dce20b78f5 | ||
|
|
46c2c3913e | ||
|
|
7eccc91f61 | ||
|
|
af112a2f65 | ||
|
|
90a3fa8599 | ||
|
|
950721d6de | ||
|
|
591b03a6c0 | ||
|
|
24c47140e5 | ||
|
|
0f514f1413 | ||
|
|
12f0dd1608 | ||
|
|
12c796e499 | ||
|
|
baf0d8eff2 | ||
|
|
5b15bbee7a | ||
|
|
25f806e270 | ||
|
|
72884642f5 | ||
|
|
54e4b267a5 | ||
|
|
0a2505ee23 | ||
|
|
1d859b5db0 | ||
|
|
a259ff3c28 | ||
|
|
9a7176f727 | ||
|
|
21deb5c145 | ||
|
|
6ee12d1521 | ||
|
|
c80026d955 | ||
|
|
bb18f4d380 | ||
|
|
b6d64ba525 | ||
|
|
e2242a95f3 | ||
|
|
c4578d3240 | ||
|
|
5667ceaa1e | ||
|
|
4d18d81311 | ||
|
|
63939c121e | ||
|
|
49e4a991cf | ||
|
|
72b421e571 | ||
|
|
23633b70f0 | ||
|
|
c8207373ea | ||
|
|
c4701866ae | ||
|
|
e688b2f256 | ||
|
|
1d6658097e | ||
|
|
dcbfb32e66 | ||
|
|
9064ecbf15 | ||
|
|
4484eddc52 | ||
|
|
c146b25f31 | ||
|
|
9a08620378 | ||
|
|
407f223c65 | ||
|
|
f2a42abbf4 | ||
|
|
218d14a227 | ||
|
|
501ae58a25 | ||
|
|
373d83cc9d | ||
|
|
fb7faf7466 | ||
|
|
9784555304 | ||
|
|
13cb6e269d | ||
|
|
a7d64ae313 | ||
|
|
34cb23ed9c | ||
|
|
14aa380d80 | ||
|
|
c4c8fad66c | ||
|
|
f6e73e5b5c | ||
|
|
f8f035155b | ||
|
|
9f80dc2562 | ||
|
|
5b22538ae5 | ||
|
|
ec0674523e | ||
|
|
1b0ef1d2fe | ||
|
|
4f82235630 | ||
|
|
8bb41ad98e | ||
|
|
e81ec9c436 | ||
|
|
ed1c2a1adb | ||
|
|
9be24c0ae4 | ||
|
|
19d9dabc80 | ||
|
|
285dc5d2fc | ||
|
|
aeb24bf804 | ||
|
|
aca0b24118 | ||
|
|
e524a3d22d | ||
|
|
1a3d1ae350 | ||
|
|
fc731a88bb | ||
|
|
6d058bfde8 | ||
|
|
ad172bd547 | ||
|
|
1195c6f0d6 | ||
|
|
54a624a34b | ||
|
|
48e115334b | ||
|
|
c809adeeed | ||
|
|
e1298c87d7 | ||
|
|
882dd70a9f | ||
|
|
4b72064bfc | ||
|
|
8b0b849a67 | ||
|
|
4f849f4fa9 | ||
|
|
3926e6d9eb | ||
|
|
506eaf495d | ||
|
|
8dbe5b2fe8 | ||
|
|
207ddc5127 | ||
|
|
367ea42762 | ||
|
|
89a08357d6 | ||
|
|
eed51179c7 | ||
|
|
11b6a99e88 | ||
|
|
232c855c54 | ||
|
|
afec6655c7 | ||
|
|
7d1dc56fdb | ||
|
|
890bd9e3b5 | ||
|
|
1e63c640c0 | ||
|
|
8acbdd6d93 | ||
|
|
400eaf7fbe | ||
|
|
df8b79a53f | ||
|
|
ef6c73b221 | ||
|
|
c7a719a979 | ||
|
|
60c5774ff4 | ||
|
|
90f46bac37 | ||
|
|
ee8f0f8e83 | ||
|
|
41e2db2120 | ||
|
|
7f419bf99a | ||
|
|
44f0fd741f | ||
|
|
2d655ea46e | ||
|
|
49ed129c40 | ||
|
|
8e2e3f6fda | ||
|
|
31c4f31ef4 | ||
|
|
8606e1e671 | ||
|
|
2df5efcece | ||
|
|
43c349a2fc | ||
|
|
0d392fa49f | ||
|
|
d0f0853c75 | ||
|
|
88625d488f | ||
|
|
f08e0ad24a | ||
|
|
3632ddf674 | ||
|
|
cddba28945 | ||
|
|
032c4476ae | ||
|
|
319d9fa648 | ||
|
|
59bedaa1e7 | ||
|
|
fc1ac76ddf | ||
|
|
41003bf5de | ||
|
|
6d32d2447c | ||
|
|
d4bf52bdfd | ||
|
|
f8d1ea90bc | ||
|
|
2fa9303ab3 | ||
|
|
b5172a0cdb | ||
|
|
e1c53d6580 | ||
|
|
875217d8c1 | ||
|
|
55eabee800 | ||
|
|
8d4c3647a7 | ||
|
|
700284fc67 | ||
|
|
1542b7da29 | ||
|
|
a78948f53c | ||
|
|
451ff6d49c | ||
|
|
542df3634b | ||
|
|
3c5acaf531 | ||
|
|
025b1c8734 | ||
|
|
43800b4b85 | ||
|
|
baf5e00544 | ||
|
|
289dd5f221 | ||
|
|
9f5b83750e | ||
|
|
1ac16b15e3 | ||
|
|
353d86e01c | ||
|
|
8593801130 | ||
|
|
bb879f7154 | ||
|
|
772b74a657 | ||
|
|
51bf327017 | ||
|
|
14eb1362e3 | ||
|
|
f3e8fd3baa | ||
|
|
a0ccc1cf96 | ||
|
|
b39faffde4 | ||
|
|
366a428b2c | ||
|
|
7d103bc627 | ||
|
|
bdd2e7e24f | ||
|
|
c82e4cf47b | ||
|
|
63ccdfb34a | ||
|
|
2ee0068d77 | ||
|
|
57d1a1d381 | ||
|
|
5d5636f03a | ||
|
|
a3ae35e9c9 | ||
|
|
e8e0c27599 | ||
|
|
429afcbe8a | ||
|
|
ef9a2f4104 | ||
|
|
0cd72a56f9 | ||
|
|
1ba53dc369 | ||
|
|
faef12cf2b | ||
|
|
c82a381f29 | ||
|
|
a793472a3e | ||
|
|
ad91686b62 | ||
|
|
1bb5fcbbec | ||
|
|
80423c8f01 | ||
|
|
743b6937e2 | ||
|
|
e16d60d0fe | ||
|
|
9d16f33c7b | ||
|
|
c9a0f896cc | ||
|
|
aa8d89579a | ||
|
|
210c62af38 | ||
|
|
3048fe0960 | ||
|
|
628f2fb2be | ||
|
|
13ba27497b | ||
|
|
7386f419e3 | ||
|
|
e07932c181 | ||
|
|
d0eafe70dc | ||
|
|
7e6da424e2 | ||
|
|
81bf3ad8c1 | ||
|
|
51c05a5b21 | ||
|
|
1d138dd40c | ||
|
|
c43ae8cb47 | ||
|
|
cd60c747cc | ||
|
|
837baaf2e1 | ||
|
|
e0395367e4 | ||
|
|
fb17e2755f | ||
|
|
f4462cd85e | ||
|
|
8bb358cf80 | ||
|
|
98fc5e8e39 | ||
|
|
dfbed22cee | ||
|
|
fd03f9e353 | ||
|
|
a19e78cdb4 | ||
|
|
b88af5d65e | ||
|
|
45b831c4ea |
25
.devcontainer/devcontainer.json
Normal file
25
.devcontainer/devcontainer.json
Normal file
@@ -0,0 +1,25 @@
|
||||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
|
||||
// README at: https://github.com/devcontainers/templates/tree/main/src/ruby
|
||||
{
|
||||
"name": "Ruby",
|
||||
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
|
||||
"image": "mcr.microsoft.com/devcontainers/ruby:0-3-bullseye",
|
||||
"features": {
|
||||
"ghcr.io/devcontainers/features/github-cli:1": {}
|
||||
},
|
||||
|
||||
// Features to add to the dev container. More info: https://containers.dev/features.
|
||||
// "features": {},
|
||||
|
||||
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||
// "forwardPorts": [],
|
||||
|
||||
// Use 'postCreateCommand' to run commands after the container is created.
|
||||
"postCreateCommand": "bundle install",
|
||||
|
||||
// Configure tool-specific properties.
|
||||
// "customizations": {},
|
||||
|
||||
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
|
||||
// "remoteUser": "root"
|
||||
}
|
||||
6
.github/dependabot.yml
vendored
Normal file
6
.github/dependabot.yml
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
63
.github/workflows/test.yml
vendored
Normal file
63
.github/workflows/test.yml
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
name: Test
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
test:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
gemfile:
|
||||
- Gemfile
|
||||
- gemfiles/Gemfile-rails-main
|
||||
- gemfiles/Gemfile-rails-7-0
|
||||
- gemfiles/Gemfile-rails-7-1
|
||||
- gemfiles/Gemfile-rails-7-2
|
||||
- gemfiles/Gemfile-rails-8-0
|
||||
ruby:
|
||||
- '4.0'
|
||||
- '3.4'
|
||||
- '3.3'
|
||||
- '3.2'
|
||||
- '3.1'
|
||||
- '3.0'
|
||||
- '2.7'
|
||||
orm:
|
||||
- active_record
|
||||
- mongoid
|
||||
exclude:
|
||||
- gemfile: Gemfile
|
||||
ruby: '3.1'
|
||||
- gemfile: Gemfile
|
||||
ruby: '3.0'
|
||||
- gemfile: Gemfile
|
||||
ruby: '2.7'
|
||||
- gemfile: gemfiles/Gemfile-rails-main
|
||||
ruby: '3.2'
|
||||
- gemfile: gemfiles/Gemfile-rails-main
|
||||
ruby: '3.1'
|
||||
- gemfile: gemfiles/Gemfile-rails-main
|
||||
ruby: '3.0'
|
||||
- gemfile: gemfiles/Gemfile-rails-main
|
||||
ruby: '2.7'
|
||||
- gemfile: gemfiles/Gemfile-rails-8-0
|
||||
ruby: '3.1'
|
||||
- gemfile: gemfiles/Gemfile-rails-8-0
|
||||
ruby: '3.0'
|
||||
- gemfile: gemfiles/Gemfile-rails-8-0
|
||||
ruby: '2.7'
|
||||
- gemfile: gemfiles/Gemfile-rails-7-2
|
||||
ruby: '3.0'
|
||||
- gemfile: gemfiles/Gemfile-rails-7-2
|
||||
ruby: '2.7'
|
||||
runs-on: ubuntu-latest
|
||||
env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps
|
||||
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
|
||||
DEVISE_ORM: ${{ matrix.orm }}
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: ${{ matrix.ruby }}
|
||||
bundler-cache: true # runs bundle install and caches installed gems automatically
|
||||
- uses: supercharge/mongodb-github-action@1.12.1
|
||||
if: ${{ matrix.orm == 'mongoid' }}
|
||||
- run: bundle exec rake
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -8,3 +8,4 @@ rdoc/*
|
||||
pkg
|
||||
log
|
||||
test/tmp/*
|
||||
gemfiles/*.lock
|
||||
|
||||
110
.travis.yml
110
.travis.yml
@@ -1,110 +0,0 @@
|
||||
language: ruby
|
||||
|
||||
rvm:
|
||||
- 2.1.10
|
||||
- 2.2.10
|
||||
- 2.3.8
|
||||
- 2.4.10
|
||||
- 2.5.8
|
||||
- 2.6.6
|
||||
- 2.7.1
|
||||
- ruby-head
|
||||
|
||||
gemfile:
|
||||
- Gemfile
|
||||
- gemfiles/Gemfile.rails-6.0-stable
|
||||
- gemfiles/Gemfile.rails-5.2-stable
|
||||
- gemfiles/Gemfile.rails-5.1-stable
|
||||
- gemfiles/Gemfile.rails-5.0-stable
|
||||
- gemfiles/Gemfile.rails-4.2-stable
|
||||
- gemfiles/Gemfile.rails-4.1-stable
|
||||
|
||||
matrix:
|
||||
exclude:
|
||||
- rvm: 2.1.10
|
||||
gemfile: Gemfile
|
||||
- rvm: 2.1.10
|
||||
gemfile: gemfiles/Gemfile.rails-6.0-stable
|
||||
- rvm: 2.1.10
|
||||
gemfile: gemfiles/Gemfile.rails-5.2-stable
|
||||
- rvm: 2.1.10
|
||||
gemfile: gemfiles/Gemfile.rails-5.1-stable
|
||||
- rvm: 2.1.10
|
||||
gemfile: gemfiles/Gemfile.rails-5.0-stable
|
||||
- rvm: 2.2.10
|
||||
gemfile: Gemfile
|
||||
- rvm: 2.2.10
|
||||
gemfile: gemfiles/Gemfile.rails-6.0-stable
|
||||
- rvm: 2.2.10
|
||||
gemfile: gemfiles/Gemfile.rails-5.2-stable
|
||||
- rvm: 2.3.8
|
||||
gemfile: Gemfile
|
||||
- rvm: 2.3.8
|
||||
gemfile: gemfiles/Gemfile.rails-6.0-stable
|
||||
- rvm: 2.4.10
|
||||
gemfile: Gemfile
|
||||
- rvm: 2.4.10
|
||||
gemfile: gemfiles/Gemfile.rails-6.0-stable
|
||||
- rvm: 2.4.10
|
||||
gemfile: gemfiles/Gemfile.rails-4.1-stable
|
||||
- rvm: 2.5.8
|
||||
gemfile: gemfiles/Gemfile.rails-4.1-stable
|
||||
- rvm: 2.6.6
|
||||
gemfile: gemfiles/Gemfile.rails-4.1-stable
|
||||
- rvm: 2.6.6
|
||||
gemfile: gemfiles/Gemfile.rails-4.2-stable
|
||||
- rvm: 2.7.1
|
||||
gemfile: gemfiles/Gemfile.rails-4.1-stable
|
||||
- rvm: 2.7.1
|
||||
gemfile: gemfiles/Gemfile.rails-4.1-stable
|
||||
- rvm: 2.7.1
|
||||
gemfile: gemfiles/Gemfile.rails-4.2-stable
|
||||
- rvm: 2.7.1
|
||||
gemfile: gemfiles/Gemfile.rails-5.0-stable
|
||||
- rvm: 2.7.1
|
||||
gemfile: gemfiles/Gemfile.rails-5.1-stable
|
||||
- rvm: 2.7.1
|
||||
gemfile: gemfiles/Gemfile.rails-5.2-stable
|
||||
- rvm: ruby-head
|
||||
gemfile: gemfiles/Gemfile.rails-4.1-stable
|
||||
- rvm: ruby-head
|
||||
gemfile: gemfiles/Gemfile.rails-4.2-stable
|
||||
- env: DEVISE_ORM=mongoid
|
||||
gemfile: Gemfile
|
||||
- env: DEVISE_ORM=mongoid
|
||||
gemfile: gemfiles/Gemfile.rails-5.0-stable
|
||||
- env: DEVISE_ORM=mongoid
|
||||
gemfile: gemfiles/Gemfile.rails-5.1-stable
|
||||
- env: DEVISE_ORM=mongoid
|
||||
gemfile: gemfiles/Gemfile.rails-5.2-stable
|
||||
- env: DEVISE_ORM=mongoid
|
||||
gemfile: gemfiles/Gemfile.rails-6.0-stable
|
||||
allow_failures:
|
||||
- rvm: ruby-head
|
||||
|
||||
services:
|
||||
- mongodb
|
||||
|
||||
cache: bundler
|
||||
|
||||
env:
|
||||
matrix:
|
||||
- DEVISE_ORM=active_record
|
||||
- DEVISE_ORM=mongoid
|
||||
|
||||
before_install:
|
||||
- gem uninstall -v '>= 2' -i $(rvm gemdir)@global -ax bundler || true
|
||||
- gem install bundler -v '< 2'
|
||||
- "rm ${BUNDLE_GEMFILE}.lock"
|
||||
|
||||
before_script: "bundle update"
|
||||
|
||||
script: "bin/test"
|
||||
|
||||
notifications:
|
||||
email: false
|
||||
slack:
|
||||
on_pull_requests: false
|
||||
on_success: change
|
||||
on_failure: always
|
||||
secure: Q3M+kmude3FjisibEeeGe0wSMXgvwLH+vL7Zrx9//q4QtkfnrQ/BBMvY9KXxPEsNF+eys4YopYjTkJ8uRmeboUATW/oQ4Jrv3+u3zkIHK2sFn/Q2cQWpK5w+CbgEnHPjKYnUu34b09njXTgDlr/mqtbPqrKeZ1dLlpKXCB/q4GY=
|
||||
365
CHANGELOG.md
365
CHANGELOG.md
@@ -1,337 +1,62 @@
|
||||
### master
|
||||
### 5.0.0.rc - 2025-12-31
|
||||
|
||||
* bug fixes
|
||||
* Do not modify `:except` option given to `#serializable_hash`. (by @dpep)
|
||||
* Fix thor deprecation when running the devise generator. (by @deivid-rodriguez)
|
||||
* Fix hanging tests for streaming controllers using Devise. (by @afn)
|
||||
* breaking changes
|
||||
* Drop support to Ruby < 2.7
|
||||
* Drop support to Rails < 7.0
|
||||
* Remove deprecated `:bypass` option from `sign_in` helper, use `bypass_sign_in` instead. [#5803](https://github.com/heartcombo/devise/pull/5803)
|
||||
* Remove deprecated `devise_error_messages!` helper, use `render "devise/shared/error_messages", resource: resource` instead. [#5803](https://github.com/heartcombo/devise/pull/5803)
|
||||
* Remove deprecated `scope` second argument from `sign_in(resource, :admin)` controller test helper, use `sign_in(resource, scope: :admin)` instead. [#5803](https://github.com/heartcombo/devise/pull/5803)
|
||||
* Remove deprecated `Devise::TestHelpers`, use `Devise::Test::ControllerHelpers` instead. [#5803](https://github.com/heartcombo/devise/pull/5803)
|
||||
* Remove deprecated `Devise::Models::Authenticatable::BLACKLIST_FOR_SERIALIZATION` [#5598](https://github.com/heartcombo/devise/pull/5598)
|
||||
* Remove deprecated `Devise.activerecord51?` method.
|
||||
* Remove `SecretKeyFinder` and use `app.secret_key_base` as the default secret key for `Devise.secret_key` if a custom `Devise.secret_key` is not provided.
|
||||
|
||||
* deprecations
|
||||
* `Devise::Models::Authenticatable::BLACKLIST_FOR_SERIALIZATION` is deprecated in favor of `Devise::Models::Authenticatable::UNSAFE_ATTRIBUTES_FOR_SERIALIZATION` (@hanachin)
|
||||
This is potentially a breaking change because Devise previously used the following order to find a secret key:
|
||||
|
||||
### 4.7.2 - 2020-06-10
|
||||
|
||||
* enhancements
|
||||
* Increase default stretches to 12 (by @sergey-alekseev)
|
||||
* Ruby 2.7 support (kwarg warnings removed)
|
||||
|
||||
* bug fixes
|
||||
* Generate scoped views with proper scoped errors partial (by @shobhitic)
|
||||
* Allow to set scoped `already_authenticated` error messages (by @gurgelrenan)
|
||||
|
||||
### 4.7.1 - 2019-09-06
|
||||
|
||||
* bug fixes
|
||||
* Fix an edge case where records with a blank `confirmation_token` could be confirmed (by @tegon)
|
||||
* Fix typo inside `update_needs_confirmation` i18n key (by @lslm)
|
||||
|
||||
### 4.7.0 - 2019-08-19
|
||||
|
||||
* enhancements
|
||||
* Support Rails 6.0
|
||||
* Update CI to rails 6.0.0.beta3 (by @tunnes)
|
||||
* refactor method name to be more consistent (by @saiqulhaq)
|
||||
* Fix rails 6.0.rc1 email uniqueness validation deprecation warning (by @Vasfed)
|
||||
|
||||
* bug fixes
|
||||
* Add `autocomplete="new-password"` to `password_confirmation` fields (by @ferrl)
|
||||
* Fix rails_51_and_up? method for Rails 6.rc1 (by @igorkasyanchuk)
|
||||
|
||||
### 4.6.2 - 2019-03-26
|
||||
|
||||
* bug fixes
|
||||
* 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)
|
||||
|
||||
### 4.6.1 - 2019-02-11
|
||||
|
||||
* bug fixes
|
||||
* Check if `root_path` is defined with `#respond_to?` instead of `#present` (by @tegon)
|
||||
|
||||
### 4.6.0 - 2019-02-07
|
||||
|
||||
* enhancements
|
||||
* Allow to skip email and password change notifications (by @iorme1)
|
||||
* Include the use of `nil` for `allow_unconfirmed_access_for` in the docs (by @joaumg)
|
||||
* Ignore useless files into the `.gem` file (by @huacnlee)
|
||||
* Explain the code that prevents enumeration attacks inside `Devise::Strategies::DatabaseAuthenticatable` (by @tegon)
|
||||
* Refactor the `devise_error_messages!` helper to render a partial (by @prograhamer)
|
||||
* Add an option (`Devise.sign_in_after_change_password`) to not automatically sign in a user after changing a password (by @knjko)
|
||||
|
||||
* bug fixes
|
||||
* Fix missing comma in Simple Form generator (by @colinross)
|
||||
* Fix error with migration generator in Rails 6 (by @oystersauce8)
|
||||
* Set `encrypted_password` to `nil` when `password` is set to `nil` (by @sivagollapalli)
|
||||
* Consider whether the request supports flash messages inside `Devise::Controllers::Helpers#is_flashing_format?` (by @colinross)
|
||||
* Fix typo inside `Devise::Generators::ControllersGenerator` (by @kopylovvlad)
|
||||
* Sanitize parameters inside `Devise::Models::Authenticatable#find_or_initialize_with_errors` (by @rlue)
|
||||
* `#after_database_authentication` callback was not called after authentication on password reset (by @kanmaniselvan)
|
||||
* Fix corner case when `#confirmation_period_valid?` was called at the same second as `confirmation_sent_at` was set. Mostly true for date types that only have second precisions. (by @stanhu)
|
||||
* Fix unclosed `li` tag in `error_messages` partial (by @mracos)
|
||||
* Fix Routes issue when devise engine is mounted in another engine on Rails versions lower than 5.1 (by @a-barbieri)
|
||||
* Make `#increment_failed_attempts` concurrency safe (by @tegon)
|
||||
* Apply Test Helper fix to Rails 6.0 as well as 5.x (by @matthewrudy)
|
||||
|
||||
|
||||
* deprecations
|
||||
* The second argument of `DatabaseAuthenticatable`'s `#update_with_password` and `#update_without_password` is deprecated and will be removed in the next major version. It was added to support a feature deprecated in Rails 4, so you can safely remove it from your code. (by @ihatov08)
|
||||
* The `DeviseHelper.devise_error_messages!` is deprecated and will be removed in the next major version. Use the `devise/shared/error_messages` partial instead. (by @mracos)
|
||||
|
||||
### 4.5.0 - 2018-08-15
|
||||
|
||||
* enhancements
|
||||
* Use `before_action` instead of `before_filter` (by @edenthecat)
|
||||
* Allow people to extend devise failure app, through invoking `ActiveSupport.run_load_hooks` once `Devise::FailureApp` is loaded (by @wnm)
|
||||
* Use `update` instead of `update_attributes` (by @koic)
|
||||
* Split IP resolution from `update_tracked_fields` (by @mckramer)
|
||||
* upgrade dependencies for rails and responders (by @lancecarlson)
|
||||
* Add `autocomplete="new-password"` to new password fields (by @gssbzn)
|
||||
* Add `autocomplete="current-password"` to current password fields (by @gssbzn)
|
||||
* Remove redundant `self` from `database_authenticatable` module (by @abhishekkanojia)
|
||||
* Update `simple_form` templates with changes from https://github.com/heartcombo/devise/commit/16b3d6d67c7e017d461ea17ed29ea9738dc77e83 and https://github.com/heartcombo/devise/commit/6260c29a867b9a656f1e1557abe347a523178fab (by @gssbzn)
|
||||
* Remove `:trackable` from the default modules in the generators, to be more GDPR-friendly (by @fakenine)
|
||||
|
||||
* bug fixes
|
||||
* Use same string on failed login regardless of whether account exists when in paranoid mode (by @TonyMK9068)
|
||||
* Fix error when params is not a hash inside `Devise::ParameterSanitizer` (by @b0nn1e)
|
||||
* Look for `secret_key_base` inside `Rails.application` (by @gencer)
|
||||
* Ensure `Devise::ParameterFilter` does not add missing keys when called with a hash that has a `default` / `default_proc`
|
||||
configured (by @joshpencheon)
|
||||
* Adds `is_navigational_format?` check to `after_sign_up_path_for` to keep consistency (by @iorme1)
|
||||
|
||||
### 4.4.3 - 2018-03-17
|
||||
|
||||
* bug fixes
|
||||
* Fix undefined method `rails5?` for Devise::Test:Module (by @tegon)
|
||||
* Fix: secret key was being required to be set inside credentials on Rails 5.2 (by @tegon)
|
||||
|
||||
### 4.4.2 - 2018-03-15
|
||||
|
||||
* enhancements
|
||||
* Support for :credentials on Rails v5.2.x. (by @gencer)
|
||||
* Improve documentation about the test suite. (by @tegon)
|
||||
* Test with Rails 5.2.rc1 on Travis. (by @jcoyne)
|
||||
* Allow test with Rails 6. (by @Fudoshiki)
|
||||
* Creating a new section for controller configuration on `devise.rb` template (by @Danilo-Araujo-Silva)
|
||||
|
||||
* bug fixes
|
||||
* Preserve content_type for unauthenticated tests (by @gmcnaughton)
|
||||
* Check if the resource is persisted in `update_tracked_fields!` instead of performing validations (by @tegon)
|
||||
* Revert "Replace log_process_action to append_info_to_payload" (by @tegon)
|
||||
|
||||
### 4.4.1 - 2018-01-23
|
||||
|
||||
* bug fixes
|
||||
* Ensure Gemspec is loaded as utf-8. (by @segiddins)
|
||||
* Fix `ActiveRecord` check on `Confirmable`. (by @tegon)
|
||||
* Fix `signed_in?` docs without running auth hooks. by (@machty)
|
||||
|
||||
### 4.4.0 - 2017-12-29
|
||||
|
||||
* enhancements
|
||||
* Add `frozen_string_literal` pragma comment to all Ruby files. (by @pat)
|
||||
* Use `set_flash_method!` instead of `set_flash_method` in `Devise::OmniauthCallbacksController#failure`. (by @saichander17)
|
||||
* Clarify how `store_location_for` modifies URIs. (by @olivierlacan)
|
||||
* Move `failed_attempts` increment into its own function. by (@mobilutz)
|
||||
* Add `autocomplete="email"` to email fields. by (@MikeRogers0)
|
||||
* Add the ability to change the default migrations path introduced in Rails 5.0.3. (by @alexhifer)
|
||||
* Delete unnecessary condition for helper method. (by @davydovanton)
|
||||
* Support `id: :uuid` option for migrations. (by @filip373)
|
||||
|
||||
* bug fixes
|
||||
* Fix syntax for MRI 2.5.0. (by @pat)
|
||||
* Validations were being ignored on singup in the `Trackable#update_tracked_fields!` method. (by @AshleyFoster)
|
||||
* Do not modify options for `#serializable_hash`. (by @guigs)
|
||||
* 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)
|
||||
|
||||
### 4.3.0 - 2017-05-14
|
||||
|
||||
* Enhancements
|
||||
* Dependency support added for Rails 5.1.x.
|
||||
|
||||
### 4.2.1 - 2017-03-15
|
||||
|
||||
* removals
|
||||
* `Devise::Mailer#scope_name` and `Devise::Mailer#resource` are now protected
|
||||
methods instead of public.
|
||||
* bug fixes
|
||||
* Attempt to reset password without the password field in the request now results in a `:blank` validation error.
|
||||
Before this change, Devise would accept the reset password request and log the user in, without validating/changing
|
||||
the password. (by @victor-am)
|
||||
* Confirmation links now expire based on UTC time, working properly when using different timezones. (by @jjuliano)
|
||||
* enhancements
|
||||
* Notify the original email when it is changed with a new `Devise.send_email_changed_notification` setting.
|
||||
When using `reconfirmable`, the notification will be sent right away instead of when the unconfirmed email is confirmed.
|
||||
(original change by @ethirajsrinivasan)
|
||||
|
||||
### 4.2.0 - 2016-07-01
|
||||
|
||||
* removals
|
||||
* Remove the deprecated `Devise::ParameterSanitizer` API from Devise 3.
|
||||
Please use the `#permit` and `#sanitize` methods over `#for`.
|
||||
* Remove the deprecated OmniAuth URL helpers. Use the fully qualified helpers
|
||||
(`user_facebook_omniauth_authorize_path`) over the scope based helpers
|
||||
( `user_omniauth_authorize_path(:facebook)`).
|
||||
* Remove the `Devise.bcrypt` method, use `Devise::Encryptor.digest` instead.
|
||||
* Remove the `Devise::Models::Confirmable#confirm!` method, use `confirm` instead.
|
||||
* Remove the `Devise::Models::Recoverable#reset_password!` method, use `reset_password` instead.
|
||||
* Remove the `Devise::Models::Recoverable#after_password_reset` method.
|
||||
* bug fixes
|
||||
* Fix an `ActionDispatch::IllegalStateError` when testing controllers with Rails 5 rc 2(by @hamadata).
|
||||
* Use `ActiveSupport.on_load` hooks to include Devise on `ActiveRecord` and `Mongoid`,
|
||||
avoiding autoloading these constants too soon (by @lucasmazza, @rafaelfranca).
|
||||
* enhancements
|
||||
* Display the minimum password length on `registrations/edit` view (by @Yanchek99).
|
||||
* You can disable Devise's routes reloading on boot by through the `reload_routes = false` config.
|
||||
This can reduce the time taken to boot the application but it might trigger
|
||||
some errors if you application (mostly your controllers) requires that
|
||||
Devise mappings be loaded during boot time (by @sidonath).
|
||||
* Added `Devise::Test::IntegrationHelpers` to bypass the sign in process using
|
||||
Warden test API (by @lucasmazza).
|
||||
* Define `inspect` in `Devise::Models::Authenticatable` to help ensure password hashes
|
||||
aren't included in exceptions or otherwise accidentally serialized (by @tkrajcar).
|
||||
* Add missing support of `Rails.application.config.action_controller.relative_url_root` (by @kosdiamantis).
|
||||
* deprecations
|
||||
* `Devise::TestHelpers` is deprecated in favor of `Devise::Test::ControllerHelpers`
|
||||
(by @lucasmazza).
|
||||
* The `sign_in` test helper has changed to use keyword arguments when passing
|
||||
a scope. `sign_in :admin, users(:alice)` should be rewritten as
|
||||
`sign_in users(:alice), scope: :admin` (by @lucasmazza).
|
||||
* The option `bypass` of `Devise::Controllers::SignInOut#sign_in` method is
|
||||
deprecated in favor of `Devise::Controllers::SignInOut#bypass_sign_in`
|
||||
method (by @ulissesalmeida).
|
||||
|
||||
### 4.1.1 - 2016-05-15
|
||||
|
||||
* bug fixes
|
||||
* Fix overwriting the remember_token when a valid one already exists (by @ralinchimev).
|
||||
|
||||
### 4.1.0
|
||||
|
||||
* bug fixes
|
||||
* Fix race condition of sending the confirmation instructions e-mail using background jobs.
|
||||
Using the previous `after_create` callback, the e-mail can be sent before
|
||||
the record be committed on database, generating a `ActiveRecord::NotFound` error.
|
||||
Now the confirmation e-mail will be only sent after the database commit,
|
||||
using the `after_commit` callback.
|
||||
It may break your test suite on Rails 4 if you are testing the sent e-mails
|
||||
or enqueued jobs using transactional fixtures enabled or `DatabaseCleaner` with `transaction` strategy.
|
||||
You can easily fix your test suite using the gem
|
||||
[test_after_commit](https://github.com/grosser/test_after_commit). For example, put in your Gemfile:
|
||||
|
||||
```ruby
|
||||
gem 'test_after_commit', :group => :test
|
||||
```
|
||||
app.credentials.secret_key_base > app.secrets.secret_key_base > application.config.secret_key_base > application.secret_key_base
|
||||
```
|
||||
|
||||
On Rails 5 `after_commit` callbacks are triggered even using transactional
|
||||
fixtures, then this fix will not break your test suite. If you are using `DatabaseCleaner` with the `deletion` or `truncation` strategies it may not break your tests. (by @allenwq)
|
||||
* Fix strategy checking in `Lockable#unlock_strategy_enabled?` for `:none` and
|
||||
`:undefined` strategies. (by @f3ndot)
|
||||
* features
|
||||
* Humanize authentication keys in failure flash message (by @byzg)
|
||||
When you are configuring the translations of `devise.failure.invalid`, the
|
||||
`authentication_keys` is translated now.
|
||||
* deprecations
|
||||
* Remove code supporting old session serialization format (by @fphilipe).
|
||||
* Now the `email_regexp` default uses a more permissive regex:
|
||||
`/\A[^@\s]+@[^@\s]+\z/` (by @kimgb)
|
||||
* Now the `strip_whitespace_keys` default is `[:email]` (by @ulissesalmeida)
|
||||
* Now the `reconfirmable` default is `true` (by @ulissesalmeida)
|
||||
* Now the `skip_session_storage` default is `[:http_auth]` (by @ulissesalmeida)
|
||||
* Now the `sign_out_via` default is `:delete` (by @ulissesalmeida)
|
||||
* improvements
|
||||
* Avoids extra computation of friendly token for confirmation token (by @sbc100)
|
||||
Now, it always uses `application.secret_key_base`. Make sure you're using the same secret key after the upgrade; otherwise, previously generated tokens for `recoverable`, `lockable`, and `confirmable` will be invalid.
|
||||
[#5645](https://github.com/heartcombo/devise/pull/5645)
|
||||
* Change password instructions button label on devise view from `Send me reset password instructions` to `Send me password reset instructions` [#5515](https://github.com/heartcombo/devise/pull/5515)
|
||||
* Change `<br>` tags separating form elements to wrapping them in `<p>` tags [#5494](https://github.com/heartcombo/devise/pull/5494)
|
||||
* Replace `[data-turbo-cache=false]` with `[data-turbo-temporary]` on `devise/shared/error_messages` partial. This has been [deprecated by Turbo since v7.3.0 (released on Mar 1, 2023)](https://github.com/hotwired/turbo/releases/tag/v7.3.0).
|
||||
|
||||
### 4.0.3 - 2016-05-15
|
||||
|
||||
* bug fixes
|
||||
* Fix overwriting the remember_token when a valid one already exists (by @ralinchimev).
|
||||
|
||||
### 4.0.2 - 2016-05-02
|
||||
|
||||
* bug fixes
|
||||
* Fix strategy checking in `Lockable#unlock_strategy_enabled?` for `:none`
|
||||
and `:undefined` strategies. (by @f3ndot)
|
||||
|
||||
### 4.0.1 - 2016-04-25
|
||||
|
||||
* bug fixes
|
||||
* Fix the e-mail confirmation instructions send when a user updates the email
|
||||
address from nil. (by @lmduc)
|
||||
* Remove unnecessary `attribute_will_change!` call. (by @cadejscroggins)
|
||||
* Consistent `permit!` check. (by @ulissesalmeida)
|
||||
|
||||
### 4.0.0 - 2016-04-18
|
||||
|
||||
* bug fixes
|
||||
* Fix the `extend_remember_period` configuration. When set to `false` it does
|
||||
not update the cookie expiration anymore.(by @ulissesalmeida)
|
||||
|
||||
* deprecations
|
||||
* Added a warning of default value change in Devise 4.1 for users that uses
|
||||
the the default configuration of the following configurations: (by @ulissesalmeida)
|
||||
* `strip_whitespace_keys` - The default will be `[:email]`.
|
||||
* `skip_session_storage` - The default will be `[:http_auth]`.
|
||||
* `sign_out_via` - The default will be `:delete`.
|
||||
* `reconfirmable` - The default will be `true`.
|
||||
* `email_regexp` - The default will be `/\A[^@\s]+@[^@\s]+\z/`.
|
||||
* Removed deprecated argument of `Devise::Models::Rememberable#remember_me!` (by @ulissesalmeida)
|
||||
* Removed deprecated private method Devise::Controllers::Helpers#expire_session_data_after_sign_in!
|
||||
(by @bogdanvlviv)
|
||||
|
||||
### 4.0.0.rc2 - 2016-03-09
|
||||
If you are using an older version of Turbo and the default devise template, you'll need to copy it over to your app and change that back to `[data-turbo-cache=false]`.
|
||||
|
||||
* enhancements
|
||||
* Introduced `DeviseController#set_flash_message!` for conditional flash
|
||||
messages setting to reduce complexity.
|
||||
* `rails g devise:install` will fail if the app does not have a ORM configured
|
||||
(by @arjunsharma)
|
||||
* Support to Rails 5 versioned migrations added.
|
||||
* Add Rails 8 support.
|
||||
- Routes are lazy-loaded by default in test and development environments now so Devise loads them before `Devise.mappings` call. [#5728](https://github.com/heartcombo/devise/pull/5728)
|
||||
* New apps using Rack 3.1+ will be generated using `config.responder.error_status = :unprocessable_content`, since [`:unprocessable_entity` has been deprecated by Rack](https://github.com/rack/rack/pull/2137).
|
||||
|
||||
* deprecations
|
||||
* omniauth routes are no longer defined with a wildcard `:provider` parameter,
|
||||
and provider specific routes are defined instead, so route helpers like `user_omniauth_authorize_path(:github)` are deprecated in favor of `user_github_omniauth_authorize_path`.
|
||||
You can still use `omniauth_authorize_path(:user, :github)` if you need to
|
||||
call the helpers dynamically.
|
||||
Latest versions of [Rails transparently convert `:unprocessable_entity` -> `:unprocessable_content`](https://github.com/rails/rails/pull/53383), and Devise will use that in the failure app to avoid Rack deprecation warnings for apps that are configured with `:unprocessable_entity`. They can also simply change their `error_status` to `:unprocessable_content` in latest Rack versions to avoid the warning.
|
||||
* Add Ruby 3.4 and 4.0 support.
|
||||
* Reenable Mongoid test suite across all Rails 7+ versions, to ensure we continue supporting it. Changes to dirty tracking to support Mongoid 8.0+. [#5568](https://github.com/heartcombo/devise/pull/5568)
|
||||
* Password length validator is changed from
|
||||
|
||||
### 4.0.0.rc1 - 2016-02-01
|
||||
|
||||
* Support added to Rails 5 (by @twalpole).
|
||||
* Devise no longer supports Rails 3.2 and 4.0.
|
||||
* Devise no longer supports Ruby 1.9 and 2.0.
|
||||
|
||||
* deprecations
|
||||
* The `devise_parameter_sanitize` API has changed:
|
||||
The `for` method was deprecated in favor of `permit`:
|
||||
|
||||
```ruby
|
||||
def configure_permitted_parameters
|
||||
devise_parameter_sanitizer.for(:sign_up) << :subscribe_newsletter
|
||||
# Should become the following.
|
||||
devise_parameter_sanitizer.permit(:sign_up, keys: [:subscribe_newsletter])
|
||||
end
|
||||
```
|
||||
validates_length_of :password, within: password_length, allow_blank: true`
|
||||
```
|
||||
|
||||
The customization through instance methods on the sanitizer implementation
|
||||
should be done through it's `initialize` method:
|
||||
to
|
||||
|
||||
```ruby
|
||||
class User::ParameterSanitizer < Devise::ParameterSanitizer
|
||||
def sign_up
|
||||
default_params.permit(:username, :email)
|
||||
end
|
||||
end
|
||||
|
||||
# The `sign_up` method can be a `permit` call on the sanitizer `initialize`.
|
||||
|
||||
class User::ParameterSanitizer < Devise::ParameterSanitizer
|
||||
def initialize(*)
|
||||
super
|
||||
permit(:sign_up, keys: [:username, :email])
|
||||
end
|
||||
end
|
||||
```
|
||||
validates_length_of :password, minimum: proc { password_length.min }, maximum: proc { password_length.max }, allow_blank: true
|
||||
```
|
||||
|
||||
You can check more examples and explanations on the [README section](README.md#strong-parameters)
|
||||
and on the [ParameterSanitizer docs](lib/devise/parameter_sanitizer.rb).
|
||||
so it's possible to override `password_length` at runtime. [#5734](https://github.com/heartcombo/devise/pull/5734)
|
||||
|
||||
Please check [3-stable](https://github.com/heartcombo/devise/blob/3-stable/CHANGELOG.md)
|
||||
* bug fixes
|
||||
* Make `Devise` work without `ActionMailer` when `Zeitwerk` autoloader is used. [#5731](https://github.com/heartcombo/devise/pull/5731)
|
||||
* Handle defaults `:from` and `:reply_to` as procs correctly by delegating to Rails [#5595](https://github.com/heartcombo/devise/pull/5595)
|
||||
* Use `OmniAuth.config.allowed_request_methods` as routing verbs for the auth path [#5508](https://github.com/heartcombo/devise/pull/5508)
|
||||
* Handle `on` and `ON` as true values to check params [#5514](https://github.com/heartcombo/devise/pull/5514)
|
||||
* Fix passing `format` option to `devise_for` [#5732](https://github.com/heartcombo/devise/pull/5732)
|
||||
* Use `ActiveRecord::SecurityUtils.secure_compare` in `Devise.secure_compare` to match two empty strings correctly. [#4829](https://github.com/heartcombo/devise/pull/4829)
|
||||
* Respond with `401 Unauthorized` for non-navigational requests to destroy the session when there is no authenticated resource. [#4878](https://github.com/heartcombo/devise/pull/4878)
|
||||
* Fix incorrect grammar of invalid authentication message with capitalized attributes, e.g.: "Invalid Email or password" => "Invalid email or password". (originally introduced by [#4014](https://github.com/heartcombo/devise/pull/4014), released on v4.1.0) [#4834](https://github.com/heartcombo/devise/pull/4834)
|
||||
|
||||
|
||||
Please check [4-stable](https://github.com/heartcombo/devise/blob/4-stable/CHANGELOG.md)
|
||||
for previous changes.
|
||||
|
||||
@@ -17,6 +17,6 @@ Project maintainers have the right and responsibility to remove, edit, or reject
|
||||
|
||||
This code of conduct applies both within project spaces and in public spaces when an individual is representing the project or its community.
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by sending an email to [heartcombo@googlegroups.com](heartcombo@googlegroups.com) or contacting one or more of the project maintainers.
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by sending an email to [heartcombo.oss@gmail.com](heartcombo.oss@gmail.com) or contacting one or more of the project maintainers.
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0, available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/)
|
||||
|
||||
@@ -30,7 +30,7 @@ the project wiki, documentation and source code first, or try to ask your questi
|
||||
on [Stack Overflow](http://stackoverflow.com/questions/tagged/devise).
|
||||
|
||||
**If you find a security bug, do not report it through GitHub. Please send an
|
||||
e-mail to [heartcombo@googlegroups.com](mailto:heartcombo@googlegroups.com)
|
||||
e-mail to [heartcombo.oss@gmail.com](mailto:heartcombo.oss@gmail.com)
|
||||
instead.**
|
||||
|
||||
## Sending Pull Requests
|
||||
|
||||
30
Gemfile
30
Gemfile
@@ -4,36 +4,30 @@ source "https://rubygems.org"
|
||||
|
||||
gemspec
|
||||
|
||||
gem "rails", "~> 6.0.0"
|
||||
gem "omniauth"
|
||||
gem "omniauth-oauth2"
|
||||
gem "rails", "~> 8.1.0"
|
||||
gem "rdoc"
|
||||
|
||||
gem "activemodel-serializers-xml", github: "rails/activemodel-serializers-xml"
|
||||
gem "rails-controller-testing"
|
||||
|
||||
gem "rails-controller-testing", github: "rails/rails-controller-testing"
|
||||
|
||||
gem "responders", "~> 3.0"
|
||||
gem "responders", "~> 3.1"
|
||||
|
||||
group :test do
|
||||
gem "minitest", "< 6"
|
||||
gem "mocha", "~> 2.1", require: false
|
||||
gem "omniauth-facebook"
|
||||
gem "omniauth-openid"
|
||||
gem "rexml"
|
||||
gem "timecop"
|
||||
gem "webrat", "0.7.3", require: false
|
||||
gem "mocha", "~> 1.1", require: false
|
||||
gem "webrat"
|
||||
gem "ostruct"
|
||||
end
|
||||
|
||||
platforms :ruby do
|
||||
gem "sqlite3", "~> 1.4"
|
||||
gem "sqlite3"
|
||||
end
|
||||
|
||||
# platforms :jruby do
|
||||
# gem "activerecord-jdbc-adapter"
|
||||
# gem "activerecord-jdbcsqlite3-adapter"
|
||||
# gem "jruby-openssl"
|
||||
# end
|
||||
|
||||
# TODO:
|
||||
# group :mongoid do
|
||||
# gem "mongoid", "~> 4.0.0"
|
||||
# end
|
||||
group :mongoid do
|
||||
gem "mongoid", "~> 9.0", github: "mongodb/mongoid", branch: "9.0-stable"
|
||||
end
|
||||
|
||||
425
Gemfile.lock
425
Gemfile.lock
@@ -1,219 +1,312 @@
|
||||
GIT
|
||||
remote: https://github.com/rails/activemodel-serializers-xml.git
|
||||
revision: 694f4071c6b16e4c8597cc323c241b5f787b3ea8
|
||||
remote: https://github.com/mongodb/mongoid.git
|
||||
revision: 4dcdaddea5d88a819c7c0d98ea0e994e13f515fe
|
||||
branch: 9.0-stable
|
||||
specs:
|
||||
activemodel-serializers-xml (1.0.2)
|
||||
activemodel (>= 5.0.0.a)
|
||||
activesupport (>= 5.0.0.a)
|
||||
builder (~> 3.1)
|
||||
|
||||
GIT
|
||||
remote: https://github.com/rails/rails-controller-testing.git
|
||||
revision: 4b15c86e82ee380f2a7cc009e470368f7520560a
|
||||
specs:
|
||||
rails-controller-testing (1.0.5)
|
||||
actionpack (>= 5.0.1.rc1)
|
||||
actionview (>= 5.0.1.rc1)
|
||||
activesupport (>= 5.0.1.rc1)
|
||||
mongoid (9.0.9)
|
||||
activemodel (>= 5.1, < 8.2, != 7.0.0)
|
||||
concurrent-ruby (>= 1.0.5, < 2.0)
|
||||
mongo (>= 2.18.0, < 3.0.0)
|
||||
|
||||
PATH
|
||||
remote: .
|
||||
specs:
|
||||
devise (4.7.2)
|
||||
devise (5.0.0.rc)
|
||||
bcrypt (~> 3.0)
|
||||
orm_adapter (~> 0.1)
|
||||
railties (>= 4.1.0)
|
||||
railties (>= 7.0)
|
||||
responders
|
||||
warden (~> 1.2.3)
|
||||
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
actioncable (6.0.3.3)
|
||||
actionpack (= 6.0.3.3)
|
||||
action_text-trix (2.1.15)
|
||||
railties
|
||||
actioncable (8.1.1)
|
||||
actionpack (= 8.1.1)
|
||||
activesupport (= 8.1.1)
|
||||
nio4r (~> 2.0)
|
||||
websocket-driver (>= 0.6.1)
|
||||
actionmailbox (6.0.3.3)
|
||||
actionpack (= 6.0.3.3)
|
||||
activejob (= 6.0.3.3)
|
||||
activerecord (= 6.0.3.3)
|
||||
activestorage (= 6.0.3.3)
|
||||
activesupport (= 6.0.3.3)
|
||||
mail (>= 2.7.1)
|
||||
actionmailer (6.0.3.3)
|
||||
actionpack (= 6.0.3.3)
|
||||
actionview (= 6.0.3.3)
|
||||
activejob (= 6.0.3.3)
|
||||
mail (~> 2.5, >= 2.5.4)
|
||||
rails-dom-testing (~> 2.0)
|
||||
actionpack (6.0.3.3)
|
||||
actionview (= 6.0.3.3)
|
||||
activesupport (= 6.0.3.3)
|
||||
rack (~> 2.0, >= 2.0.8)
|
||||
rack-test (>= 0.6.3)
|
||||
rails-dom-testing (~> 2.0)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
||||
actiontext (6.0.3.3)
|
||||
actionpack (= 6.0.3.3)
|
||||
activerecord (= 6.0.3.3)
|
||||
activestorage (= 6.0.3.3)
|
||||
activesupport (= 6.0.3.3)
|
||||
zeitwerk (~> 2.6)
|
||||
actionmailbox (8.1.1)
|
||||
actionpack (= 8.1.1)
|
||||
activejob (= 8.1.1)
|
||||
activerecord (= 8.1.1)
|
||||
activestorage (= 8.1.1)
|
||||
activesupport (= 8.1.1)
|
||||
mail (>= 2.8.0)
|
||||
actionmailer (8.1.1)
|
||||
actionpack (= 8.1.1)
|
||||
actionview (= 8.1.1)
|
||||
activejob (= 8.1.1)
|
||||
activesupport (= 8.1.1)
|
||||
mail (>= 2.8.0)
|
||||
rails-dom-testing (~> 2.2)
|
||||
actionpack (8.1.1)
|
||||
actionview (= 8.1.1)
|
||||
activesupport (= 8.1.1)
|
||||
nokogiri (>= 1.8.5)
|
||||
actionview (6.0.3.3)
|
||||
activesupport (= 6.0.3.3)
|
||||
rack (>= 2.2.4)
|
||||
rack-session (>= 1.0.1)
|
||||
rack-test (>= 0.6.3)
|
||||
rails-dom-testing (~> 2.2)
|
||||
rails-html-sanitizer (~> 1.6)
|
||||
useragent (~> 0.16)
|
||||
actiontext (8.1.1)
|
||||
action_text-trix (~> 2.1.15)
|
||||
actionpack (= 8.1.1)
|
||||
activerecord (= 8.1.1)
|
||||
activestorage (= 8.1.1)
|
||||
activesupport (= 8.1.1)
|
||||
globalid (>= 0.6.0)
|
||||
nokogiri (>= 1.8.5)
|
||||
actionview (8.1.1)
|
||||
activesupport (= 8.1.1)
|
||||
builder (~> 3.1)
|
||||
erubi (~> 1.4)
|
||||
rails-dom-testing (~> 2.0)
|
||||
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
||||
activejob (6.0.3.3)
|
||||
activesupport (= 6.0.3.3)
|
||||
erubi (~> 1.11)
|
||||
rails-dom-testing (~> 2.2)
|
||||
rails-html-sanitizer (~> 1.6)
|
||||
activejob (8.1.1)
|
||||
activesupport (= 8.1.1)
|
||||
globalid (>= 0.3.6)
|
||||
activemodel (6.0.3.3)
|
||||
activesupport (= 6.0.3.3)
|
||||
activerecord (6.0.3.3)
|
||||
activemodel (= 6.0.3.3)
|
||||
activesupport (= 6.0.3.3)
|
||||
activestorage (6.0.3.3)
|
||||
actionpack (= 6.0.3.3)
|
||||
activejob (= 6.0.3.3)
|
||||
activerecord (= 6.0.3.3)
|
||||
marcel (~> 0.3.1)
|
||||
activesupport (6.0.3.3)
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
i18n (>= 0.7, < 2)
|
||||
minitest (~> 5.1)
|
||||
tzinfo (~> 1.1)
|
||||
zeitwerk (~> 2.2, >= 2.2.2)
|
||||
bcrypt (3.1.16)
|
||||
builder (3.2.4)
|
||||
concurrent-ruby (1.1.7)
|
||||
activemodel (8.1.1)
|
||||
activesupport (= 8.1.1)
|
||||
activerecord (8.1.1)
|
||||
activemodel (= 8.1.1)
|
||||
activesupport (= 8.1.1)
|
||||
timeout (>= 0.4.0)
|
||||
activestorage (8.1.1)
|
||||
actionpack (= 8.1.1)
|
||||
activejob (= 8.1.1)
|
||||
activerecord (= 8.1.1)
|
||||
activesupport (= 8.1.1)
|
||||
marcel (~> 1.0)
|
||||
activesupport (8.1.1)
|
||||
base64
|
||||
bigdecimal
|
||||
concurrent-ruby (~> 1.0, >= 1.3.1)
|
||||
connection_pool (>= 2.2.5)
|
||||
drb
|
||||
i18n (>= 1.6, < 2)
|
||||
json
|
||||
logger (>= 1.4.2)
|
||||
minitest (>= 5.1)
|
||||
securerandom (>= 0.3)
|
||||
tzinfo (~> 2.0, >= 2.0.5)
|
||||
uri (>= 0.13.1)
|
||||
base64 (0.3.0)
|
||||
bcrypt (3.1.20)
|
||||
bigdecimal (4.0.1)
|
||||
bson (5.2.0)
|
||||
builder (3.3.0)
|
||||
concurrent-ruby (1.3.6)
|
||||
connection_pool (3.0.2)
|
||||
crass (1.0.6)
|
||||
erubi (1.9.0)
|
||||
faraday (1.0.1)
|
||||
multipart-post (>= 1.2, < 3)
|
||||
globalid (0.4.2)
|
||||
activesupport (>= 4.2.0)
|
||||
hashie (4.1.0)
|
||||
i18n (1.8.5)
|
||||
date (3.5.1)
|
||||
drb (2.2.3)
|
||||
erb (6.0.1)
|
||||
erubi (1.13.1)
|
||||
faraday (2.14.0)
|
||||
faraday-net_http (>= 2.0, < 3.5)
|
||||
json
|
||||
logger
|
||||
faraday-net_http (3.4.2)
|
||||
net-http (~> 0.5)
|
||||
globalid (1.3.0)
|
||||
activesupport (>= 6.1)
|
||||
hashie (5.1.0)
|
||||
logger
|
||||
i18n (1.14.8)
|
||||
concurrent-ruby (~> 1.0)
|
||||
jwt (2.2.2)
|
||||
loofah (2.7.0)
|
||||
io-console (0.8.2)
|
||||
irb (1.16.0)
|
||||
pp (>= 0.6.0)
|
||||
rdoc (>= 4.0.0)
|
||||
reline (>= 0.4.2)
|
||||
json (2.18.0)
|
||||
jwt (3.1.2)
|
||||
base64
|
||||
logger (1.7.0)
|
||||
loofah (2.25.0)
|
||||
crass (~> 1.0.2)
|
||||
nokogiri (>= 1.5.9)
|
||||
mail (2.7.1)
|
||||
nokogiri (>= 1.12.0)
|
||||
mail (2.9.0)
|
||||
logger
|
||||
mini_mime (>= 0.1.1)
|
||||
marcel (0.3.3)
|
||||
mimemagic (~> 0.3.2)
|
||||
method_source (1.0.0)
|
||||
mimemagic (0.3.5)
|
||||
mini_mime (1.0.2)
|
||||
mini_portile2 (2.4.0)
|
||||
minitest (5.14.2)
|
||||
mocha (1.11.2)
|
||||
multi_json (1.15.0)
|
||||
multi_xml (0.6.0)
|
||||
multipart-post (2.1.1)
|
||||
nio4r (2.5.4)
|
||||
nokogiri (1.10.10)
|
||||
mini_portile2 (~> 2.4.0)
|
||||
oauth2 (1.4.4)
|
||||
faraday (>= 0.8, < 2.0)
|
||||
jwt (>= 1.0, < 3.0)
|
||||
multi_json (~> 1.3)
|
||||
net-imap
|
||||
net-pop
|
||||
net-smtp
|
||||
marcel (1.1.0)
|
||||
mini_mime (1.1.5)
|
||||
mini_portile2 (2.8.9)
|
||||
minitest (5.27.0)
|
||||
mocha (2.8.2)
|
||||
ruby2_keywords (>= 0.0.5)
|
||||
mongo (2.22.0)
|
||||
base64
|
||||
bson (>= 4.14.1, < 6.0.0)
|
||||
multi_xml (0.8.0)
|
||||
bigdecimal (>= 3.1, < 5)
|
||||
net-http (0.9.1)
|
||||
uri (>= 0.11.1)
|
||||
net-imap (0.6.2)
|
||||
date
|
||||
net-protocol
|
||||
net-pop (0.1.2)
|
||||
net-protocol
|
||||
net-protocol (0.2.2)
|
||||
timeout
|
||||
net-smtp (0.5.1)
|
||||
net-protocol
|
||||
nio4r (2.7.5)
|
||||
nokogiri (1.19.0)
|
||||
mini_portile2 (~> 2.8.2)
|
||||
racc (~> 1.4)
|
||||
oauth2 (2.0.18)
|
||||
faraday (>= 0.17.3, < 4.0)
|
||||
jwt (>= 1.0, < 4.0)
|
||||
logger (~> 1.2)
|
||||
multi_xml (~> 0.5)
|
||||
rack (>= 1.2, < 3)
|
||||
omniauth (1.9.1)
|
||||
rack (>= 1.2, < 4)
|
||||
snaky_hash (~> 2.0, >= 2.0.3)
|
||||
version_gem (~> 1.1, >= 1.1.9)
|
||||
omniauth (2.1.4)
|
||||
hashie (>= 3.4.6)
|
||||
rack (>= 1.6.2, < 3)
|
||||
omniauth-facebook (7.0.0)
|
||||
omniauth-oauth2 (~> 1.2)
|
||||
omniauth-oauth2 (1.7.0)
|
||||
oauth2 (~> 1.4)
|
||||
omniauth (~> 1.9)
|
||||
omniauth-openid (1.0.1)
|
||||
omniauth (~> 1.0)
|
||||
rack-openid (~> 1.3.1)
|
||||
logger
|
||||
rack (>= 2.2.3)
|
||||
rack-protection
|
||||
omniauth-facebook (10.0.0)
|
||||
bigdecimal
|
||||
omniauth-oauth2 (>= 1.2, < 3)
|
||||
omniauth-oauth2 (1.9.0)
|
||||
oauth2 (>= 2.0.2, < 3)
|
||||
omniauth (~> 2.0)
|
||||
omniauth-openid (2.0.2)
|
||||
omniauth (>= 1.1)
|
||||
rack-openid (~> 1.4)
|
||||
ruby-openid (~> 2.1, >= 2.1.8)
|
||||
version_gem (~> 1.1, >= 1.1.8)
|
||||
orm_adapter (0.5.0)
|
||||
rack (2.2.3)
|
||||
rack-openid (1.3.1)
|
||||
ostruct (0.6.3)
|
||||
pp (0.6.3)
|
||||
prettyprint
|
||||
prettyprint (0.2.0)
|
||||
psych (5.3.1)
|
||||
date
|
||||
stringio
|
||||
racc (1.8.1)
|
||||
rack (3.2.4)
|
||||
rack-openid (1.4.2)
|
||||
rack (>= 1.1.0)
|
||||
ruby-openid (>= 2.1.8)
|
||||
rack-test (1.1.0)
|
||||
rack (>= 1.0, < 3)
|
||||
rails (6.0.3.3)
|
||||
actioncable (= 6.0.3.3)
|
||||
actionmailbox (= 6.0.3.3)
|
||||
actionmailer (= 6.0.3.3)
|
||||
actionpack (= 6.0.3.3)
|
||||
actiontext (= 6.0.3.3)
|
||||
actionview (= 6.0.3.3)
|
||||
activejob (= 6.0.3.3)
|
||||
activemodel (= 6.0.3.3)
|
||||
activerecord (= 6.0.3.3)
|
||||
activestorage (= 6.0.3.3)
|
||||
activesupport (= 6.0.3.3)
|
||||
bundler (>= 1.3.0)
|
||||
railties (= 6.0.3.3)
|
||||
sprockets-rails (>= 2.0.0)
|
||||
rails-dom-testing (2.0.3)
|
||||
activesupport (>= 4.2.0)
|
||||
rack-protection (4.2.1)
|
||||
base64 (>= 0.1.0)
|
||||
logger (>= 1.6.0)
|
||||
rack (>= 3.0.0, < 4)
|
||||
rack-session (2.1.1)
|
||||
base64 (>= 0.1.0)
|
||||
rack (>= 3.0.0)
|
||||
rack-test (2.2.0)
|
||||
rack (>= 1.3)
|
||||
rackup (2.3.1)
|
||||
rack (>= 3)
|
||||
rails (8.1.1)
|
||||
actioncable (= 8.1.1)
|
||||
actionmailbox (= 8.1.1)
|
||||
actionmailer (= 8.1.1)
|
||||
actionpack (= 8.1.1)
|
||||
actiontext (= 8.1.1)
|
||||
actionview (= 8.1.1)
|
||||
activejob (= 8.1.1)
|
||||
activemodel (= 8.1.1)
|
||||
activerecord (= 8.1.1)
|
||||
activestorage (= 8.1.1)
|
||||
activesupport (= 8.1.1)
|
||||
bundler (>= 1.15.0)
|
||||
railties (= 8.1.1)
|
||||
rails-controller-testing (1.0.5)
|
||||
actionpack (>= 5.0.1.rc1)
|
||||
actionview (>= 5.0.1.rc1)
|
||||
activesupport (>= 5.0.1.rc1)
|
||||
rails-dom-testing (2.3.0)
|
||||
activesupport (>= 5.0.0)
|
||||
minitest
|
||||
nokogiri (>= 1.6)
|
||||
rails-html-sanitizer (1.3.0)
|
||||
loofah (~> 2.3)
|
||||
railties (6.0.3.3)
|
||||
actionpack (= 6.0.3.3)
|
||||
activesupport (= 6.0.3.3)
|
||||
method_source
|
||||
rake (>= 0.8.7)
|
||||
thor (>= 0.20.3, < 2.0)
|
||||
rake (13.0.1)
|
||||
rdoc (6.2.1)
|
||||
responders (3.0.1)
|
||||
actionpack (>= 5.0)
|
||||
railties (>= 5.0)
|
||||
rails-html-sanitizer (1.6.2)
|
||||
loofah (~> 2.21)
|
||||
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
|
||||
railties (8.1.1)
|
||||
actionpack (= 8.1.1)
|
||||
activesupport (= 8.1.1)
|
||||
irb (~> 1.13)
|
||||
rackup (>= 1.0.0)
|
||||
rake (>= 12.2)
|
||||
thor (~> 1.0, >= 1.2.2)
|
||||
tsort (>= 0.2)
|
||||
zeitwerk (~> 2.6)
|
||||
rake (13.3.1)
|
||||
rdoc (7.0.3)
|
||||
erb
|
||||
psych (>= 4.0.0)
|
||||
tsort
|
||||
reline (0.6.3)
|
||||
io-console (~> 0.5)
|
||||
responders (3.2.0)
|
||||
actionpack (>= 7.0)
|
||||
railties (>= 7.0)
|
||||
rexml (3.4.4)
|
||||
ruby-openid (2.9.2)
|
||||
sprockets (4.0.2)
|
||||
ruby2_keywords (0.0.5)
|
||||
securerandom (0.4.1)
|
||||
snaky_hash (2.0.3)
|
||||
hashie (>= 0.1.0, < 6)
|
||||
version_gem (>= 1.1.8, < 3)
|
||||
sqlite3 (2.9.0)
|
||||
mini_portile2 (~> 2.8.0)
|
||||
stringio (3.2.0)
|
||||
thor (1.4.0)
|
||||
timecop (0.9.10)
|
||||
timeout (0.6.0)
|
||||
tsort (0.2.0)
|
||||
tzinfo (2.0.6)
|
||||
concurrent-ruby (~> 1.0)
|
||||
rack (> 1, < 3)
|
||||
sprockets-rails (3.2.2)
|
||||
actionpack (>= 4.0)
|
||||
activesupport (>= 4.0)
|
||||
sprockets (>= 3.0.0)
|
||||
sqlite3 (1.4.2)
|
||||
thor (1.0.1)
|
||||
thread_safe (0.3.6)
|
||||
timecop (0.9.1)
|
||||
tzinfo (1.2.7)
|
||||
thread_safe (~> 0.1)
|
||||
uri (1.1.1)
|
||||
useragent (0.16.11)
|
||||
version_gem (1.1.9)
|
||||
warden (1.2.9)
|
||||
rack (>= 2.0.9)
|
||||
webrat (0.7.3)
|
||||
nokogiri (>= 1.2.0)
|
||||
rack (>= 1.0)
|
||||
rack-test (>= 0.5.3)
|
||||
websocket-driver (0.7.3)
|
||||
websocket-driver (0.8.0)
|
||||
base64
|
||||
websocket-extensions (>= 0.1.0)
|
||||
websocket-extensions (0.1.5)
|
||||
zeitwerk (2.4.0)
|
||||
zeitwerk (2.7.4)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
activemodel-serializers-xml!
|
||||
devise!
|
||||
mocha (~> 1.1)
|
||||
minitest (< 6)
|
||||
mocha (~> 2.1)
|
||||
mongoid (~> 9.0)!
|
||||
omniauth
|
||||
omniauth-facebook
|
||||
omniauth-oauth2
|
||||
omniauth-openid
|
||||
rails (~> 6.0.0)
|
||||
rails-controller-testing!
|
||||
ostruct
|
||||
rails (~> 8.1.0)
|
||||
rails-controller-testing
|
||||
rdoc
|
||||
responders (~> 3.0)
|
||||
sqlite3 (~> 1.4)
|
||||
responders (~> 3.1)
|
||||
rexml
|
||||
sqlite3
|
||||
timecop
|
||||
webrat (= 0.7.3)
|
||||
webrat
|
||||
|
||||
BUNDLED WITH
|
||||
1.17.3
|
||||
4.0.3
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
- Do not use the issues tracker for help or support, try Stack Overflow.
|
||||
- For bugs, do a quick search and make sure the bug has not yet been reported
|
||||
- If you found a security bug, do not report it through GitHub. Please send an e-mail to heartcombo@googlegroups.com instead.
|
||||
- If you found a security bug, do not report it through GitHub. Please send an e-mail to heartcombo.oss@gmail.com instead.
|
||||
- Finally, be nice and have fun!
|
||||
|
||||
## Environment
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
Copyright 2020 Rafael França, Leonardo Tegon, Carlos Antônio da Silva.
|
||||
Copyright 2009-2019 Plataformatec.
|
||||
Copyright (c) 2020-CURRENT Rafael França, Carlos Antonio da Silva
|
||||
Copyright (c) 2009-2019 Plataformatec
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
|
||||
145
README.md
145
README.md
@@ -1,7 +1,4 @@
|
||||

|
||||
|
||||
[](http://travis-ci.org/heartcombo/devise)
|
||||
[](https://codeclimate.com/github/heartcombo/devise)
|
||||

|
||||
|
||||
Devise is a flexible authentication solution for Rails based on Warden. It:
|
||||
|
||||
@@ -12,16 +9,16 @@ Devise is a flexible authentication solution for Rails based on Warden. It:
|
||||
|
||||
It's composed of 10 modules:
|
||||
|
||||
* [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.
|
||||
* [Omniauthable](http://www.rubydoc.info/github/heartcombo/devise/master/Devise/Models/Omniauthable): adds OmniAuth (https://github.com/omniauth/omniauth) support.
|
||||
* [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.
|
||||
* [Recoverable](http://www.rubydoc.info/github/heartcombo/devise/master/Devise/Models/Recoverable): resets the user password and sends reset instructions.
|
||||
* [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.
|
||||
* [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.
|
||||
* [Trackable](http://www.rubydoc.info/github/heartcombo/devise/master/Devise/Models/Trackable): tracks sign in count, timestamps and IP address.
|
||||
* [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.
|
||||
* [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.
|
||||
* [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.
|
||||
* [Database Authenticatable](https://www.rubydoc.info/gems/devise/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.
|
||||
* [Omniauthable](https://www.rubydoc.info/gems/devise/Devise/Models/Omniauthable): adds OmniAuth (https://github.com/omniauth/omniauth) support.
|
||||
* [Confirmable](https://www.rubydoc.info/gems/devise/Devise/Models/Confirmable): sends emails with confirmation instructions and verifies whether an account is already confirmed during sign in.
|
||||
* [Recoverable](https://www.rubydoc.info/gems/devise/Devise/Models/Recoverable): resets the user password and sends reset instructions.
|
||||
* [Registerable](https://www.rubydoc.info/gems/devise/Devise/Models/Registerable): handles signing up users through a registration process, also allowing them to edit and destroy their account.
|
||||
* [Rememberable](https://www.rubydoc.info/gems/devise/Devise/Models/Rememberable): manages generating and clearing a token for remembering the user from a saved cookie.
|
||||
* [Trackable](https://www.rubydoc.info/gems/devise/Devise/Models/Trackable): tracks sign in count, timestamps and IP address.
|
||||
* [Timeoutable](https://www.rubydoc.info/gems/devise/Devise/Models/Timeoutable): expires sessions that have not been active in a specified period of time.
|
||||
* [Validatable](https://www.rubydoc.info/gems/devise/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.
|
||||
* [Lockable](https://www.rubydoc.info/gems/devise/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.
|
||||
|
||||
## Table of Contents
|
||||
|
||||
@@ -34,6 +31,7 @@ It's composed of 10 modules:
|
||||
- [RDocs](#rdocs)
|
||||
- [Example applications](#example-applications)
|
||||
- [Extensions](#extensions)
|
||||
- [Supported Ruby / Rails versions](#supported-ruby--rails-versions)
|
||||
- [Contributing](#contributing)
|
||||
- [Starting with Rails?](#starting-with-rails)
|
||||
- [Getting started](#getting-started)
|
||||
@@ -49,13 +47,12 @@ It's composed of 10 modules:
|
||||
- [Integration tests](#integration-tests)
|
||||
- [OmniAuth](#omniauth)
|
||||
- [Configuring multiple models](#configuring-multiple-models)
|
||||
- [ActiveJob Integration](#activejob-integration)
|
||||
- [Active Job Integration](#active-job-integration)
|
||||
- [Password reset tokens and Rails logs](#password-reset-tokens-and-rails-logs)
|
||||
- [Other ORMs](#other-orms)
|
||||
- [Rails API mode](#rails-api-mode)
|
||||
- [Additional information](#additional-information)
|
||||
- [Warden](#warden)
|
||||
- [Contributors](#contributors)
|
||||
- [License](#license)
|
||||
|
||||
<!-- /TOC -->
|
||||
@@ -76,7 +73,7 @@ If you discover a problem with Devise, we would like to know about it. However,
|
||||
|
||||
https://github.com/heartcombo/devise/wiki/Bug-reports
|
||||
|
||||
If you have discovered a security related bug, please do *NOT* use the GitHub issue tracker. Send an email to heartcombo@googlegroups.com.
|
||||
If you have discovered a security related bug, please do *NOT* use the GitHub issue tracker. Send an email to heartcombo.oss@gmail.com.
|
||||
|
||||
### StackOverflow and Mailing List
|
||||
|
||||
@@ -84,15 +81,16 @@ If you have any questions, comments, or concerns, please use StackOverflow inste
|
||||
|
||||
http://stackoverflow.com/questions/tagged/devise
|
||||
|
||||
The deprecated mailing list can still be read on
|
||||
The deprecated mailing lists can still be read on:
|
||||
|
||||
https://groups.google.com/group/plataformatec-devise
|
||||
https://groups.google.com/group/heartcombo
|
||||
|
||||
### RDocs
|
||||
|
||||
You can view the Devise documentation in RDoc format here:
|
||||
|
||||
http://rubydoc.info/github/heartcombo/devise/master/frames
|
||||
http://rubydoc.info/github/heartcombo/devise/main/frames
|
||||
|
||||
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.
|
||||
|
||||
@@ -108,6 +106,13 @@ Our community has created a number of extensions that add functionality above an
|
||||
|
||||
https://github.com/heartcombo/devise/wiki/Extensions
|
||||
|
||||
### Supported Ruby / Rails versions
|
||||
|
||||
We intend to maintain support for all Ruby / Rails versions that haven't reached end-of-life.
|
||||
|
||||
For more information about specific versions please check [Ruby](https://www.ruby-lang.org/en/downloads/branches/)
|
||||
and [Rails](https://guides.rubyonrails.org/maintenance_policy.html) maintenance policies, and our test matrix.
|
||||
|
||||
### Contributing
|
||||
|
||||
We hope that you will consider contributing to Devise. Please read this short overview for some information about how to get started:
|
||||
@@ -117,8 +122,8 @@ https://github.com/heartcombo/devise/wiki/Contributing
|
||||
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`.
|
||||
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`.
|
||||
|
||||
### DEVISE_ORM
|
||||
Since Devise support both Mongoid and ActiveRecord, we rely on this variable to run specific code for each ORM.
|
||||
#### DEVISE_ORM
|
||||
Since Devise supports both Mongoid and ActiveRecord, we rely on this variable to run specific code for each ORM.
|
||||
The default value of `DEVISE_ORM` is `active_record`. To run the tests for Mongoid, you can pass `mongoid`:
|
||||
```
|
||||
DEVISE_ORM=mongoid bin/test
|
||||
@@ -129,20 +134,20 @@ When running the tests for Mongoid, you will need to have a MongoDB server (vers
|
||||
|
||||
Please note that the command output will show the variable value being used.
|
||||
|
||||
### BUNDLE_GEMFILE
|
||||
#### BUNDLE_GEMFILE
|
||||
We can use this variable to tell bundler what Gemfile it should use (instead of the one in the current directory).
|
||||
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.
|
||||
For example, if the tests broke using Ruby 2.4.2 and Rails 4.1, you can do the following:
|
||||
Inside the [gemfiles](https://github.com/heartcombo/devise/tree/main/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 using some of them. If that's the case, you can simulate the same environment using the `BUNDLE_GEMFILE` variable.
|
||||
For example, if the tests broke using Ruby 3.4 and Rails 8.0, you can do the following:
|
||||
```bash
|
||||
rbenv shell 2.4.2 # or rvm use 2.4.2
|
||||
BUNDLE_GEMFILE=gemfiles/Gemfile.rails-4.1-stable bundle install
|
||||
BUNDLE_GEMFILE=gemfiles/Gemfile.rails-4.1-stable bin/test
|
||||
chruby 3.4.0 # or rbenv shell 3.4.0, or rvm use 3.4.0, etc.
|
||||
BUNDLE_GEMFILE=gemfiles/Gemfile-rails-8-0 bundle install
|
||||
BUNDLE_GEMFILE=gemfiles/Gemfile-rails-8-0 bin/test
|
||||
```
|
||||
|
||||
You can also combine both of them if the tests broke for Mongoid:
|
||||
```bash
|
||||
BUNDLE_GEMFILE=gemfiles/Gemfile.rails-4.1-stable bundle install
|
||||
BUNDLE_GEMFILE=gemfiles/Gemfile.rails-4.1-stable DEVISE_ORM=mongoid bin/test
|
||||
BUNDLE_GEMFILE=gemfiles/Gemfile-rails-8-0 bundle install
|
||||
BUNDLE_GEMFILE=gemfiles/Gemfile-rails-8-0 DEVISE_ORM=mongoid bin/test
|
||||
```
|
||||
|
||||
### Running tests
|
||||
@@ -158,9 +163,10 @@ bin/test
|
||||
bin/test test/models/trackable_test.rb
|
||||
```
|
||||
|
||||
* Running a specific test given a regex:
|
||||
* Running a specific test given a line number or a regex:
|
||||
```bash
|
||||
bin/test test/models/trackable_test.rb:16
|
||||
bin/test test/models/trackable_test.rb -n '/update.*record/'
|
||||
```
|
||||
|
||||
## Starting with Rails?
|
||||
@@ -175,18 +181,16 @@ Once you have solidified your understanding of Rails and authentication mechanis
|
||||
|
||||
## Getting started
|
||||
|
||||
Devise 4.0 works with Rails 4.1 onwards. Add the following line to your Gemfile:
|
||||
Devise 5 works with Rails 7 onwards. Run:
|
||||
|
||||
```ruby
|
||||
gem 'devise'
|
||||
```sh
|
||||
bundle add devise
|
||||
```
|
||||
|
||||
Then run `bundle install`
|
||||
|
||||
Next, you need to run the generator:
|
||||
|
||||
```console
|
||||
$ rails generate devise:install
|
||||
rails generate devise:install
|
||||
```
|
||||
|
||||
At this point, a number of instructions will appear in the console. Among these instructions, you'll need to set up the default URL options for the Devise mailer in each environment. Here is a possible configuration for `config/environments/development.rb`:
|
||||
@@ -201,7 +205,7 @@ The generator will install an initializer which describes ALL of Devise's config
|
||||
In the following command you will replace `MODEL` with the class name used for the application’s users (it’s frequently `User` but could also be `Admin`). This will create a model (if one does not exist) and configure it with the default Devise modules. The generator also configures your `config/routes.rb` file to point to the Devise controller.
|
||||
|
||||
```console
|
||||
$ rails generate devise MODEL
|
||||
rails generate devise MODEL
|
||||
```
|
||||
|
||||
Next, check the MODEL for any additional configuration options you might want to add, such as confirmable or lockable. If you add an option, be sure to inspect the migration file (created by the generator if your ORM supports them) and uncomment the appropriate section. For example, if you add the confirmable option in the model, you'll need to uncomment the Confirmable section in the migration.
|
||||
@@ -373,7 +377,7 @@ We built Devise to help you quickly develop an application that uses authenticat
|
||||
Since Devise is an engine, all its views are packaged inside the gem. These views will help you get started, but after some time you may want to change them. If this is the case, you just need to invoke the following generator, and it will copy all views to your application:
|
||||
|
||||
```console
|
||||
$ rails generate devise:views
|
||||
rails generate devise:views
|
||||
```
|
||||
|
||||
If you have more than one Devise model in your application (such as `User` and `Admin`), you will notice that Devise uses the same views for all models. Fortunately, Devise offers an easy way to customize views. All you need to do is set `config.scoped_views = true` inside the `config/initializers/devise.rb` file.
|
||||
@@ -381,14 +385,14 @@ If you have more than one Devise model in your application (such as `User` and `
|
||||
After doing so, you will be able to have views based on the role like `users/sessions/new` and `admins/sessions/new`. If no view is found within the scope, Devise will use the default view at `devise/sessions/new`. You can also use the generator to generate scoped views:
|
||||
|
||||
```console
|
||||
$ rails generate devise:views users
|
||||
rails generate devise:views users
|
||||
```
|
||||
|
||||
If you would like to generate only a few sets of views, like the ones for the `registerable` and `confirmable` module,
|
||||
you can pass a list of modules to the generator with the `-v` flag.
|
||||
you can pass a list of views to the generator with the `-v` flag.
|
||||
|
||||
```console
|
||||
$ rails generate devise:views -v registrations confirmations
|
||||
rails generate devise:views -v registrations confirmations
|
||||
```
|
||||
|
||||
### Configuring controllers
|
||||
@@ -398,7 +402,7 @@ If the customization at the views level is not enough, you can customize each co
|
||||
1. Create your custom controllers using the generator which requires a scope:
|
||||
|
||||
```console
|
||||
$ rails generate devise:controllers [scope]
|
||||
rails generate devise:controllers [scope]
|
||||
```
|
||||
|
||||
If you specify `users` as the scope, controllers will be created in `app/controllers/users/`.
|
||||
@@ -413,7 +417,7 @@ If the customization at the views level is not enough, you can customize each co
|
||||
...
|
||||
end
|
||||
```
|
||||
(Use the -c flag to specify a controller, for example: `rails generate devise:controllers users -c=sessions`)
|
||||
Use the `-c` flag to specify one or more controllers, for example: `rails generate devise:controllers users -c sessions`
|
||||
|
||||
2. Tell the router to use this controller:
|
||||
|
||||
@@ -421,7 +425,7 @@ If the customization at the views level is not enough, you can customize each co
|
||||
devise_for :users, controllers: { sessions: 'users/sessions' }
|
||||
```
|
||||
|
||||
3. Copy the views from `devise/sessions` to `users/sessions`. Since the controller was changed, it won't use the default views located in `devise/sessions`.
|
||||
3. Recommended but not required: copy (or move) the views from `devise/sessions` to `users/sessions`. Rails will continue using the views from `devise/sessions` due to inheritance if you skip this step, but having the views matching the controller(s) keeps things consistent.
|
||||
|
||||
4. Finally, change or extend the desired controller actions.
|
||||
|
||||
@@ -459,7 +463,7 @@ Devise also ships with default routes. If you need to customize them, you should
|
||||
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' }
|
||||
```
|
||||
|
||||
Be sure to check `devise_for` [documentation](http://www.rubydoc.info/github/heartcombo/devise/master/ActionDispatch/Routing/Mapper%3Adevise_for) for details.
|
||||
Be sure to check `devise_for` [documentation](https://www.rubydoc.info/gems/devise/ActionDispatch/Routing/Mapper#devise_for-instance_method) for details.
|
||||
|
||||
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:
|
||||
|
||||
@@ -477,6 +481,37 @@ Please note: You will still need to add `devise_for` in your routes in order to
|
||||
devise_for :users, skip: :all
|
||||
```
|
||||
|
||||
### Hotwire/Turbo
|
||||
|
||||
Devise integrates with Hotwire/Turbo by treating such requests as navigational, and configuring certain responses for errors and redirects to match the expected behavior. New apps are generated with the following response configuration by default, and existing apps may opt-in by adding the config to their Devise initializers:
|
||||
|
||||
```ruby
|
||||
Devise.setup do |config|
|
||||
# ...
|
||||
# When using Devise with Hotwire/Turbo, the http status for error responses
|
||||
# and some redirects must match the following. The default in Devise for existing
|
||||
# apps is `200 OK` and `302 Found` respectively, but new apps are generated with
|
||||
# these new defaults that match Hotwire/Turbo behavior.
|
||||
# Note: These might become the new default in future versions of Devise.
|
||||
config.responder.error_status = :unprocessable_content # for Rack 3.1 or higher
|
||||
# config.responder.error_status = :unprocessable_entity # for Rack 3.0 or lower
|
||||
config.responder.redirect_status = :see_other
|
||||
end
|
||||
```
|
||||
|
||||
**Important**: these custom responses require the `responders` gem version to be `3.1.0` or higher, please make sure you update it if you're going to use this configuration. Check [this upgrade guide](https://github.com/heartcombo/devise/wiki/How-To:-Upgrade-to-Devise-4.9.0-[Hotwire-Turbo-integration]) for more info.
|
||||
|
||||
_Note_: the above statuses configuration may become the default for Devise in a future release.
|
||||
|
||||
There are a couple other changes you might need to make in your app to work with Hotwire/Turbo, if you're migrating from rails-ujs:
|
||||
|
||||
* The `data-confirm` option that adds a confirmation modal to buttons/forms before submission needs to change to `data-turbo-confirm`, so that Turbo handles those appropriately.
|
||||
* The `data-method` option that sets the request method for link submissions needs to change to `data-turbo-method`. This is not necessary for `button_to` or `form`s since Turbo can handle those.
|
||||
|
||||
If you're setting up Devise to sign out via `:delete`, and you're using links (instead of buttons wrapped in a form) to sign out with the `method: :delete` option, they will need to be updated as described above. (Devise does not provide sign out links/buttons in its shared views.)
|
||||
|
||||
Make sure to inspect your views looking for those, and change appropriately.
|
||||
|
||||
### I18n
|
||||
|
||||
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:
|
||||
@@ -619,7 +654,7 @@ Unlike controller tests, integration tests do not need to supply the
|
||||
`devise.mapping` `env` value, as the mapping can be inferred by the routes that
|
||||
are executed in your tests.
|
||||
|
||||
You can read more about testing your Rails 3 - Rails 4 controllers with RSpec in the wiki:
|
||||
You can read more about testing your Rails controllers with RSpec in the wiki:
|
||||
|
||||
* https://github.com/heartcombo/devise/wiki/How-To:-Test-controllers-with-Rails-(and-RSpec)
|
||||
|
||||
@@ -666,9 +701,9 @@ Alternatively, you can simply run the Devise generator.
|
||||
|
||||
Keep in mind that those models will have completely different routes. They **do not** and **cannot** share the same controller for sign in, sign out and so on. In case you want to have different roles sharing the same actions, we recommend that you use a role-based approach, by either providing a role column or using a dedicated gem for authorization.
|
||||
|
||||
### ActiveJob Integration
|
||||
### Active Job Integration
|
||||
|
||||
If you are using Rails 4.2 and ActiveJob to deliver ActionMailer messages in the
|
||||
If you are using Active Job to deliver Action Mailer messages in the
|
||||
background through a queuing back-end, you can send Devise emails through your
|
||||
existing queue by overriding the `send_devise_notification` method in your model.
|
||||
|
||||
@@ -680,12 +715,12 @@ end
|
||||
|
||||
### Password reset tokens and Rails logs
|
||||
|
||||
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:
|
||||
If you enable the [Recoverable](https://www.rubydoc.info/gems/devise/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:
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
Rails sets the production logger level to DEBUG by default. Consider changing your production logger level to WARN if you wish to prevent tokens from being leaked into your logs. In `config/environments/production.rb`:
|
||||
Rails sets the production logger level to INFO by default. Consider changing your production logger level to WARN if you wish to prevent tokens from being leaked into your logs. In `config/environments/production.rb`:
|
||||
|
||||
```ruby
|
||||
config.log_level = :warn
|
||||
@@ -732,14 +767,10 @@ Devise is based on Warden, which is a general Rack authentication framework crea
|
||||
|
||||
https://github.com/wardencommunity/warden
|
||||
|
||||
### Contributors
|
||||
|
||||
We have a long list of valued contributors. Check them all at:
|
||||
|
||||
https://github.com/heartcombo/devise/graphs/contributors
|
||||
|
||||
## License
|
||||
|
||||
MIT License. Copyright 2020 Rafael França, Leonardo Tegon, Carlos Antônio da Silva. Copyright 2009-2019 Plataformatec.
|
||||
MIT License.
|
||||
Copyright 2020-CURRENT Rafael França, Carlos Antonio da Silva.
|
||||
Copyright 2009-2019 Plataformatec.
|
||||
|
||||
The Devise logo is licensed under [Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License](https://creativecommons.org/licenses/by-nc-nd/4.0/).
|
||||
|
||||
@@ -27,6 +27,7 @@ class Devise::ConfirmationsController < DeviseController
|
||||
set_flash_message!(:notice, :confirmed)
|
||||
respond_with_navigational(resource){ redirect_to after_confirmation_path_for(resource_name, resource) }
|
||||
else
|
||||
# TODO: use `error_status` when the default changes to `:unprocessable_entity` / `:unprocessable_content`.
|
||||
respond_with_navigational(resource.errors, status: :unprocessable_entity){ render :new }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -36,7 +36,7 @@ class Devise::PasswordsController < DeviseController
|
||||
|
||||
if resource.errors.empty?
|
||||
resource.unlock_access! if unlockable?(resource)
|
||||
if Devise.sign_in_after_reset_password
|
||||
if resource_class.sign_in_after_reset_password
|
||||
flash_message = resource.active_for_authentication? ? :updated : :updated_not_active
|
||||
set_flash_message!(:notice, flash_message)
|
||||
resource.after_database_authentication
|
||||
@@ -53,7 +53,7 @@ class Devise::PasswordsController < DeviseController
|
||||
|
||||
protected
|
||||
def after_resetting_password_path_for(resource)
|
||||
Devise.sign_in_after_reset_password ? after_sign_in_path_for(resource) : new_session_path(resource_name)
|
||||
resource_class.sign_in_after_reset_password ? after_sign_in_path_for(resource) : new_session_path(resource_name)
|
||||
end
|
||||
|
||||
# The path used after sending reset password instructions
|
||||
|
||||
@@ -67,7 +67,7 @@ class Devise::RegistrationsController < DeviseController
|
||||
Devise.sign_out_all_scopes ? sign_out : sign_out(resource_name)
|
||||
set_flash_message! :notice, :destroyed
|
||||
yield resource if block_given?
|
||||
respond_with_navigational(resource){ redirect_to after_sign_out_path_for(resource_name) }
|
||||
respond_with_navigational(resource){ redirect_to after_sign_out_path_for(resource_name), status: Devise.responder.redirect_status }
|
||||
end
|
||||
|
||||
# GET /resource/cancel
|
||||
|
||||
@@ -28,7 +28,7 @@ class Devise::SessionsController < DeviseController
|
||||
signed_out = (Devise.sign_out_all_scopes ? sign_out : sign_out(resource_name))
|
||||
set_flash_message! :notice, :signed_out if signed_out
|
||||
yield if block_given?
|
||||
respond_to_on_destroy
|
||||
respond_to_on_destroy(non_navigational_status: :no_content)
|
||||
end
|
||||
|
||||
protected
|
||||
@@ -45,7 +45,7 @@ class Devise::SessionsController < DeviseController
|
||||
end
|
||||
|
||||
def auth_options
|
||||
{ scope: resource_name, recall: "#{controller_path}#new" }
|
||||
{ scope: resource_name, recall: "#{controller_path}#new", locale: I18n.locale }
|
||||
end
|
||||
|
||||
def translation_scope
|
||||
@@ -62,7 +62,7 @@ class Devise::SessionsController < DeviseController
|
||||
if all_signed_out?
|
||||
set_flash_message! :notice, :already_signed_out
|
||||
|
||||
respond_to_on_destroy
|
||||
respond_to_on_destroy(non_navigational_status: :unauthorized)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -72,12 +72,12 @@ class Devise::SessionsController < DeviseController
|
||||
users.all?(&:blank?)
|
||||
end
|
||||
|
||||
def respond_to_on_destroy
|
||||
def respond_to_on_destroy(non_navigational_status: :no_content)
|
||||
# We actually need to hardcode this as Rails default responder doesn't
|
||||
# support returning empty response on GET request
|
||||
respond_to do |format|
|
||||
format.all { head :no_content }
|
||||
format.any(*navigational_formats) { redirect_to after_sign_out_path_for(resource_name) }
|
||||
format.all { head non_navigational_status }
|
||||
format.any(*navigational_formats) { redirect_to after_sign_out_path_for(resource_name), status: Devise.responder.redirect_status }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -29,6 +29,7 @@ class Devise::UnlocksController < DeviseController
|
||||
set_flash_message! :notice, :unlocked
|
||||
respond_with_navigational(resource){ redirect_to after_unlock_path_for(resource) }
|
||||
else
|
||||
# TODO: use `error_status` when the default changes to `:unprocessable_entity` / `:unprocessable_content`.
|
||||
respond_with_navigational(resource.errors, status: :unprocessable_entity){ render :new }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -15,6 +15,7 @@ class DeviseController < Devise.parent_controller.constantize
|
||||
end
|
||||
|
||||
prepend_before_action :assert_is_devise_resource!
|
||||
self.responder = Devise.responder
|
||||
respond_to :html if mimes_for_respond_to.empty?
|
||||
|
||||
# Override prefixes to consider the scoped view.
|
||||
@@ -32,6 +33,19 @@ class DeviseController < Devise.parent_controller.constantize
|
||||
end
|
||||
end
|
||||
|
||||
# Override internal methods to exclude `_prefixes` from action methods since
|
||||
# we override it above.
|
||||
#
|
||||
# There was an intentional change in Rails 7.1 that will allow it to become
|
||||
# an action method because it's a public method of a non-abstract controller,
|
||||
# but we also can't make this abstract because it can affect potential actions
|
||||
# defined in the parent controller, so instead we ensure `_prefixes` is going
|
||||
# to be considered internal. (and thus, won't become an action method.)
|
||||
# Ref: https://github.com/rails/rails/pull/48699
|
||||
def self.internal_methods #:nodoc:
|
||||
super << :_prefixes
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
# Gets the actual resource stored in the instance variable
|
||||
|
||||
@@ -1,30 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Keeping the helper around for backward compatibility.
|
||||
module DeviseHelper
|
||||
# Retain this method for backwards compatibility, deprecated in favor of modifying the
|
||||
# devise/shared/error_messages partial.
|
||||
def devise_error_messages!
|
||||
ActiveSupport::Deprecation.warn <<-DEPRECATION.strip_heredoc
|
||||
[Devise] `DeviseHelper#devise_error_messages!` is deprecated and will be
|
||||
removed in the next major version.
|
||||
|
||||
Devise now uses a partial under "devise/shared/error_messages" to display
|
||||
error messages by default, and make them easier to customize. Update your
|
||||
views changing calls from:
|
||||
|
||||
<%= devise_error_messages! %>
|
||||
|
||||
to:
|
||||
|
||||
<%= render "devise/shared/error_messages", resource: resource %>
|
||||
|
||||
To start customizing how errors are displayed, you can copy the partial
|
||||
from devise to your `app/views` folder. Alternatively, you can run
|
||||
`rails g devise:views` which will copy all of them again to your app.
|
||||
DEPRECATION
|
||||
|
||||
return "" if resource.errors.empty?
|
||||
|
||||
render "devise/shared/error_messages", resource: resource
|
||||
end
|
||||
end
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
<%= render "devise/shared/error_messages", resource: resource %>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :email %><br />
|
||||
<%= f.email_field :email, autofocus: true, autocomplete: "email", value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) %>
|
||||
<p><%= f.label :email %></p>
|
||||
<p><%= f.email_field :email, autofocus: true, autocomplete: "email", value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) %></p>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
|
||||
@@ -5,16 +5,16 @@
|
||||
<%= f.hidden_field :reset_password_token %>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :password, "New password" %><br />
|
||||
<p><%= f.label :password, "New password" %></p>
|
||||
<% if @minimum_password_length %>
|
||||
<em>(<%= @minimum_password_length %> characters minimum)</em><br />
|
||||
<p><em>(<%= @minimum_password_length %> characters minimum)</em></p>
|
||||
<% end %>
|
||||
<%= f.password_field :password, autofocus: true, autocomplete: "new-password" %>
|
||||
<p><%= f.password_field :password, autofocus: true, autocomplete: "new-password" %></p>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :password_confirmation, "Confirm new password" %><br />
|
||||
<%= f.password_field :password_confirmation, autocomplete: "new-password" %>
|
||||
<p><%= f.label :password_confirmation, "Confirm new password" %></p>
|
||||
<p><%= f.password_field :password_confirmation, autocomplete: "new-password" %></p>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
<%= render "devise/shared/error_messages", resource: resource %>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :email %><br />
|
||||
<%= f.email_field :email, autofocus: true, autocomplete: "email" %>
|
||||
<p><%= f.label :email %></p>
|
||||
<p><%= f.email_field :email, autofocus: true, autocomplete: "email" %></p>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<%= f.submit "Send me reset password instructions" %>
|
||||
<%= f.submit "Send me password reset instructions" %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
<%= render "devise/shared/error_messages", resource: resource %>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :email %><br />
|
||||
<%= f.email_field :email, autofocus: true, autocomplete: "email" %>
|
||||
<p><%= f.label :email %></p>
|
||||
<p><%= f.email_field :email, autofocus: true, autocomplete: "email" %></p>
|
||||
</div>
|
||||
|
||||
<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
|
||||
@@ -13,22 +13,21 @@
|
||||
<% end %>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :password %> <i>(leave blank if you don't want to change it)</i><br />
|
||||
<%= f.password_field :password, autocomplete: "new-password" %>
|
||||
<p><%= f.label :password %> <i>(leave blank if you don't want to change it)</i></p>
|
||||
<p><%= f.password_field :password, autocomplete: "new-password" %></p>
|
||||
<% if @minimum_password_length %>
|
||||
<br />
|
||||
<em><%= @minimum_password_length %> characters minimum</em>
|
||||
<p><em><%= @minimum_password_length %> characters minimum</em></p>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :password_confirmation %><br />
|
||||
<%= f.password_field :password_confirmation, autocomplete: "new-password" %>
|
||||
<p><%= f.label :password_confirmation %></p>
|
||||
<p><%= f.password_field :password_confirmation, autocomplete: "new-password" %></p>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br />
|
||||
<%= f.password_field :current_password, autocomplete: "current-password" %>
|
||||
<p><%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i></p>
|
||||
<p><%= f.password_field :current_password, autocomplete: "current-password" %></p>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
@@ -38,6 +37,6 @@
|
||||
|
||||
<h3>Cancel my account</h3>
|
||||
|
||||
<p>Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete %></p>
|
||||
<div>Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?", turbo_confirm: "Are you sure?" }, method: :delete %></div>
|
||||
|
||||
<%= link_to "Back", :back %>
|
||||
|
||||
@@ -4,21 +4,21 @@
|
||||
<%= render "devise/shared/error_messages", resource: resource %>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :email %><br />
|
||||
<%= f.email_field :email, autofocus: true, autocomplete: "email" %>
|
||||
<p><%= f.label :email %></p>
|
||||
<p><%= f.email_field :email, autofocus: true, autocomplete: "email" %></p>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :password %>
|
||||
<p><%= f.label :password %></p>
|
||||
<% if @minimum_password_length %>
|
||||
<em>(<%= @minimum_password_length %> characters minimum)</em>
|
||||
<% end %><br />
|
||||
<%= f.password_field :password, autocomplete: "new-password" %>
|
||||
<p><em>(<%= @minimum_password_length %> characters minimum)</em></p>
|
||||
<% end %>
|
||||
<p><%= f.password_field :password, autocomplete: "new-password" %></p>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :password_confirmation %><br />
|
||||
<%= f.password_field :password_confirmation, autocomplete: "new-password" %>
|
||||
<p><%= f.label :password_confirmation %></p>
|
||||
<p><%= f.password_field :password_confirmation, autocomplete: "new-password" %></p>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
|
||||
@@ -2,19 +2,19 @@
|
||||
|
||||
<%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
|
||||
<div class="field">
|
||||
<%= f.label :email %><br />
|
||||
<%= f.email_field :email, autofocus: true, autocomplete: "email" %>
|
||||
<p><%= f.label :email %></p>
|
||||
<p><%= f.email_field :email, autofocus: true, autocomplete: "email" %></p>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :password %><br />
|
||||
<%= f.password_field :password, autocomplete: "current-password" %>
|
||||
<p><%= f.label :password %></p>
|
||||
<p><%= f.password_field :password, autocomplete: "current-password" %></p>
|
||||
</div>
|
||||
|
||||
<% if devise_mapping.rememberable? %>
|
||||
<div class="field">
|
||||
<%= f.check_box :remember_me %>
|
||||
<%= f.label :remember_me %>
|
||||
<p><%= f.check_box :remember_me %></p>
|
||||
<p><%= f.label :remember_me %></p>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<% if resource.errors.any? %>
|
||||
<div id="error_explanation">
|
||||
<div id="error_explanation" data-turbo-temporary>
|
||||
<h2>
|
||||
<%= I18n.t("errors.messages.not_saved",
|
||||
count: resource.errors.count,
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
<%- if controller_name != 'sessions' %>
|
||||
<%= link_to "Log in", new_session_path(resource_name) %><br />
|
||||
<p><%= link_to "Log in", new_session_path(resource_name) %></p>
|
||||
<% end %>
|
||||
|
||||
<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
|
||||
<%= link_to "Sign up", new_registration_path(resource_name) %><br />
|
||||
<p><%= link_to "Sign up", new_registration_path(resource_name) %></p>
|
||||
<% end %>
|
||||
|
||||
<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
|
||||
<%= link_to "Forgot your password?", new_password_path(resource_name) %><br />
|
||||
<p><%= link_to "Forgot your password?", new_password_path(resource_name) %></p>
|
||||
<% end %>
|
||||
|
||||
<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
|
||||
<%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br />
|
||||
<p><%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %></p>
|
||||
<% end %>
|
||||
|
||||
<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
|
||||
<%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %><br />
|
||||
<p><%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %></p>
|
||||
<% end %>
|
||||
|
||||
<%- if devise_mapping.omniauthable? %>
|
||||
<%- resource_class.omniauth_providers.each do |provider| %>
|
||||
<%= link_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider) %><br />
|
||||
<p><%= button_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider), data: { turbo: false } %></p>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
<%= render "devise/shared/error_messages", resource: resource %>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :email %><br />
|
||||
<%= f.email_field :email, autofocus: true, autocomplete: "email" %>
|
||||
<p><%= f.label :email %></p>
|
||||
<p><%= f.email_field :email, autofocus: true, autocomplete: "email" %></p>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
|
||||
19
bin/test
19
bin/test
@@ -1,17 +1,12 @@
|
||||
#!/usr/bin/env ruby
|
||||
$: << File.expand_path(File.expand_path('../../test', __FILE__))
|
||||
|
||||
# Remove this begin/rescue once Rails 4 support is removed.
|
||||
begin
|
||||
require 'bundler/setup'
|
||||
require 'rails/test_unit/runner'
|
||||
require 'rails/test_unit/reporter'
|
||||
require 'rails/test_unit/line_filtering'
|
||||
require 'bundler/setup'
|
||||
require 'rails/test_unit/runner'
|
||||
require 'rails/test_unit/reporter'
|
||||
require 'rails/test_unit/line_filtering'
|
||||
|
||||
Rails::TestUnitReporter.executable = 'bin/test'
|
||||
Rails::TestUnitReporter.executable = 'bin/test'
|
||||
|
||||
Rails::TestUnit::Runner.parse_options(ARGV)
|
||||
Rails::TestUnit::Runner.run(ARGV)
|
||||
rescue LoadError
|
||||
exec 'rake'
|
||||
end
|
||||
Rails::TestUnit::Runner.parse_options(ARGV)
|
||||
Rails::TestUnit::Runner.run(ARGV)
|
||||
|
||||
@@ -44,7 +44,7 @@ en:
|
||||
signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please follow the link to activate your account."
|
||||
update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirmation link to confirm your new email address."
|
||||
updated: "Your account has been updated successfully."
|
||||
updated_but_not_signed_in: "Your account has been updated successfully, but since your password was changed, you need to sign in again"
|
||||
updated_but_not_signed_in: "Your account has been updated successfully, but since your password was changed, you need to sign in again."
|
||||
sessions:
|
||||
signed_in: "Signed in successfully."
|
||||
signed_out: "Signed out successfully."
|
||||
|
||||
@@ -10,18 +10,26 @@ Gem::Specification.new do |s|
|
||||
s.platform = Gem::Platform::RUBY
|
||||
s.licenses = ["MIT"]
|
||||
s.summary = "Flexible authentication solution for Rails with Warden"
|
||||
s.email = "heartcombo@googlegroups.com"
|
||||
s.email = "heartcombo.oss@gmail.com"
|
||||
s.homepage = "https://github.com/heartcombo/devise"
|
||||
s.description = "Flexible authentication solution for Rails with Warden"
|
||||
s.authors = ['José Valim', 'Carlos Antônio']
|
||||
s.metadata = {
|
||||
"homepage_uri" => "https://github.com/heartcombo/devise",
|
||||
"documentation_uri" => "https://rubydoc.info/github/heartcombo/devise",
|
||||
"changelog_uri" => "https://github.com/heartcombo/devise/blob/main/CHANGELOG.md",
|
||||
"source_code_uri" => "https://github.com/heartcombo/devise",
|
||||
"bug_tracker_uri" => "https://github.com/heartcombo/devise/issues",
|
||||
"wiki_uri" => "https://github.com/heartcombo/devise/wiki"
|
||||
}
|
||||
|
||||
s.files = Dir["{app,config,lib}/**/*", "CHANGELOG.md", "MIT-LICENSE", "README.md"]
|
||||
s.require_paths = ["lib"]
|
||||
s.required_ruby_version = '>= 2.1.0'
|
||||
s.required_ruby_version = '>= 2.7.0'
|
||||
|
||||
s.add_dependency("warden", "~> 1.2.3")
|
||||
s.add_dependency("orm_adapter", "~> 0.1")
|
||||
s.add_dependency("bcrypt", "~> 3.0")
|
||||
s.add_dependency("railties", ">= 4.1.0")
|
||||
s.add_dependency("railties", ">= 7.0")
|
||||
s.add_dependency("responders")
|
||||
end
|
||||
|
||||
@@ -2,25 +2,30 @@ source "https://rubygems.org"
|
||||
|
||||
gemspec path: ".."
|
||||
|
||||
gem "rails", '~> 5.2.0'
|
||||
gem "rails", "~> 7.0.0"
|
||||
gem "omniauth"
|
||||
gem "omniauth-oauth2"
|
||||
gem "rdoc"
|
||||
|
||||
gem "activemodel-serializers-xml", github: "rails/activemodel-serializers-xml"
|
||||
|
||||
gem "rails-controller-testing"
|
||||
|
||||
gem "responders", "~> 2.1"
|
||||
gem "responders", "~> 3.1"
|
||||
|
||||
group :test do
|
||||
gem "omniauth-facebook"
|
||||
gem "omniauth-openid"
|
||||
gem "rexml"
|
||||
gem "timecop"
|
||||
gem "webrat", "0.7.3", require: false
|
||||
gem "mocha", "~> 1.1", require: false
|
||||
gem "mocha", "~> 2.1", require: false
|
||||
gem "minitest", "< 6"
|
||||
gem "ostruct"
|
||||
end
|
||||
|
||||
platforms :ruby do
|
||||
gem "sqlite3", "~> 1.3.6"
|
||||
gem "sqlite3", "~> 1.4"
|
||||
end
|
||||
|
||||
group :mongoid do
|
||||
gem "mongoid", "~> 7.5"
|
||||
end
|
||||
31
gemfiles/Gemfile-rails-7-1
Normal file
31
gemfiles/Gemfile-rails-7-1
Normal file
@@ -0,0 +1,31 @@
|
||||
source "https://rubygems.org"
|
||||
|
||||
gemspec path: ".."
|
||||
|
||||
gem "rails", "~> 7.1.0"
|
||||
gem "omniauth"
|
||||
gem "omniauth-oauth2"
|
||||
gem "rdoc"
|
||||
|
||||
gem "rails-controller-testing"
|
||||
|
||||
gem "responders", "~> 3.1"
|
||||
|
||||
group :test do
|
||||
gem "omniauth-facebook"
|
||||
gem "omniauth-openid"
|
||||
gem "rexml"
|
||||
gem "timecop"
|
||||
gem "webrat"
|
||||
gem "mocha", "~> 2.1", require: false
|
||||
gem "minitest", "< 6"
|
||||
gem "ostruct"
|
||||
end
|
||||
|
||||
platforms :ruby do
|
||||
gem "sqlite3", "~> 1.4"
|
||||
end
|
||||
|
||||
group :mongoid do
|
||||
gem "mongoid", "~> 8.1"
|
||||
end
|
||||
32
gemfiles/Gemfile-rails-7-2
Normal file
32
gemfiles/Gemfile-rails-7-2
Normal file
@@ -0,0 +1,32 @@
|
||||
source "https://rubygems.org"
|
||||
|
||||
gemspec path: ".."
|
||||
|
||||
gem "rails", "~> 7.1.0"
|
||||
|
||||
gem "omniauth"
|
||||
gem "omniauth-oauth2"
|
||||
gem "rdoc"
|
||||
|
||||
gem "rails-controller-testing"
|
||||
|
||||
gem "responders", "~> 3.1"
|
||||
|
||||
group :test do
|
||||
gem "omniauth-facebook"
|
||||
gem "omniauth-openid"
|
||||
gem "rexml"
|
||||
gem "timecop"
|
||||
gem "webrat", require: false
|
||||
gem "mocha", "~> 2.1", require: false
|
||||
gem "minitest", "< 6"
|
||||
gem "ostruct"
|
||||
end
|
||||
|
||||
platforms :ruby do
|
||||
gem "sqlite3"
|
||||
end
|
||||
|
||||
group :mongoid do
|
||||
gem "mongoid", "~> 8.1"
|
||||
end
|
||||
31
gemfiles/Gemfile-rails-8-0
Normal file
31
gemfiles/Gemfile-rails-8-0
Normal file
@@ -0,0 +1,31 @@
|
||||
source "https://rubygems.org"
|
||||
|
||||
gemspec path: ".."
|
||||
|
||||
gem "rails", "~> 8.0.0"
|
||||
gem "omniauth"
|
||||
gem "omniauth-oauth2"
|
||||
gem "rdoc"
|
||||
|
||||
gem "rails-controller-testing"
|
||||
|
||||
gem "responders", "~> 3.1"
|
||||
|
||||
group :test do
|
||||
gem "omniauth-facebook"
|
||||
gem "omniauth-openid"
|
||||
gem "rexml"
|
||||
gem "timecop"
|
||||
gem 'webrat'
|
||||
gem "mocha", "~> 2.1", require: false
|
||||
gem "minitest", "< 6"
|
||||
gem "ostruct"
|
||||
end
|
||||
|
||||
platforms :ruby do
|
||||
gem "sqlite3"
|
||||
end
|
||||
|
||||
group :mongoid do
|
||||
gem "mongoid", "~> 8.1"
|
||||
end
|
||||
@@ -2,25 +2,30 @@ source "https://rubygems.org"
|
||||
|
||||
gemspec path: ".."
|
||||
|
||||
gem "rails", '~> 5.1.0'
|
||||
gem "rails", github: "rails/rails", branch: "main"
|
||||
gem "omniauth"
|
||||
gem "omniauth-oauth2"
|
||||
gem "rdoc"
|
||||
|
||||
gem "activemodel-serializers-xml", github: "rails/activemodel-serializers-xml"
|
||||
|
||||
gem "rails-controller-testing"
|
||||
|
||||
gem "responders", "~> 2.1"
|
||||
gem "responders", "~> 3.1"
|
||||
|
||||
group :test do
|
||||
gem "omniauth-facebook"
|
||||
gem "omniauth-openid"
|
||||
gem "rexml"
|
||||
gem "timecop"
|
||||
gem "webrat", "0.7.3", require: false
|
||||
gem "mocha", "~> 1.1", require: false
|
||||
gem "mocha", "~> 2.1", require: false
|
||||
gem "minitest", "< 6"
|
||||
gem "ostruct"
|
||||
end
|
||||
|
||||
platforms :ruby do
|
||||
gem "sqlite3", "~> 1.3.6"
|
||||
gem "sqlite3"
|
||||
end
|
||||
|
||||
group :mongoid do
|
||||
gem "mongoid", github: "mongodb/mongoid", branch: "master"
|
||||
end
|
||||
@@ -1,35 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
source "https://rubygems.org"
|
||||
|
||||
gemspec path: ".."
|
||||
|
||||
gem "rails", github: "rails/rails", branch: "4-1-stable"
|
||||
gem "omniauth"
|
||||
gem "omniauth-oauth2"
|
||||
gem "rdoc", "~> 5.1"
|
||||
# Force this version because it's breaking on CI since a higher nokogiri version requires Ruby 2.3+.
|
||||
gem "nokogiri", "1.9.1"
|
||||
|
||||
group :test do
|
||||
gem "omniauth-facebook"
|
||||
gem "omniauth-openid"
|
||||
gem "timecop"
|
||||
gem "webrat", "0.7.3", require: false
|
||||
gem "mocha", "~> 1.1", require: false
|
||||
gem 'test_after_commit', require: false
|
||||
end
|
||||
|
||||
platforms :jruby do
|
||||
gem "activerecord-jdbc-adapter"
|
||||
gem "activerecord-jdbcsqlite3-adapter"
|
||||
gem "jruby-openssl"
|
||||
end
|
||||
|
||||
platforms :ruby do
|
||||
gem "sqlite3", "~> 1.3.6"
|
||||
end
|
||||
|
||||
group :mongoid do
|
||||
gem "mongoid", "~> 4.0"
|
||||
end
|
||||
@@ -1,171 +0,0 @@
|
||||
GIT
|
||||
remote: https://github.com/rails/rails.git
|
||||
revision: 0cad778c2605a5204a05a9f1dbd3344e39f248d8
|
||||
branch: 4-1-stable
|
||||
specs:
|
||||
actionmailer (4.1.16)
|
||||
actionpack (= 4.1.16)
|
||||
actionview (= 4.1.16)
|
||||
mail (~> 2.5, >= 2.5.4)
|
||||
actionpack (4.1.16)
|
||||
actionview (= 4.1.16)
|
||||
activesupport (= 4.1.16)
|
||||
rack (~> 1.5.2)
|
||||
rack-test (~> 0.6.2)
|
||||
actionview (4.1.16)
|
||||
activesupport (= 4.1.16)
|
||||
builder (~> 3.1)
|
||||
erubis (~> 2.7.0)
|
||||
activemodel (4.1.16)
|
||||
activesupport (= 4.1.16)
|
||||
builder (~> 3.1)
|
||||
activerecord (4.1.16)
|
||||
activemodel (= 4.1.16)
|
||||
activesupport (= 4.1.16)
|
||||
arel (~> 5.0.0)
|
||||
activesupport (4.1.16)
|
||||
i18n (~> 0.6, >= 0.6.9)
|
||||
json (~> 1.7, >= 1.7.7)
|
||||
minitest (~> 5.1)
|
||||
thread_safe (~> 0.1)
|
||||
tzinfo (~> 1.1)
|
||||
rails (4.1.16)
|
||||
actionmailer (= 4.1.16)
|
||||
actionpack (= 4.1.16)
|
||||
actionview (= 4.1.16)
|
||||
activemodel (= 4.1.16)
|
||||
activerecord (= 4.1.16)
|
||||
activesupport (= 4.1.16)
|
||||
bundler (>= 1.3.0, < 2.0)
|
||||
railties (= 4.1.16)
|
||||
sprockets-rails (~> 2.0)
|
||||
railties (4.1.16)
|
||||
actionpack (= 4.1.16)
|
||||
activesupport (= 4.1.16)
|
||||
rake (>= 0.8.7)
|
||||
thor (>= 0.18.1, < 2.0)
|
||||
|
||||
PATH
|
||||
remote: ..
|
||||
specs:
|
||||
devise (4.7.2)
|
||||
bcrypt (~> 3.0)
|
||||
orm_adapter (~> 0.1)
|
||||
railties (>= 4.1.0)
|
||||
responders
|
||||
warden (~> 1.2.3)
|
||||
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
arel (5.0.1.20140414130214)
|
||||
bcrypt (3.1.13)
|
||||
bson (3.2.7)
|
||||
builder (3.2.4)
|
||||
concurrent-ruby (1.1.6)
|
||||
connection_pool (2.2.3)
|
||||
erubis (2.7.0)
|
||||
faraday (1.0.1)
|
||||
multipart-post (>= 1.2, < 3)
|
||||
hashie (3.6.0)
|
||||
i18n (0.9.5)
|
||||
concurrent-ruby (~> 1.0)
|
||||
json (1.8.6)
|
||||
jwt (2.2.1)
|
||||
mail (2.7.1)
|
||||
mini_mime (>= 0.1.1)
|
||||
mini_mime (1.0.2)
|
||||
mini_portile2 (2.4.0)
|
||||
minitest (5.14.1)
|
||||
mocha (1.11.2)
|
||||
mongoid (4.0.2)
|
||||
activemodel (~> 4.0)
|
||||
moped (~> 2.0.0)
|
||||
origin (~> 2.1)
|
||||
tzinfo (>= 0.3.37)
|
||||
moped (2.0.7)
|
||||
bson (~> 3.0)
|
||||
connection_pool (~> 2.0)
|
||||
optionable (~> 0.2.0)
|
||||
multi_json (1.14.1)
|
||||
multi_xml (0.6.0)
|
||||
multipart-post (2.1.1)
|
||||
nokogiri (1.9.1)
|
||||
mini_portile2 (~> 2.4.0)
|
||||
oauth2 (1.4.4)
|
||||
faraday (>= 0.8, < 2.0)
|
||||
jwt (>= 1.0, < 3.0)
|
||||
multi_json (~> 1.3)
|
||||
multi_xml (~> 0.5)
|
||||
rack (>= 1.2, < 3)
|
||||
omniauth (1.4.2)
|
||||
hashie (>= 1.2, < 4)
|
||||
rack (>= 1.0, < 3)
|
||||
omniauth-facebook (6.0.0)
|
||||
omniauth-oauth2 (~> 1.2)
|
||||
omniauth-oauth2 (1.5.0)
|
||||
oauth2 (~> 1.1)
|
||||
omniauth (~> 1.2)
|
||||
omniauth-openid (1.0.1)
|
||||
omniauth (~> 1.0)
|
||||
rack-openid (~> 1.3.1)
|
||||
optionable (0.2.0)
|
||||
origin (2.3.1)
|
||||
orm_adapter (0.5.0)
|
||||
rack (1.5.5)
|
||||
rack-openid (1.3.1)
|
||||
rack (>= 1.1.0)
|
||||
ruby-openid (>= 2.1.8)
|
||||
rack-test (0.6.3)
|
||||
rack (>= 1.0)
|
||||
rake (13.0.1)
|
||||
rdoc (5.1.0)
|
||||
responders (1.1.2)
|
||||
railties (>= 3.2, < 4.2)
|
||||
ruby-openid (2.9.2)
|
||||
sprockets (3.7.2)
|
||||
concurrent-ruby (~> 1.0)
|
||||
rack (> 1, < 3)
|
||||
sprockets-rails (2.3.3)
|
||||
actionpack (>= 3.0)
|
||||
activesupport (>= 3.0)
|
||||
sprockets (>= 2.8, < 4.0)
|
||||
sqlite3 (1.3.13)
|
||||
test_after_commit (1.2.2)
|
||||
activerecord (>= 3.2, < 5.0)
|
||||
thor (1.0.1)
|
||||
thread_safe (0.3.6)
|
||||
timecop (0.9.1)
|
||||
tzinfo (1.2.7)
|
||||
thread_safe (~> 0.1)
|
||||
warden (1.2.7)
|
||||
rack (>= 1.0)
|
||||
webrat (0.7.3)
|
||||
nokogiri (>= 1.2.0)
|
||||
rack (>= 1.0)
|
||||
rack-test (>= 0.5.3)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
activerecord-jdbc-adapter
|
||||
activerecord-jdbcsqlite3-adapter
|
||||
devise!
|
||||
jruby-openssl
|
||||
mocha (~> 1.1)
|
||||
mongoid (~> 4.0)
|
||||
nokogiri (= 1.9.1)
|
||||
omniauth
|
||||
omniauth-facebook
|
||||
omniauth-oauth2
|
||||
omniauth-openid
|
||||
rails!
|
||||
rdoc (~> 5.1)
|
||||
sqlite3 (~> 1.3.6)
|
||||
test_after_commit
|
||||
timecop
|
||||
webrat (= 0.7.3)
|
||||
|
||||
BUNDLED WITH
|
||||
1.17.3
|
||||
@@ -1,34 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
source "https://rubygems.org"
|
||||
|
||||
gemspec path: ".."
|
||||
|
||||
gem "rails", github: "rails/rails", branch: "4-2-stable"
|
||||
gem "omniauth"
|
||||
gem "omniauth-oauth2"
|
||||
gem "rdoc", "~> 5.1"
|
||||
gem "nokogiri", "1.9.1"
|
||||
|
||||
group :test do
|
||||
gem "omniauth-facebook"
|
||||
gem "omniauth-openid"
|
||||
gem "timecop"
|
||||
gem "webrat", "0.7.3", require: false
|
||||
gem "mocha", "~> 1.1", require: false
|
||||
gem 'test_after_commit', require: false
|
||||
end
|
||||
|
||||
platforms :jruby do
|
||||
gem "activerecord-jdbc-adapter"
|
||||
gem "activerecord-jdbcsqlite3-adapter"
|
||||
gem "jruby-openssl"
|
||||
end
|
||||
|
||||
platforms :ruby do
|
||||
gem "sqlite3", "~> 1.3.6"
|
||||
end
|
||||
|
||||
group :mongoid do
|
||||
gem "mongoid", "~> 4.0"
|
||||
end
|
||||
@@ -1,194 +0,0 @@
|
||||
GIT
|
||||
remote: https://github.com/rails/rails.git
|
||||
revision: c0cb0cbf976a3cf8ad1b0e2d0f813602a712e997
|
||||
branch: 4-2-stable
|
||||
specs:
|
||||
actionmailer (4.2.11.3)
|
||||
actionpack (= 4.2.11.3)
|
||||
actionview (= 4.2.11.3)
|
||||
activejob (= 4.2.11.3)
|
||||
mail (~> 2.5, >= 2.5.4)
|
||||
rails-dom-testing (~> 1.0, >= 1.0.5)
|
||||
actionpack (4.2.11.3)
|
||||
actionview (= 4.2.11.3)
|
||||
activesupport (= 4.2.11.3)
|
||||
rack (~> 1.6)
|
||||
rack-test (~> 0.6.2)
|
||||
rails-dom-testing (~> 1.0, >= 1.0.5)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
||||
actionview (4.2.11.3)
|
||||
activesupport (= 4.2.11.3)
|
||||
builder (~> 3.1)
|
||||
erubis (~> 2.7.0)
|
||||
rails-dom-testing (~> 1.0, >= 1.0.5)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
||||
activejob (4.2.11.3)
|
||||
activesupport (= 4.2.11.3)
|
||||
globalid (>= 0.3.0)
|
||||
activemodel (4.2.11.3)
|
||||
activesupport (= 4.2.11.3)
|
||||
builder (~> 3.1)
|
||||
activerecord (4.2.11.3)
|
||||
activemodel (= 4.2.11.3)
|
||||
activesupport (= 4.2.11.3)
|
||||
arel (~> 6.0)
|
||||
activesupport (4.2.11.3)
|
||||
i18n (~> 0.7)
|
||||
minitest (~> 5.1)
|
||||
thread_safe (~> 0.3, >= 0.3.4)
|
||||
tzinfo (~> 1.1)
|
||||
rails (4.2.11.3)
|
||||
actionmailer (= 4.2.11.3)
|
||||
actionpack (= 4.2.11.3)
|
||||
actionview (= 4.2.11.3)
|
||||
activejob (= 4.2.11.3)
|
||||
activemodel (= 4.2.11.3)
|
||||
activerecord (= 4.2.11.3)
|
||||
activesupport (= 4.2.11.3)
|
||||
bundler (>= 1.3.0, < 2.0)
|
||||
railties (= 4.2.11.3)
|
||||
sprockets-rails
|
||||
railties (4.2.11.3)
|
||||
actionpack (= 4.2.11.3)
|
||||
activesupport (= 4.2.11.3)
|
||||
rake (>= 0.8.7)
|
||||
thor (>= 0.18.1, < 2.0)
|
||||
|
||||
PATH
|
||||
remote: ..
|
||||
specs:
|
||||
devise (4.7.2)
|
||||
bcrypt (~> 3.0)
|
||||
orm_adapter (~> 0.1)
|
||||
railties (>= 4.1.0)
|
||||
responders
|
||||
warden (~> 1.2.3)
|
||||
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
arel (6.0.4)
|
||||
bcrypt (3.1.13)
|
||||
bson (3.2.7)
|
||||
builder (3.2.4)
|
||||
concurrent-ruby (1.1.6)
|
||||
connection_pool (2.2.3)
|
||||
crass (1.0.6)
|
||||
erubis (2.7.0)
|
||||
faraday (1.0.1)
|
||||
multipart-post (>= 1.2, < 3)
|
||||
globalid (0.4.2)
|
||||
activesupport (>= 4.2.0)
|
||||
hashie (4.1.0)
|
||||
i18n (0.9.5)
|
||||
concurrent-ruby (~> 1.0)
|
||||
jwt (2.2.1)
|
||||
loofah (2.5.0)
|
||||
crass (~> 1.0.2)
|
||||
nokogiri (>= 1.5.9)
|
||||
mail (2.7.1)
|
||||
mini_mime (>= 0.1.1)
|
||||
mini_mime (1.0.2)
|
||||
mini_portile2 (2.4.0)
|
||||
minitest (5.14.1)
|
||||
mocha (1.11.2)
|
||||
mongoid (4.0.2)
|
||||
activemodel (~> 4.0)
|
||||
moped (~> 2.0.0)
|
||||
origin (~> 2.1)
|
||||
tzinfo (>= 0.3.37)
|
||||
moped (2.0.7)
|
||||
bson (~> 3.0)
|
||||
connection_pool (~> 2.0)
|
||||
optionable (~> 0.2.0)
|
||||
multi_json (1.14.1)
|
||||
multi_xml (0.6.0)
|
||||
multipart-post (2.1.1)
|
||||
nokogiri (1.9.1)
|
||||
mini_portile2 (~> 2.4.0)
|
||||
oauth2 (1.4.4)
|
||||
faraday (>= 0.8, < 2.0)
|
||||
jwt (>= 1.0, < 3.0)
|
||||
multi_json (~> 1.3)
|
||||
multi_xml (~> 0.5)
|
||||
rack (>= 1.2, < 3)
|
||||
omniauth (1.9.1)
|
||||
hashie (>= 3.4.6)
|
||||
rack (>= 1.6.2, < 3)
|
||||
omniauth-facebook (6.0.0)
|
||||
omniauth-oauth2 (~> 1.2)
|
||||
omniauth-oauth2 (1.6.0)
|
||||
oauth2 (~> 1.1)
|
||||
omniauth (~> 1.9)
|
||||
omniauth-openid (1.0.1)
|
||||
omniauth (~> 1.0)
|
||||
rack-openid (~> 1.3.1)
|
||||
optionable (0.2.0)
|
||||
origin (2.3.1)
|
||||
orm_adapter (0.5.0)
|
||||
rack (1.6.13)
|
||||
rack-openid (1.3.1)
|
||||
rack (>= 1.1.0)
|
||||
ruby-openid (>= 2.1.8)
|
||||
rack-test (0.6.3)
|
||||
rack (>= 1.0)
|
||||
rails-deprecated_sanitizer (1.0.3)
|
||||
activesupport (>= 4.2.0.alpha)
|
||||
rails-dom-testing (1.0.9)
|
||||
activesupport (>= 4.2.0, < 5.0)
|
||||
nokogiri (~> 1.6)
|
||||
rails-deprecated_sanitizer (>= 1.0.1)
|
||||
rails-html-sanitizer (1.3.0)
|
||||
loofah (~> 2.3)
|
||||
rake (13.0.1)
|
||||
rdoc (5.1.0)
|
||||
responders (2.4.1)
|
||||
actionpack (>= 4.2.0, < 6.0)
|
||||
railties (>= 4.2.0, < 6.0)
|
||||
ruby-openid (2.9.2)
|
||||
sprockets (4.0.1)
|
||||
concurrent-ruby (~> 1.0)
|
||||
rack (> 1, < 3)
|
||||
sprockets-rails (3.2.1)
|
||||
actionpack (>= 4.0)
|
||||
activesupport (>= 4.0)
|
||||
sprockets (>= 3.0.0)
|
||||
sqlite3 (1.3.13)
|
||||
test_after_commit (1.2.2)
|
||||
activerecord (>= 3.2, < 5.0)
|
||||
thor (1.0.1)
|
||||
thread_safe (0.3.6)
|
||||
timecop (0.9.1)
|
||||
tzinfo (1.2.7)
|
||||
thread_safe (~> 0.1)
|
||||
warden (1.2.7)
|
||||
rack (>= 1.0)
|
||||
webrat (0.7.3)
|
||||
nokogiri (>= 1.2.0)
|
||||
rack (>= 1.0)
|
||||
rack-test (>= 0.5.3)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
activerecord-jdbc-adapter
|
||||
activerecord-jdbcsqlite3-adapter
|
||||
devise!
|
||||
jruby-openssl
|
||||
mocha (~> 1.1)
|
||||
mongoid (~> 4.0)
|
||||
nokogiri (= 1.9.1)
|
||||
omniauth
|
||||
omniauth-facebook
|
||||
omniauth-oauth2
|
||||
omniauth-openid
|
||||
rails!
|
||||
rdoc (~> 5.1)
|
||||
sqlite3 (~> 1.3.6)
|
||||
test_after_commit
|
||||
timecop
|
||||
webrat (= 0.7.3)
|
||||
|
||||
BUNDLED WITH
|
||||
1.17.3
|
||||
@@ -1,33 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
source "https://rubygems.org"
|
||||
|
||||
gemspec path: ".."
|
||||
|
||||
gem "rails", '~> 5.0.0'
|
||||
gem "omniauth"
|
||||
gem "omniauth-oauth2"
|
||||
gem "rdoc"
|
||||
|
||||
gem "activemodel-serializers-xml", github: "rails/activemodel-serializers-xml"
|
||||
|
||||
gem "rails-controller-testing"
|
||||
|
||||
gem "responders", "~> 2.1"
|
||||
|
||||
group :test do
|
||||
gem "omniauth-facebook"
|
||||
gem "omniauth-openid"
|
||||
gem "timecop"
|
||||
gem "webrat", "0.7.3", require: false
|
||||
gem "mocha", "~> 1.1", require: false
|
||||
end
|
||||
|
||||
platforms :ruby do
|
||||
gem "sqlite3", "~> 1.3.6"
|
||||
end
|
||||
|
||||
# TODO:
|
||||
# group :mongoid do
|
||||
# gem "mongoid", "~> 4.0.0"
|
||||
# end
|
||||
@@ -1,190 +0,0 @@
|
||||
GIT
|
||||
remote: https://github.com/rails/activemodel-serializers-xml.git
|
||||
revision: 93689638c28525acc65afb638fce866826532641
|
||||
specs:
|
||||
activemodel-serializers-xml (1.0.2)
|
||||
activemodel (>= 5.0.0.a)
|
||||
activesupport (>= 5.0.0.a)
|
||||
builder (~> 3.1)
|
||||
|
||||
PATH
|
||||
remote: ..
|
||||
specs:
|
||||
devise (4.7.2)
|
||||
bcrypt (~> 3.0)
|
||||
orm_adapter (~> 0.1)
|
||||
railties (>= 4.1.0)
|
||||
responders
|
||||
warden (~> 1.2.3)
|
||||
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
actioncable (5.0.7.2)
|
||||
actionpack (= 5.0.7.2)
|
||||
nio4r (>= 1.2, < 3.0)
|
||||
websocket-driver (~> 0.6.1)
|
||||
actionmailer (5.0.7.2)
|
||||
actionpack (= 5.0.7.2)
|
||||
actionview (= 5.0.7.2)
|
||||
activejob (= 5.0.7.2)
|
||||
mail (~> 2.5, >= 2.5.4)
|
||||
rails-dom-testing (~> 2.0)
|
||||
actionpack (5.0.7.2)
|
||||
actionview (= 5.0.7.2)
|
||||
activesupport (= 5.0.7.2)
|
||||
rack (~> 2.0)
|
||||
rack-test (~> 0.6.3)
|
||||
rails-dom-testing (~> 2.0)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
||||
actionview (5.0.7.2)
|
||||
activesupport (= 5.0.7.2)
|
||||
builder (~> 3.1)
|
||||
erubis (~> 2.7.0)
|
||||
rails-dom-testing (~> 2.0)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
||||
activejob (5.0.7.2)
|
||||
activesupport (= 5.0.7.2)
|
||||
globalid (>= 0.3.6)
|
||||
activemodel (5.0.7.2)
|
||||
activesupport (= 5.0.7.2)
|
||||
activerecord (5.0.7.2)
|
||||
activemodel (= 5.0.7.2)
|
||||
activesupport (= 5.0.7.2)
|
||||
arel (~> 7.0)
|
||||
activesupport (5.0.7.2)
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
i18n (>= 0.7, < 2)
|
||||
minitest (~> 5.1)
|
||||
tzinfo (~> 1.1)
|
||||
arel (7.1.4)
|
||||
bcrypt (3.1.13)
|
||||
builder (3.2.4)
|
||||
concurrent-ruby (1.1.6)
|
||||
crass (1.0.6)
|
||||
erubis (2.7.0)
|
||||
faraday (1.0.1)
|
||||
multipart-post (>= 1.2, < 3)
|
||||
globalid (0.4.2)
|
||||
activesupport (>= 4.2.0)
|
||||
hashie (4.1.0)
|
||||
i18n (1.8.3)
|
||||
concurrent-ruby (~> 1.0)
|
||||
jwt (2.2.1)
|
||||
loofah (2.5.0)
|
||||
crass (~> 1.0.2)
|
||||
nokogiri (>= 1.5.9)
|
||||
mail (2.7.1)
|
||||
mini_mime (>= 0.1.1)
|
||||
method_source (1.0.0)
|
||||
mini_mime (1.0.2)
|
||||
mini_portile2 (2.4.0)
|
||||
minitest (5.14.1)
|
||||
mocha (1.11.2)
|
||||
multi_json (1.14.1)
|
||||
multi_xml (0.6.0)
|
||||
multipart-post (2.1.1)
|
||||
nio4r (2.5.2)
|
||||
nokogiri (1.10.9)
|
||||
mini_portile2 (~> 2.4.0)
|
||||
oauth2 (1.4.4)
|
||||
faraday (>= 0.8, < 2.0)
|
||||
jwt (>= 1.0, < 3.0)
|
||||
multi_json (~> 1.3)
|
||||
multi_xml (~> 0.5)
|
||||
rack (>= 1.2, < 3)
|
||||
omniauth (1.9.1)
|
||||
hashie (>= 3.4.6)
|
||||
rack (>= 1.6.2, < 3)
|
||||
omniauth-facebook (6.0.0)
|
||||
omniauth-oauth2 (~> 1.2)
|
||||
omniauth-oauth2 (1.6.0)
|
||||
oauth2 (~> 1.1)
|
||||
omniauth (~> 1.9)
|
||||
omniauth-openid (1.0.1)
|
||||
omniauth (~> 1.0)
|
||||
rack-openid (~> 1.3.1)
|
||||
orm_adapter (0.5.0)
|
||||
rack (2.2.2)
|
||||
rack-openid (1.3.1)
|
||||
rack (>= 1.1.0)
|
||||
ruby-openid (>= 2.1.8)
|
||||
rack-test (0.6.3)
|
||||
rack (>= 1.0)
|
||||
rails (5.0.7.2)
|
||||
actioncable (= 5.0.7.2)
|
||||
actionmailer (= 5.0.7.2)
|
||||
actionpack (= 5.0.7.2)
|
||||
actionview (= 5.0.7.2)
|
||||
activejob (= 5.0.7.2)
|
||||
activemodel (= 5.0.7.2)
|
||||
activerecord (= 5.0.7.2)
|
||||
activesupport (= 5.0.7.2)
|
||||
bundler (>= 1.3.0)
|
||||
railties (= 5.0.7.2)
|
||||
sprockets-rails (>= 2.0.0)
|
||||
rails-controller-testing (1.0.4)
|
||||
actionpack (>= 5.0.1.x)
|
||||
actionview (>= 5.0.1.x)
|
||||
activesupport (>= 5.0.1.x)
|
||||
rails-dom-testing (2.0.3)
|
||||
activesupport (>= 4.2.0)
|
||||
nokogiri (>= 1.6)
|
||||
rails-html-sanitizer (1.3.0)
|
||||
loofah (~> 2.3)
|
||||
railties (5.0.7.2)
|
||||
actionpack (= 5.0.7.2)
|
||||
activesupport (= 5.0.7.2)
|
||||
method_source
|
||||
rake (>= 0.8.7)
|
||||
thor (>= 0.18.1, < 2.0)
|
||||
rake (13.0.1)
|
||||
rdoc (6.2.1)
|
||||
responders (2.4.1)
|
||||
actionpack (>= 4.2.0, < 6.0)
|
||||
railties (>= 4.2.0, < 6.0)
|
||||
ruby-openid (2.9.2)
|
||||
sprockets (4.0.1)
|
||||
concurrent-ruby (~> 1.0)
|
||||
rack (> 1, < 3)
|
||||
sprockets-rails (3.2.1)
|
||||
actionpack (>= 4.0)
|
||||
activesupport (>= 4.0)
|
||||
sprockets (>= 3.0.0)
|
||||
sqlite3 (1.3.13)
|
||||
thor (1.0.1)
|
||||
thread_safe (0.3.6)
|
||||
timecop (0.9.1)
|
||||
tzinfo (1.2.7)
|
||||
thread_safe (~> 0.1)
|
||||
warden (1.2.8)
|
||||
rack (>= 2.0.6)
|
||||
webrat (0.7.3)
|
||||
nokogiri (>= 1.2.0)
|
||||
rack (>= 1.0)
|
||||
rack-test (>= 0.5.3)
|
||||
websocket-driver (0.6.5)
|
||||
websocket-extensions (>= 0.1.0)
|
||||
websocket-extensions (0.1.5)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
activemodel-serializers-xml!
|
||||
devise!
|
||||
mocha (~> 1.1)
|
||||
omniauth
|
||||
omniauth-facebook
|
||||
omniauth-oauth2
|
||||
omniauth-openid
|
||||
rails (~> 5.0.0)
|
||||
rails-controller-testing
|
||||
rdoc
|
||||
responders (~> 2.1)
|
||||
sqlite3 (~> 1.3.6)
|
||||
timecop
|
||||
webrat (= 0.7.3)
|
||||
|
||||
BUNDLED WITH
|
||||
1.17.3
|
||||
@@ -1,190 +0,0 @@
|
||||
GIT
|
||||
remote: https://github.com/rails/activemodel-serializers-xml.git
|
||||
revision: 93689638c28525acc65afb638fce866826532641
|
||||
specs:
|
||||
activemodel-serializers-xml (1.0.2)
|
||||
activemodel (>= 5.0.0.a)
|
||||
activesupport (>= 5.0.0.a)
|
||||
builder (~> 3.1)
|
||||
|
||||
PATH
|
||||
remote: ..
|
||||
specs:
|
||||
devise (4.7.2)
|
||||
bcrypt (~> 3.0)
|
||||
orm_adapter (~> 0.1)
|
||||
railties (>= 4.1.0)
|
||||
responders
|
||||
warden (~> 1.2.3)
|
||||
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
actioncable (5.1.7)
|
||||
actionpack (= 5.1.7)
|
||||
nio4r (~> 2.0)
|
||||
websocket-driver (~> 0.6.1)
|
||||
actionmailer (5.1.7)
|
||||
actionpack (= 5.1.7)
|
||||
actionview (= 5.1.7)
|
||||
activejob (= 5.1.7)
|
||||
mail (~> 2.5, >= 2.5.4)
|
||||
rails-dom-testing (~> 2.0)
|
||||
actionpack (5.1.7)
|
||||
actionview (= 5.1.7)
|
||||
activesupport (= 5.1.7)
|
||||
rack (~> 2.0)
|
||||
rack-test (>= 0.6.3)
|
||||
rails-dom-testing (~> 2.0)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
||||
actionview (5.1.7)
|
||||
activesupport (= 5.1.7)
|
||||
builder (~> 3.1)
|
||||
erubi (~> 1.4)
|
||||
rails-dom-testing (~> 2.0)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
||||
activejob (5.1.7)
|
||||
activesupport (= 5.1.7)
|
||||
globalid (>= 0.3.6)
|
||||
activemodel (5.1.7)
|
||||
activesupport (= 5.1.7)
|
||||
activerecord (5.1.7)
|
||||
activemodel (= 5.1.7)
|
||||
activesupport (= 5.1.7)
|
||||
arel (~> 8.0)
|
||||
activesupport (5.1.7)
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
i18n (>= 0.7, < 2)
|
||||
minitest (~> 5.1)
|
||||
tzinfo (~> 1.1)
|
||||
arel (8.0.0)
|
||||
bcrypt (3.1.13)
|
||||
builder (3.2.4)
|
||||
concurrent-ruby (1.1.6)
|
||||
crass (1.0.6)
|
||||
erubi (1.9.0)
|
||||
faraday (1.0.1)
|
||||
multipart-post (>= 1.2, < 3)
|
||||
globalid (0.4.2)
|
||||
activesupport (>= 4.2.0)
|
||||
hashie (4.1.0)
|
||||
i18n (1.8.3)
|
||||
concurrent-ruby (~> 1.0)
|
||||
jwt (2.2.1)
|
||||
loofah (2.5.0)
|
||||
crass (~> 1.0.2)
|
||||
nokogiri (>= 1.5.9)
|
||||
mail (2.7.1)
|
||||
mini_mime (>= 0.1.1)
|
||||
method_source (1.0.0)
|
||||
mini_mime (1.0.2)
|
||||
mini_portile2 (2.4.0)
|
||||
minitest (5.14.1)
|
||||
mocha (1.11.2)
|
||||
multi_json (1.14.1)
|
||||
multi_xml (0.6.0)
|
||||
multipart-post (2.1.1)
|
||||
nio4r (2.5.2)
|
||||
nokogiri (1.10.9)
|
||||
mini_portile2 (~> 2.4.0)
|
||||
oauth2 (1.4.4)
|
||||
faraday (>= 0.8, < 2.0)
|
||||
jwt (>= 1.0, < 3.0)
|
||||
multi_json (~> 1.3)
|
||||
multi_xml (~> 0.5)
|
||||
rack (>= 1.2, < 3)
|
||||
omniauth (1.9.1)
|
||||
hashie (>= 3.4.6)
|
||||
rack (>= 1.6.2, < 3)
|
||||
omniauth-facebook (6.0.0)
|
||||
omniauth-oauth2 (~> 1.2)
|
||||
omniauth-oauth2 (1.6.0)
|
||||
oauth2 (~> 1.1)
|
||||
omniauth (~> 1.9)
|
||||
omniauth-openid (1.0.1)
|
||||
omniauth (~> 1.0)
|
||||
rack-openid (~> 1.3.1)
|
||||
orm_adapter (0.5.0)
|
||||
rack (2.2.2)
|
||||
rack-openid (1.3.1)
|
||||
rack (>= 1.1.0)
|
||||
ruby-openid (>= 2.1.8)
|
||||
rack-test (1.1.0)
|
||||
rack (>= 1.0, < 3)
|
||||
rails (5.1.7)
|
||||
actioncable (= 5.1.7)
|
||||
actionmailer (= 5.1.7)
|
||||
actionpack (= 5.1.7)
|
||||
actionview (= 5.1.7)
|
||||
activejob (= 5.1.7)
|
||||
activemodel (= 5.1.7)
|
||||
activerecord (= 5.1.7)
|
||||
activesupport (= 5.1.7)
|
||||
bundler (>= 1.3.0)
|
||||
railties (= 5.1.7)
|
||||
sprockets-rails (>= 2.0.0)
|
||||
rails-controller-testing (1.0.4)
|
||||
actionpack (>= 5.0.1.x)
|
||||
actionview (>= 5.0.1.x)
|
||||
activesupport (>= 5.0.1.x)
|
||||
rails-dom-testing (2.0.3)
|
||||
activesupport (>= 4.2.0)
|
||||
nokogiri (>= 1.6)
|
||||
rails-html-sanitizer (1.3.0)
|
||||
loofah (~> 2.3)
|
||||
railties (5.1.7)
|
||||
actionpack (= 5.1.7)
|
||||
activesupport (= 5.1.7)
|
||||
method_source
|
||||
rake (>= 0.8.7)
|
||||
thor (>= 0.18.1, < 2.0)
|
||||
rake (13.0.1)
|
||||
rdoc (6.2.1)
|
||||
responders (2.4.1)
|
||||
actionpack (>= 4.2.0, < 6.0)
|
||||
railties (>= 4.2.0, < 6.0)
|
||||
ruby-openid (2.9.2)
|
||||
sprockets (4.0.1)
|
||||
concurrent-ruby (~> 1.0)
|
||||
rack (> 1, < 3)
|
||||
sprockets-rails (3.2.1)
|
||||
actionpack (>= 4.0)
|
||||
activesupport (>= 4.0)
|
||||
sprockets (>= 3.0.0)
|
||||
sqlite3 (1.3.13)
|
||||
thor (1.0.1)
|
||||
thread_safe (0.3.6)
|
||||
timecop (0.9.1)
|
||||
tzinfo (1.2.7)
|
||||
thread_safe (~> 0.1)
|
||||
warden (1.2.8)
|
||||
rack (>= 2.0.6)
|
||||
webrat (0.7.3)
|
||||
nokogiri (>= 1.2.0)
|
||||
rack (>= 1.0)
|
||||
rack-test (>= 0.5.3)
|
||||
websocket-driver (0.6.5)
|
||||
websocket-extensions (>= 0.1.0)
|
||||
websocket-extensions (0.1.5)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
activemodel-serializers-xml!
|
||||
devise!
|
||||
mocha (~> 1.1)
|
||||
omniauth
|
||||
omniauth-facebook
|
||||
omniauth-oauth2
|
||||
omniauth-openid
|
||||
rails (~> 5.1.0)
|
||||
rails-controller-testing
|
||||
rdoc
|
||||
responders (~> 2.1)
|
||||
sqlite3 (~> 1.3.6)
|
||||
timecop
|
||||
webrat (= 0.7.3)
|
||||
|
||||
BUNDLED WITH
|
||||
1.17.3
|
||||
@@ -1,198 +0,0 @@
|
||||
GIT
|
||||
remote: https://github.com/rails/activemodel-serializers-xml.git
|
||||
revision: 93689638c28525acc65afb638fce866826532641
|
||||
specs:
|
||||
activemodel-serializers-xml (1.0.2)
|
||||
activemodel (>= 5.0.0.a)
|
||||
activesupport (>= 5.0.0.a)
|
||||
builder (~> 3.1)
|
||||
|
||||
PATH
|
||||
remote: ..
|
||||
specs:
|
||||
devise (4.7.2)
|
||||
bcrypt (~> 3.0)
|
||||
orm_adapter (~> 0.1)
|
||||
railties (>= 4.1.0)
|
||||
responders
|
||||
warden (~> 1.2.3)
|
||||
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
actioncable (5.2.4.3)
|
||||
actionpack (= 5.2.4.3)
|
||||
nio4r (~> 2.0)
|
||||
websocket-driver (>= 0.6.1)
|
||||
actionmailer (5.2.4.3)
|
||||
actionpack (= 5.2.4.3)
|
||||
actionview (= 5.2.4.3)
|
||||
activejob (= 5.2.4.3)
|
||||
mail (~> 2.5, >= 2.5.4)
|
||||
rails-dom-testing (~> 2.0)
|
||||
actionpack (5.2.4.3)
|
||||
actionview (= 5.2.4.3)
|
||||
activesupport (= 5.2.4.3)
|
||||
rack (~> 2.0, >= 2.0.8)
|
||||
rack-test (>= 0.6.3)
|
||||
rails-dom-testing (~> 2.0)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
||||
actionview (5.2.4.3)
|
||||
activesupport (= 5.2.4.3)
|
||||
builder (~> 3.1)
|
||||
erubi (~> 1.4)
|
||||
rails-dom-testing (~> 2.0)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
||||
activejob (5.2.4.3)
|
||||
activesupport (= 5.2.4.3)
|
||||
globalid (>= 0.3.6)
|
||||
activemodel (5.2.4.3)
|
||||
activesupport (= 5.2.4.3)
|
||||
activerecord (5.2.4.3)
|
||||
activemodel (= 5.2.4.3)
|
||||
activesupport (= 5.2.4.3)
|
||||
arel (>= 9.0)
|
||||
activestorage (5.2.4.3)
|
||||
actionpack (= 5.2.4.3)
|
||||
activerecord (= 5.2.4.3)
|
||||
marcel (~> 0.3.1)
|
||||
activesupport (5.2.4.3)
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
i18n (>= 0.7, < 2)
|
||||
minitest (~> 5.1)
|
||||
tzinfo (~> 1.1)
|
||||
arel (9.0.0)
|
||||
bcrypt (3.1.13)
|
||||
builder (3.2.4)
|
||||
concurrent-ruby (1.1.6)
|
||||
crass (1.0.6)
|
||||
erubi (1.9.0)
|
||||
faraday (1.0.1)
|
||||
multipart-post (>= 1.2, < 3)
|
||||
globalid (0.4.2)
|
||||
activesupport (>= 4.2.0)
|
||||
hashie (4.1.0)
|
||||
i18n (1.8.3)
|
||||
concurrent-ruby (~> 1.0)
|
||||
jwt (2.2.1)
|
||||
loofah (2.5.0)
|
||||
crass (~> 1.0.2)
|
||||
nokogiri (>= 1.5.9)
|
||||
mail (2.7.1)
|
||||
mini_mime (>= 0.1.1)
|
||||
marcel (0.3.3)
|
||||
mimemagic (~> 0.3.2)
|
||||
method_source (1.0.0)
|
||||
mimemagic (0.3.5)
|
||||
mini_mime (1.0.2)
|
||||
mini_portile2 (2.4.0)
|
||||
minitest (5.14.1)
|
||||
mocha (1.11.2)
|
||||
multi_json (1.14.1)
|
||||
multi_xml (0.6.0)
|
||||
multipart-post (2.1.1)
|
||||
nio4r (2.5.2)
|
||||
nokogiri (1.10.9)
|
||||
mini_portile2 (~> 2.4.0)
|
||||
oauth2 (1.4.4)
|
||||
faraday (>= 0.8, < 2.0)
|
||||
jwt (>= 1.0, < 3.0)
|
||||
multi_json (~> 1.3)
|
||||
multi_xml (~> 0.5)
|
||||
rack (>= 1.2, < 3)
|
||||
omniauth (1.9.1)
|
||||
hashie (>= 3.4.6)
|
||||
rack (>= 1.6.2, < 3)
|
||||
omniauth-facebook (6.0.0)
|
||||
omniauth-oauth2 (~> 1.2)
|
||||
omniauth-oauth2 (1.6.0)
|
||||
oauth2 (~> 1.1)
|
||||
omniauth (~> 1.9)
|
||||
omniauth-openid (1.0.1)
|
||||
omniauth (~> 1.0)
|
||||
rack-openid (~> 1.3.1)
|
||||
orm_adapter (0.5.0)
|
||||
rack (2.2.2)
|
||||
rack-openid (1.3.1)
|
||||
rack (>= 1.1.0)
|
||||
ruby-openid (>= 2.1.8)
|
||||
rack-test (1.1.0)
|
||||
rack (>= 1.0, < 3)
|
||||
rails (5.2.4.3)
|
||||
actioncable (= 5.2.4.3)
|
||||
actionmailer (= 5.2.4.3)
|
||||
actionpack (= 5.2.4.3)
|
||||
actionview (= 5.2.4.3)
|
||||
activejob (= 5.2.4.3)
|
||||
activemodel (= 5.2.4.3)
|
||||
activerecord (= 5.2.4.3)
|
||||
activestorage (= 5.2.4.3)
|
||||
activesupport (= 5.2.4.3)
|
||||
bundler (>= 1.3.0)
|
||||
railties (= 5.2.4.3)
|
||||
sprockets-rails (>= 2.0.0)
|
||||
rails-controller-testing (1.0.4)
|
||||
actionpack (>= 5.0.1.x)
|
||||
actionview (>= 5.0.1.x)
|
||||
activesupport (>= 5.0.1.x)
|
||||
rails-dom-testing (2.0.3)
|
||||
activesupport (>= 4.2.0)
|
||||
nokogiri (>= 1.6)
|
||||
rails-html-sanitizer (1.3.0)
|
||||
loofah (~> 2.3)
|
||||
railties (5.2.4.3)
|
||||
actionpack (= 5.2.4.3)
|
||||
activesupport (= 5.2.4.3)
|
||||
method_source
|
||||
rake (>= 0.8.7)
|
||||
thor (>= 0.19.0, < 2.0)
|
||||
rake (13.0.1)
|
||||
rdoc (6.2.1)
|
||||
responders (2.4.1)
|
||||
actionpack (>= 4.2.0, < 6.0)
|
||||
railties (>= 4.2.0, < 6.0)
|
||||
ruby-openid (2.9.2)
|
||||
sprockets (4.0.1)
|
||||
concurrent-ruby (~> 1.0)
|
||||
rack (> 1, < 3)
|
||||
sprockets-rails (3.2.1)
|
||||
actionpack (>= 4.0)
|
||||
activesupport (>= 4.0)
|
||||
sprockets (>= 3.0.0)
|
||||
sqlite3 (1.3.13)
|
||||
thor (1.0.1)
|
||||
thread_safe (0.3.6)
|
||||
timecop (0.9.1)
|
||||
tzinfo (1.2.7)
|
||||
thread_safe (~> 0.1)
|
||||
warden (1.2.8)
|
||||
rack (>= 2.0.6)
|
||||
webrat (0.7.3)
|
||||
nokogiri (>= 1.2.0)
|
||||
rack (>= 1.0)
|
||||
rack-test (>= 0.5.3)
|
||||
websocket-driver (0.7.2)
|
||||
websocket-extensions (>= 0.1.0)
|
||||
websocket-extensions (0.1.5)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
activemodel-serializers-xml!
|
||||
devise!
|
||||
mocha (~> 1.1)
|
||||
omniauth
|
||||
omniauth-facebook
|
||||
omniauth-oauth2
|
||||
omniauth-openid
|
||||
rails (~> 5.2.0)
|
||||
rails-controller-testing
|
||||
rdoc
|
||||
responders (~> 2.1)
|
||||
sqlite3 (~> 1.3.6)
|
||||
timecop
|
||||
webrat (= 0.7.3)
|
||||
|
||||
BUNDLED WITH
|
||||
1.17.3
|
||||
@@ -1,26 +0,0 @@
|
||||
source "https://rubygems.org"
|
||||
|
||||
gemspec path: ".."
|
||||
|
||||
gem "rails", '~> 6.0.0'
|
||||
gem "omniauth"
|
||||
gem "omniauth-oauth2"
|
||||
gem "rdoc"
|
||||
|
||||
gem "activemodel-serializers-xml", github: "rails/activemodel-serializers-xml"
|
||||
|
||||
gem "rails-controller-testing", github: "rails/rails-controller-testing"
|
||||
|
||||
gem "responders", "~> 3.0"
|
||||
|
||||
group :test do
|
||||
gem "omniauth-facebook"
|
||||
gem "omniauth-openid"
|
||||
gem "timecop"
|
||||
gem "webrat", "0.7.3", require: false
|
||||
gem "mocha", "~> 1.1", require: false
|
||||
end
|
||||
|
||||
platforms :ruby do
|
||||
gem "sqlite3", "~> 1.4"
|
||||
end
|
||||
@@ -1,219 +0,0 @@
|
||||
GIT
|
||||
remote: https://github.com/rails/activemodel-serializers-xml.git
|
||||
revision: 93689638c28525acc65afb638fce866826532641
|
||||
specs:
|
||||
activemodel-serializers-xml (1.0.2)
|
||||
activemodel (>= 5.0.0.a)
|
||||
activesupport (>= 5.0.0.a)
|
||||
builder (~> 3.1)
|
||||
|
||||
GIT
|
||||
remote: https://github.com/rails/rails-controller-testing.git
|
||||
revision: 4b15c86e82ee380f2a7cc009e470368f7520560a
|
||||
specs:
|
||||
rails-controller-testing (1.0.5)
|
||||
actionpack (>= 5.0.1.rc1)
|
||||
actionview (>= 5.0.1.rc1)
|
||||
activesupport (>= 5.0.1.rc1)
|
||||
|
||||
PATH
|
||||
remote: ..
|
||||
specs:
|
||||
devise (4.7.2)
|
||||
bcrypt (~> 3.0)
|
||||
orm_adapter (~> 0.1)
|
||||
railties (>= 4.1.0)
|
||||
responders
|
||||
warden (~> 1.2.3)
|
||||
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
actioncable (6.0.3.2)
|
||||
actionpack (= 6.0.3.2)
|
||||
nio4r (~> 2.0)
|
||||
websocket-driver (>= 0.6.1)
|
||||
actionmailbox (6.0.3.2)
|
||||
actionpack (= 6.0.3.2)
|
||||
activejob (= 6.0.3.2)
|
||||
activerecord (= 6.0.3.2)
|
||||
activestorage (= 6.0.3.2)
|
||||
activesupport (= 6.0.3.2)
|
||||
mail (>= 2.7.1)
|
||||
actionmailer (6.0.3.2)
|
||||
actionpack (= 6.0.3.2)
|
||||
actionview (= 6.0.3.2)
|
||||
activejob (= 6.0.3.2)
|
||||
mail (~> 2.5, >= 2.5.4)
|
||||
rails-dom-testing (~> 2.0)
|
||||
actionpack (6.0.3.2)
|
||||
actionview (= 6.0.3.2)
|
||||
activesupport (= 6.0.3.2)
|
||||
rack (~> 2.0, >= 2.0.8)
|
||||
rack-test (>= 0.6.3)
|
||||
rails-dom-testing (~> 2.0)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
||||
actiontext (6.0.3.2)
|
||||
actionpack (= 6.0.3.2)
|
||||
activerecord (= 6.0.3.2)
|
||||
activestorage (= 6.0.3.2)
|
||||
activesupport (= 6.0.3.2)
|
||||
nokogiri (>= 1.8.5)
|
||||
actionview (6.0.3.2)
|
||||
activesupport (= 6.0.3.2)
|
||||
builder (~> 3.1)
|
||||
erubi (~> 1.4)
|
||||
rails-dom-testing (~> 2.0)
|
||||
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
||||
activejob (6.0.3.2)
|
||||
activesupport (= 6.0.3.2)
|
||||
globalid (>= 0.3.6)
|
||||
activemodel (6.0.3.2)
|
||||
activesupport (= 6.0.3.2)
|
||||
activerecord (6.0.3.2)
|
||||
activemodel (= 6.0.3.2)
|
||||
activesupport (= 6.0.3.2)
|
||||
activestorage (6.0.3.2)
|
||||
actionpack (= 6.0.3.2)
|
||||
activejob (= 6.0.3.2)
|
||||
activerecord (= 6.0.3.2)
|
||||
marcel (~> 0.3.1)
|
||||
activesupport (6.0.3.2)
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
i18n (>= 0.7, < 2)
|
||||
minitest (~> 5.1)
|
||||
tzinfo (~> 1.1)
|
||||
zeitwerk (~> 2.2, >= 2.2.2)
|
||||
bcrypt (3.1.15)
|
||||
builder (3.2.4)
|
||||
concurrent-ruby (1.1.7)
|
||||
crass (1.0.6)
|
||||
erubi (1.9.0)
|
||||
faraday (1.0.1)
|
||||
multipart-post (>= 1.2, < 3)
|
||||
globalid (0.4.2)
|
||||
activesupport (>= 4.2.0)
|
||||
hashie (4.1.0)
|
||||
i18n (1.8.5)
|
||||
concurrent-ruby (~> 1.0)
|
||||
jwt (2.2.1)
|
||||
loofah (2.6.0)
|
||||
crass (~> 1.0.2)
|
||||
nokogiri (>= 1.5.9)
|
||||
mail (2.7.1)
|
||||
mini_mime (>= 0.1.1)
|
||||
marcel (0.3.3)
|
||||
mimemagic (~> 0.3.2)
|
||||
method_source (1.0.0)
|
||||
mimemagic (0.3.5)
|
||||
mini_mime (1.0.2)
|
||||
mini_portile2 (2.4.0)
|
||||
minitest (5.14.1)
|
||||
mocha (1.11.2)
|
||||
multi_json (1.15.0)
|
||||
multi_xml (0.6.0)
|
||||
multipart-post (2.1.1)
|
||||
nio4r (2.5.2)
|
||||
nokogiri (1.10.10)
|
||||
mini_portile2 (~> 2.4.0)
|
||||
oauth2 (1.4.4)
|
||||
faraday (>= 0.8, < 2.0)
|
||||
jwt (>= 1.0, < 3.0)
|
||||
multi_json (~> 1.3)
|
||||
multi_xml (~> 0.5)
|
||||
rack (>= 1.2, < 3)
|
||||
omniauth (1.9.1)
|
||||
hashie (>= 3.4.6)
|
||||
rack (>= 1.6.2, < 3)
|
||||
omniauth-facebook (6.0.0)
|
||||
omniauth-oauth2 (~> 1.2)
|
||||
omniauth-oauth2 (1.6.0)
|
||||
oauth2 (~> 1.1)
|
||||
omniauth (~> 1.9)
|
||||
omniauth-openid (1.0.1)
|
||||
omniauth (~> 1.0)
|
||||
rack-openid (~> 1.3.1)
|
||||
orm_adapter (0.5.0)
|
||||
rack (2.2.3)
|
||||
rack-openid (1.3.1)
|
||||
rack (>= 1.1.0)
|
||||
ruby-openid (>= 2.1.8)
|
||||
rack-test (1.1.0)
|
||||
rack (>= 1.0, < 3)
|
||||
rails (6.0.3.2)
|
||||
actioncable (= 6.0.3.2)
|
||||
actionmailbox (= 6.0.3.2)
|
||||
actionmailer (= 6.0.3.2)
|
||||
actionpack (= 6.0.3.2)
|
||||
actiontext (= 6.0.3.2)
|
||||
actionview (= 6.0.3.2)
|
||||
activejob (= 6.0.3.2)
|
||||
activemodel (= 6.0.3.2)
|
||||
activerecord (= 6.0.3.2)
|
||||
activestorage (= 6.0.3.2)
|
||||
activesupport (= 6.0.3.2)
|
||||
bundler (>= 1.3.0)
|
||||
railties (= 6.0.3.2)
|
||||
sprockets-rails (>= 2.0.0)
|
||||
rails-dom-testing (2.0.3)
|
||||
activesupport (>= 4.2.0)
|
||||
nokogiri (>= 1.6)
|
||||
rails-html-sanitizer (1.3.0)
|
||||
loofah (~> 2.3)
|
||||
railties (6.0.3.2)
|
||||
actionpack (= 6.0.3.2)
|
||||
activesupport (= 6.0.3.2)
|
||||
method_source
|
||||
rake (>= 0.8.7)
|
||||
thor (>= 0.20.3, < 2.0)
|
||||
rake (13.0.1)
|
||||
rdoc (6.2.1)
|
||||
responders (3.0.1)
|
||||
actionpack (>= 5.0)
|
||||
railties (>= 5.0)
|
||||
ruby-openid (2.9.2)
|
||||
sprockets (4.0.2)
|
||||
concurrent-ruby (~> 1.0)
|
||||
rack (> 1, < 3)
|
||||
sprockets-rails (3.2.1)
|
||||
actionpack (>= 4.0)
|
||||
activesupport (>= 4.0)
|
||||
sprockets (>= 3.0.0)
|
||||
sqlite3 (1.4.2)
|
||||
thor (1.0.1)
|
||||
thread_safe (0.3.6)
|
||||
timecop (0.9.1)
|
||||
tzinfo (1.2.7)
|
||||
thread_safe (~> 0.1)
|
||||
warden (1.2.8)
|
||||
rack (>= 2.0.6)
|
||||
webrat (0.7.3)
|
||||
nokogiri (>= 1.2.0)
|
||||
rack (>= 1.0)
|
||||
rack-test (>= 0.5.3)
|
||||
websocket-driver (0.7.3)
|
||||
websocket-extensions (>= 0.1.0)
|
||||
websocket-extensions (0.1.5)
|
||||
zeitwerk (2.4.0)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
activemodel-serializers-xml!
|
||||
devise!
|
||||
mocha (~> 1.1)
|
||||
omniauth
|
||||
omniauth-facebook
|
||||
omniauth-oauth2
|
||||
omniauth-openid
|
||||
rails (~> 6.0.0)
|
||||
rails-controller-testing!
|
||||
rdoc
|
||||
responders (~> 3.0)
|
||||
sqlite3 (~> 1.4)
|
||||
timecop
|
||||
webrat (= 0.7.3)
|
||||
|
||||
BUNDLED WITH
|
||||
1.17.3
|
||||
@@ -13,16 +13,16 @@ module Devise
|
||||
autoload :Encryptor, 'devise/encryptor'
|
||||
autoload :FailureApp, 'devise/failure_app'
|
||||
autoload :OmniAuth, 'devise/omniauth'
|
||||
autoload :Orm, 'devise/orm'
|
||||
autoload :ParameterFilter, 'devise/parameter_filter'
|
||||
autoload :ParameterSanitizer, 'devise/parameter_sanitizer'
|
||||
autoload :TestHelpers, 'devise/test_helpers'
|
||||
autoload :TimeInflector, 'devise/time_inflector'
|
||||
autoload :TokenGenerator, 'devise/token_generator'
|
||||
autoload :SecretKeyFinder, 'devise/secret_key_finder'
|
||||
|
||||
module Controllers
|
||||
autoload :Helpers, 'devise/controllers/helpers'
|
||||
autoload :Rememberable, 'devise/controllers/rememberable'
|
||||
autoload :Responder, 'devise/controllers/responder'
|
||||
autoload :ScopedViews, 'devise/controllers/scoped_views'
|
||||
autoload :SignInOut, 'devise/controllers/sign_in_out'
|
||||
autoload :StoreLocation, 'devise/controllers/store_location'
|
||||
@@ -59,7 +59,7 @@ module Devise
|
||||
NO_INPUT = []
|
||||
|
||||
# True values used to check params
|
||||
TRUE_VALUES = [true, 1, '1', 't', 'T', 'true', 'TRUE']
|
||||
TRUE_VALUES = [true, 1, '1', 'on', 'ON', 't', 'T', 'true', 'TRUE']
|
||||
|
||||
# Secret key used by the key generator
|
||||
mattr_accessor :secret_key
|
||||
@@ -217,7 +217,16 @@ module Devise
|
||||
|
||||
# Which formats should be treated as navigational.
|
||||
mattr_accessor :navigational_formats
|
||||
@@navigational_formats = ["*/*", :html]
|
||||
@@navigational_formats = ["*/*", :html, :turbo_stream]
|
||||
|
||||
# The default responder used by Devise, used to customize status codes with:
|
||||
#
|
||||
# `config.responder.error_status`
|
||||
# `config.responder.redirect_status`
|
||||
#
|
||||
# Can be replaced by a custom application responder.
|
||||
mattr_accessor :responder
|
||||
@@responder = Devise::Controllers::Responder
|
||||
|
||||
# When set to true, signing out a user signs out all other scopes.
|
||||
mattr_accessor :sign_out_all_scopes
|
||||
@@ -264,8 +273,14 @@ module Devise
|
||||
# PRIVATE CONFIGURATION
|
||||
|
||||
# Store scopes mappings.
|
||||
mattr_reader :mappings
|
||||
@@mappings = {}
|
||||
def self.mappings
|
||||
# Starting from Rails 8.0, routes are lazy-loaded by default in test and development environments.
|
||||
# However, Devise's mappings are built during the routes loading phase.
|
||||
# To ensure it works correctly, we need to load the routes first before accessing @@mappings.
|
||||
Rails.application.try(:reload_routes_unless_loaded)
|
||||
@@mappings
|
||||
end
|
||||
|
||||
# OmniAuth configurations.
|
||||
mattr_reader :omniauth_configs
|
||||
@@ -297,10 +312,6 @@ module Devise
|
||||
mattr_accessor :sign_in_after_change_password
|
||||
@@sign_in_after_change_password = true
|
||||
|
||||
def self.activerecord51? # :nodoc:
|
||||
defined?(ActiveRecord) && ActiveRecord.gem_version >= Gem::Version.new("5.1.x")
|
||||
end
|
||||
|
||||
# Default way to set up Devise. Run rails generate devise_install to create
|
||||
# a fresh initializer with all configuration values.
|
||||
def self.setup
|
||||
@@ -313,12 +324,20 @@ module Devise
|
||||
end
|
||||
|
||||
def get
|
||||
ActiveSupport::Dependencies.constantize(@name)
|
||||
# TODO: Remove AS::Dependencies usage when dropping support to Rails < 7.
|
||||
if ActiveSupport::Dependencies.respond_to?(:constantize)
|
||||
ActiveSupport::Dependencies.constantize(@name)
|
||||
else
|
||||
@name.constantize
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def self.ref(arg)
|
||||
ActiveSupport::Dependencies.reference(arg)
|
||||
# TODO: Remove AS::Dependencies usage when dropping support to Rails < 7.
|
||||
if ActiveSupport::Dependencies.respond_to?(:reference)
|
||||
ActiveSupport::Dependencies.reference(arg)
|
||||
end
|
||||
Getter.new(arg)
|
||||
end
|
||||
|
||||
@@ -426,9 +445,9 @@ module Devise
|
||||
# Devise.setup do |config|
|
||||
# config.allow_unconfirmed_access_for = 2.days
|
||||
#
|
||||
# config.warden do |manager|
|
||||
# config.warden do |warden_config|
|
||||
# # Configure warden to use other strategies, like oauth.
|
||||
# manager.oauth(:twitter)
|
||||
# warden_config.oauth(:twitter)
|
||||
# end
|
||||
# end
|
||||
def self.warden(&block)
|
||||
@@ -498,12 +517,12 @@ module Devise
|
||||
|
||||
# constant-time comparison algorithm to prevent timing attacks
|
||||
def self.secure_compare(a, b)
|
||||
return false if a.blank? || b.blank? || a.bytesize != b.bytesize
|
||||
l = a.unpack "C#{a.bytesize}"
|
||||
return false if a.nil? || b.nil?
|
||||
ActiveSupport::SecurityUtils.secure_compare(a, b)
|
||||
end
|
||||
|
||||
res = 0
|
||||
b.each_byte { |byte| res |= byte ^ l.shift }
|
||||
res == 0
|
||||
def self.deprecator
|
||||
@deprecator ||= ActiveSupport::Deprecation.new("5.0", "Devise")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ module Devise
|
||||
mappings.unshift mappings.delete(favorite.to_sym) if favorite
|
||||
mappings.each do |mapping|
|
||||
opts[:scope] = mapping
|
||||
opts[:locale] = I18n.locale
|
||||
warden.authenticate!(opts) if !devise_controller? || opts.delete(:force)
|
||||
end
|
||||
end
|
||||
@@ -115,6 +116,7 @@ module Devise
|
||||
class_eval <<-METHODS, __FILE__, __LINE__ + 1
|
||||
def authenticate_#{mapping}!(opts = {})
|
||||
opts[:scope] = :#{mapping}
|
||||
opts[:locale] = I18n.locale
|
||||
warden.authenticate!(opts) if !devise_controller? || opts.delete(:force)
|
||||
end
|
||||
|
||||
|
||||
35
lib/devise/controllers/responder.rb
Normal file
35
lib/devise/controllers/responder.rb
Normal file
@@ -0,0 +1,35 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Devise
|
||||
module Controllers
|
||||
# Custom Responder to configure default statuses that only apply to Devise,
|
||||
# and allow to integrate more easily with Hotwire/Turbo.
|
||||
class Responder < ActionController::Responder
|
||||
if respond_to?(:error_status=) && respond_to?(:redirect_status=)
|
||||
self.error_status = :ok
|
||||
self.redirect_status = :found
|
||||
else
|
||||
# TODO: remove this support for older Rails versions, which aren't supported by Turbo
|
||||
# and/or responders. It won't allow configuring a custom response, but it allows Devise
|
||||
# to use these methods and defaults across the implementation more easily.
|
||||
def self.error_status
|
||||
:ok
|
||||
end
|
||||
|
||||
def self.redirect_status
|
||||
:found
|
||||
end
|
||||
|
||||
def self.error_status=(*)
|
||||
warn "[DEVISE] Setting the error status on the Devise responder has no effect with this " \
|
||||
"version of `responders`, please make sure you're using a newer version. Check the changelog for more info."
|
||||
end
|
||||
|
||||
def self.redirect_status=(*)
|
||||
warn "[DEVISE] Setting the redirect status on the Devise responder has no effect with this " \
|
||||
"version of `responders`, please make sure you're using a newer version. Check the changelog for more info."
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -21,7 +21,7 @@ module Devise
|
||||
# to the set_user method in warden.
|
||||
# If you are using a custom warden strategy and the timeoutable module, you have to
|
||||
# set `env["devise.skip_timeout"] = true` in the request to use this method, like we do
|
||||
# in the sessions controller: https://github.com/heartcombo/devise/blob/master/app/controllers/devise/sessions_controller.rb#L7
|
||||
# in the sessions controller: https://github.com/heartcombo/devise/blob/main/app/controllers/devise/sessions_controller.rb#L7
|
||||
#
|
||||
# Examples:
|
||||
#
|
||||
@@ -37,16 +37,7 @@ module Devise
|
||||
|
||||
expire_data_after_sign_in!
|
||||
|
||||
if options[:bypass]
|
||||
ActiveSupport::Deprecation.warn(<<-DEPRECATION.strip_heredoc, caller)
|
||||
[Devise] bypass option is deprecated and it will be removed in future version of Devise.
|
||||
Please use bypass_sign_in method instead.
|
||||
Example:
|
||||
|
||||
bypass_sign_in(user)
|
||||
DEPRECATION
|
||||
warden.session_serializer.store(resource, scope)
|
||||
elsif warden.user(scope) == resource && !options.delete(:force)
|
||||
if warden.user(scope) == resource && !options.delete(:force)
|
||||
# Do nothing. User already signed in and we are not forcing it.
|
||||
true
|
||||
else
|
||||
@@ -106,10 +97,6 @@ module Devise
|
||||
private
|
||||
|
||||
def expire_data_after_sign_in!
|
||||
# session.keys will return an empty array if the session is not yet loaded.
|
||||
# This is a bug in both Rack and Rails.
|
||||
# A call to #empty? forces the session to be loaded.
|
||||
session.empty?
|
||||
session.keys.grep(/^devise\./).each { |k| session.delete(k) }
|
||||
end
|
||||
|
||||
|
||||
@@ -18,6 +18,11 @@ module Devise
|
||||
|
||||
delegate :flash, to: :request
|
||||
|
||||
include AbstractController::Callbacks
|
||||
around_action do |failure_app, action|
|
||||
I18n.with_locale(failure_app.i18n_locale, &action)
|
||||
end
|
||||
|
||||
def self.call(env)
|
||||
@respond ||= action(:respond)
|
||||
@respond.call(env)
|
||||
@@ -71,7 +76,11 @@ module Devise
|
||||
end
|
||||
|
||||
flash.now[:alert] = i18n_message(:invalid) if is_flashing_format?
|
||||
self.response = recall_app(warden_options[:recall]).call(request.env)
|
||||
self.response = recall_app(warden_options[:recall]).call(request.env).tap { |response|
|
||||
status = response[0].in?(300..399) ? Devise.responder.redirect_status : Devise.responder.error_status
|
||||
# Avoid warnings translating status to code using Rails if available (e.g. `unprocessable_entity` => `unprocessable_content`)
|
||||
response[0] = ActionDispatch::Response.try(:rack_status_code, status) || Rack::Utils.status_code(status)
|
||||
}
|
||||
end
|
||||
|
||||
def redirect
|
||||
@@ -102,16 +111,25 @@ module Devise
|
||||
options[:scope] = "devise.failure"
|
||||
options[:default] = [message]
|
||||
auth_keys = scope_class.authentication_keys
|
||||
keys = (auth_keys.respond_to?(:keys) ? auth_keys.keys : auth_keys).map { |key| scope_class.human_attribute_name(key) }
|
||||
options[:authentication_keys] = keys.join(I18n.translate(:"support.array.words_connector"))
|
||||
human_keys = (auth_keys.respond_to?(:keys) ? auth_keys.keys : auth_keys).map { |key|
|
||||
scope_class.human_attribute_name(key).downcase
|
||||
}
|
||||
options[:authentication_keys] = human_keys.join(I18n.t(:"support.array.words_connector"))
|
||||
options = i18n_options(options)
|
||||
|
||||
I18n.t(:"#{scope}.#{message}", **options)
|
||||
I18n.t(:"#{scope}.#{message}", **options).then { |msg|
|
||||
# Ensure that auth keys at the start of the translated string are properly cased.
|
||||
msg.start_with?(human_keys.first) ? msg.upcase_first : msg
|
||||
}
|
||||
else
|
||||
message.to_s
|
||||
end
|
||||
end
|
||||
|
||||
def i18n_locale
|
||||
warden_options[:locale]
|
||||
end
|
||||
|
||||
def redirect_url
|
||||
if warden_message == :timeout
|
||||
flash[:timedout] = true if is_flashing_format?
|
||||
@@ -136,7 +154,7 @@ module Devise
|
||||
opts = {}
|
||||
|
||||
# Initialize script_name with nil to prevent infinite loops in
|
||||
# authenticated mounted engines in rails 4.2 and 5.0
|
||||
# authenticated mounted engines
|
||||
opts[:script_name] = nil
|
||||
|
||||
route = route(scope)
|
||||
@@ -148,13 +166,6 @@ module Devise
|
||||
|
||||
if relative_url_root?
|
||||
opts[:script_name] = relative_url_root
|
||||
|
||||
# We need to add the rootpath to `script_name` manually for applications that use a Rails
|
||||
# version lower than 5.1. Otherwise, it is going to generate a wrong path for Engines
|
||||
# that use Devise. Remove it when the support of Rails 5.0 is dropped.
|
||||
elsif root_path_defined?(context) && !rails_51_and_up?
|
||||
rootpath = context.routes.url_helpers.root_path
|
||||
opts[:script_name] = rootpath.chomp('/') if rootpath.length > 1
|
||||
end
|
||||
|
||||
if context.respond_to?(route)
|
||||
@@ -167,7 +178,7 @@ module Devise
|
||||
end
|
||||
|
||||
def skip_format?
|
||||
%w(html */*).include? request_format.to_s
|
||||
%w(html */* turbo_stream).include? request_format.to_s
|
||||
end
|
||||
|
||||
# Choose whether we should respond in an HTTP authentication fashion,
|
||||
@@ -270,15 +281,5 @@ module Devise
|
||||
end
|
||||
|
||||
ActiveSupport.run_load_hooks(:devise_failure_app, self)
|
||||
|
||||
private
|
||||
|
||||
def root_path_defined?(context)
|
||||
defined?(context.routes) && context.routes.url_helpers.respond_to?(:root_path)
|
||||
end
|
||||
|
||||
def rails_51_and_up?
|
||||
Rails.gem_version >= Gem::Version.new("5.1")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -7,6 +7,6 @@ Warden::Manager.after_set_user do |record, warden, options|
|
||||
if record && record.respond_to?(:active_for_authentication?) && !record.active_for_authentication?
|
||||
scope = options[:scope]
|
||||
warden.logout(scope)
|
||||
throw :warden, scope: scope, message: record.inactive_message
|
||||
throw :warden, scope: scope, message: record.inactive_message, locale: options.fetch(:locale, I18n.locale)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -4,6 +4,11 @@ Warden::Manager.after_authentication do |record, warden, options|
|
||||
clean_up_for_winning_strategy = !warden.winning_strategy.respond_to?(:clean_up_csrf?) ||
|
||||
warden.winning_strategy.clean_up_csrf?
|
||||
if Devise.clean_up_csrf_token_on_authentication && clean_up_for_winning_strategy
|
||||
warden.request.session.try(:delete, :_csrf_token)
|
||||
if warden.request.respond_to?(:reset_csrf_token)
|
||||
# Rails 7.1+
|
||||
warden.request.reset_csrf_token
|
||||
else
|
||||
warden.request.session.try(:delete, :_csrf_token)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,10 +3,7 @@
|
||||
# After each sign in, if resource responds to failed_attempts, sets it to 0
|
||||
# This is only triggered when the user is explicitly set (with set_user)
|
||||
Warden::Manager.after_set_user except: :fetch do |record, warden, options|
|
||||
if record.respond_to?(:failed_attempts) && warden.authenticated?(options[:scope])
|
||||
unless record.failed_attempts.to_i.zero?
|
||||
record.failed_attempts = 0
|
||||
record.save(validate: false)
|
||||
end
|
||||
if record.respond_to?(:reset_failed_attempts!) && warden.authenticated?(options[:scope])
|
||||
record.reset_failed_attempts!
|
||||
end
|
||||
end
|
||||
|
||||
@@ -25,7 +25,7 @@ Warden::Manager.after_set_user do |record, warden, options|
|
||||
record.timedout?(last_request_at) &&
|
||||
!proxy.remember_me_is_active?(record)
|
||||
Devise.sign_out_all_scopes ? proxy.sign_out : proxy.sign_out(scope)
|
||||
throw :warden, scope: scope, message: :timeout
|
||||
throw :warden, scope: scope, message: :timeout, locale: options.fetch(:locale, I18n.locale)
|
||||
end
|
||||
|
||||
unless env['devise.skip_trackable']
|
||||
|
||||
@@ -33,28 +33,22 @@ module Devise
|
||||
subject: subject_for(action),
|
||||
to: resource.email,
|
||||
from: mailer_sender(devise_mapping),
|
||||
reply_to: mailer_reply_to(devise_mapping),
|
||||
reply_to: mailer_sender(devise_mapping),
|
||||
template_path: template_paths,
|
||||
template_name: action
|
||||
}.merge(opts)
|
||||
}
|
||||
# Give priority to the mailer's default if they exists.
|
||||
headers.delete(:from) if default_params[:from]
|
||||
headers.delete(:reply_to) if default_params[:reply_to]
|
||||
|
||||
headers.merge!(opts)
|
||||
|
||||
@email = headers[:to]
|
||||
headers
|
||||
end
|
||||
|
||||
def mailer_reply_to(mapping)
|
||||
mailer_sender(mapping, :reply_to)
|
||||
end
|
||||
|
||||
def mailer_from(mapping)
|
||||
mailer_sender(mapping, :from)
|
||||
end
|
||||
|
||||
def mailer_sender(mapping, sender = :from)
|
||||
default_sender = default_params[sender]
|
||||
if default_sender.present?
|
||||
default_sender.respond_to?(:to_proc) ? instance_eval(&default_sender) : default_sender
|
||||
elsif Devise.mailer_sender.is_a?(Proc)
|
||||
def mailer_sender(mapping)
|
||||
if Devise.mailer_sender.is_a?(Proc)
|
||||
Devise.mailer_sender.call(mapping.name)
|
||||
else
|
||||
Devise.mailer_sender
|
||||
|
||||
@@ -30,7 +30,7 @@ module Devise
|
||||
|
||||
alias :name :singular
|
||||
|
||||
# Receives an object and find a scope for it. If a scope cannot be found,
|
||||
# Receives an object and finds a scope for it. If a scope cannot be found,
|
||||
# raises an error. If a symbol is given, it's considered to be the scope.
|
||||
def self.find_scope!(obj)
|
||||
obj = obj.devise_scope if obj.respond_to?(:devise_scope)
|
||||
|
||||
@@ -84,6 +84,7 @@ module Devise
|
||||
end
|
||||
|
||||
devise_modules_hook! do
|
||||
include Devise::Orm
|
||||
include Devise::Models::Authenticatable
|
||||
|
||||
selected_modules.each do |m|
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
require 'devise/hooks/activatable'
|
||||
require 'devise/hooks/csrf_cleaner'
|
||||
require 'devise/rails/deprecated_constant_accessor'
|
||||
|
||||
module Devise
|
||||
module Models
|
||||
@@ -10,7 +9,7 @@ module Devise
|
||||
#
|
||||
# == Options
|
||||
#
|
||||
# Authenticatable adds the following options to devise_for:
|
||||
# Authenticatable adds the following options to +devise+:
|
||||
#
|
||||
# * +authentication_keys+: parameters used for authentication. By default [:email].
|
||||
#
|
||||
@@ -61,9 +60,6 @@ module Devise
|
||||
:last_sign_in_ip, :password_salt, :confirmation_token, :confirmed_at, :confirmation_sent_at,
|
||||
:remember_token, :unconfirmed_email, :failed_attempts, :unlock_token, :locked_at]
|
||||
|
||||
include Devise::DeprecatedConstantAccessor
|
||||
deprecate_constant "BLACKLIST_FOR_SERIALIZATION", "Devise::Models::Authenticatable::UNSAFE_ATTRIBUTES_FOR_SERIALIZATION"
|
||||
|
||||
included do
|
||||
class_attribute :devise_modules, instance_writer: false
|
||||
self.devise_modules ||= []
|
||||
@@ -187,11 +183,8 @@ module Devise
|
||||
# # Deliver later with Active Job's `deliver_later`
|
||||
# if message.respond_to?(:deliver_later)
|
||||
# message.deliver_later
|
||||
# # Remove once we move to Rails 4.2+ only, as `deliver` is deprecated.
|
||||
# elsif message.respond_to?(:deliver_now)
|
||||
# message.deliver_now
|
||||
# else
|
||||
# message.deliver
|
||||
# message.deliver_now
|
||||
# end
|
||||
# end
|
||||
#
|
||||
@@ -199,12 +192,7 @@ module Devise
|
||||
#
|
||||
def send_devise_notification(notification, *args)
|
||||
message = devise_mailer.send(notification, self, *args)
|
||||
# Remove once we move to Rails 4.2+ only.
|
||||
if message.respond_to?(:deliver_now)
|
||||
message.deliver_now
|
||||
else
|
||||
message.deliver
|
||||
end
|
||||
message.deliver_now
|
||||
end
|
||||
|
||||
def downcase_keys
|
||||
|
||||
@@ -48,7 +48,7 @@ module Devise
|
||||
included do
|
||||
before_create :generate_confirmation_token, if: :confirmation_required?
|
||||
after_create :skip_reconfirmation_in_callback!, if: :send_confirmation_notification?
|
||||
if defined?(ActiveRecord) && self < ActiveRecord::Base # ActiveRecord
|
||||
if Devise::Orm.active_record?(self) # ActiveRecord
|
||||
after_commit :send_on_create_confirmation_instructions, on: :create, if: :send_confirmation_notification?
|
||||
after_commit :send_reconfirmation_instructions, on: :update, if: :reconfirmation_required?
|
||||
else # Mongoid
|
||||
@@ -258,44 +258,23 @@ module Devise
|
||||
generate_confirmation_token && save(validate: false)
|
||||
end
|
||||
|
||||
if Devise.activerecord51?
|
||||
def postpone_email_change_until_confirmation_and_regenerate_confirmation_token
|
||||
@reconfirmation_required = true
|
||||
self.unconfirmed_email = self.email
|
||||
self.email = self.email_in_database
|
||||
self.confirmation_token = nil
|
||||
generate_confirmation_token
|
||||
end
|
||||
else
|
||||
def postpone_email_change_until_confirmation_and_regenerate_confirmation_token
|
||||
@reconfirmation_required = true
|
||||
self.unconfirmed_email = self.email
|
||||
self.email = self.email_was
|
||||
self.confirmation_token = nil
|
||||
generate_confirmation_token
|
||||
end
|
||||
|
||||
def postpone_email_change_until_confirmation_and_regenerate_confirmation_token
|
||||
@reconfirmation_required = true
|
||||
self.unconfirmed_email = self.email
|
||||
self.email = self.devise_email_in_database
|
||||
self.confirmation_token = nil
|
||||
generate_confirmation_token
|
||||
end
|
||||
|
||||
if Devise.activerecord51?
|
||||
def postpone_email_change?
|
||||
postpone = self.class.reconfirmable &&
|
||||
will_save_change_to_email? &&
|
||||
!@bypass_confirmation_postpone &&
|
||||
self.email.present? &&
|
||||
(!@skip_reconfirmation_in_callback || !self.email_in_database.nil?)
|
||||
@bypass_confirmation_postpone = false
|
||||
postpone
|
||||
end
|
||||
else
|
||||
def postpone_email_change?
|
||||
postpone = self.class.reconfirmable &&
|
||||
email_changed? &&
|
||||
!@bypass_confirmation_postpone &&
|
||||
self.email.present? &&
|
||||
(!@skip_reconfirmation_in_callback || !self.email_was.nil?)
|
||||
@bypass_confirmation_postpone = false
|
||||
postpone
|
||||
end
|
||||
def postpone_email_change?
|
||||
postpone = self.class.reconfirmable &&
|
||||
devise_will_save_change_to_email? &&
|
||||
!@bypass_confirmation_postpone &&
|
||||
self.email.present? &&
|
||||
(!@skip_reconfirmation_in_callback || !self.devise_email_in_database.nil?)
|
||||
@bypass_confirmation_postpone = false
|
||||
postpone
|
||||
end
|
||||
|
||||
def reconfirmation_required?
|
||||
|
||||
@@ -13,7 +13,7 @@ module Devise
|
||||
#
|
||||
# == Options
|
||||
#
|
||||
# DatabaseAuthenticatable adds the following options to devise_for:
|
||||
# DatabaseAuthenticatable adds the following options to +devise+:
|
||||
#
|
||||
# * +pepper+: a random string used to provide a more secure hash. Use
|
||||
# `rails secret` to generate new keys.
|
||||
@@ -42,7 +42,7 @@ module Devise
|
||||
def initialize(*args, &block)
|
||||
@skip_email_changed_notification = false
|
||||
@skip_password_change_notification = false
|
||||
super
|
||||
super
|
||||
end
|
||||
|
||||
# Skips sending the email changed notification after_update
|
||||
@@ -84,16 +84,7 @@ module Devise
|
||||
# users to change relevant information like the e-mail without changing
|
||||
# their password). In case the password field is rejected, the confirmation
|
||||
# is also rejected as long as it is also blank.
|
||||
def update_with_password(params, *options)
|
||||
if options.present?
|
||||
ActiveSupport::Deprecation.warn <<-DEPRECATION.strip_heredoc
|
||||
[Devise] The second argument of `DatabaseAuthenticatable#update_with_password`
|
||||
(`options`) is deprecated and it will be removed in the next major version.
|
||||
It was added to support a feature deprecated in Rails 4, so you can safely remove it
|
||||
from your code.
|
||||
DEPRECATION
|
||||
end
|
||||
|
||||
def update_with_password(params)
|
||||
current_password = params.delete(:current_password)
|
||||
|
||||
if params[:password].blank?
|
||||
@@ -102,9 +93,9 @@ module Devise
|
||||
end
|
||||
|
||||
result = if valid_password?(current_password)
|
||||
update(params, *options)
|
||||
update(params)
|
||||
else
|
||||
assign_attributes(params, *options)
|
||||
assign_attributes(params)
|
||||
valid?
|
||||
errors.add(:current_password, current_password.blank? ? :blank : :invalid)
|
||||
false
|
||||
@@ -121,25 +112,16 @@ module Devise
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# def update_without_password(params, *options)
|
||||
# def update_without_password(params)
|
||||
# params.delete(:email)
|
||||
# super(params)
|
||||
# end
|
||||
#
|
||||
def update_without_password(params, *options)
|
||||
if options.present?
|
||||
ActiveSupport::Deprecation.warn <<-DEPRECATION.strip_heredoc
|
||||
[Devise] The second argument of `DatabaseAuthenticatable#update_without_password`
|
||||
(`options`) is deprecated and it will be removed in the next major version.
|
||||
It was added to support a feature deprecated in Rails 4, so you can safely remove it
|
||||
from your code.
|
||||
DEPRECATION
|
||||
end
|
||||
|
||||
def update_without_password(params)
|
||||
params.delete(:password)
|
||||
params.delete(:password_confirmation)
|
||||
|
||||
result = update(params, *options)
|
||||
result = update(params)
|
||||
clean_up_passwords
|
||||
result
|
||||
end
|
||||
@@ -177,16 +159,9 @@ module Devise
|
||||
encrypted_password[0,29] if encrypted_password
|
||||
end
|
||||
|
||||
if Devise.activerecord51?
|
||||
# Send notification to user when email changes.
|
||||
def send_email_changed_notification
|
||||
send_devise_notification(:email_changed, to: email_before_last_save)
|
||||
end
|
||||
else
|
||||
# Send notification to user when email changes.
|
||||
def send_email_changed_notification
|
||||
send_devise_notification(:email_changed, to: email_was)
|
||||
end
|
||||
# Send notification to user when email changes.
|
||||
def send_email_changed_notification
|
||||
send_devise_notification(:email_changed, to: devise_email_before_last_save)
|
||||
end
|
||||
|
||||
# Send notification to user when password changes.
|
||||
@@ -205,24 +180,12 @@ module Devise
|
||||
Devise::Encryptor.digest(self.class, password)
|
||||
end
|
||||
|
||||
if Devise.activerecord51?
|
||||
def send_email_changed_notification?
|
||||
self.class.send_email_changed_notification && saved_change_to_email? && !@skip_email_changed_notification
|
||||
end
|
||||
else
|
||||
def send_email_changed_notification?
|
||||
self.class.send_email_changed_notification && email_changed? && !@skip_email_changed_notification
|
||||
end
|
||||
def send_email_changed_notification?
|
||||
self.class.send_email_changed_notification && devise_saved_change_to_email? && !@skip_email_changed_notification
|
||||
end
|
||||
|
||||
if Devise.activerecord51?
|
||||
def send_password_change_notification?
|
||||
self.class.send_password_change_notification && saved_change_to_encrypted_password? && !@skip_password_change_notification
|
||||
end
|
||||
else
|
||||
def send_password_change_notification?
|
||||
self.class.send_password_change_notification && encrypted_password_changed? && !@skip_password_change_notification
|
||||
end
|
||||
def send_password_change_notification?
|
||||
self.class.send_password_change_notification && devise_saved_change_to_encrypted_password? && !@skip_password_change_notification
|
||||
end
|
||||
|
||||
module ClassMethods
|
||||
|
||||
@@ -18,7 +18,7 @@ module Devise
|
||||
# * +maximum_attempts+: how many attempts should be accepted before blocking the user.
|
||||
# * +lock_strategy+: lock the user account by :failed_attempts or :none.
|
||||
# * +unlock_strategy+: unlock the user account by :time, :email, :both or :none.
|
||||
# * +unlock_in+: the time you want to lock the user after to lock happens. Only available when unlock_strategy is :time or :both.
|
||||
# * +unlock_in+: the time you want to unlock the user after lock happens. Only available when unlock_strategy is :time or :both.
|
||||
# * +unlock_keys+: the keys you want to use when locking and unlocking an account
|
||||
#
|
||||
module Lockable
|
||||
@@ -57,6 +57,14 @@ module Devise
|
||||
save(validate: false)
|
||||
end
|
||||
|
||||
# Resets failed attempts counter to 0.
|
||||
def reset_failed_attempts!
|
||||
if respond_to?(:failed_attempts) && !failed_attempts.to_i.zero?
|
||||
self.failed_attempts = 0
|
||||
save(validate: false)
|
||||
end
|
||||
end
|
||||
|
||||
# Verifies whether a user is locked or not.
|
||||
def access_locked?
|
||||
!!locked_at && !lock_expired?
|
||||
@@ -76,7 +84,7 @@ module Devise
|
||||
if_access_locked { send_unlock_instructions }
|
||||
end
|
||||
|
||||
# Overwrites active_for_authentication? from Devise::Models::Activatable for locking purposes
|
||||
# Overwrites active_for_authentication? from Devise::Models::Authenticatable for locking purposes
|
||||
# by verifying whether a user is active to sign in or not based on locked?
|
||||
def active_for_authentication?
|
||||
super && !access_locked?
|
||||
@@ -110,7 +118,7 @@ module Devise
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def increment_failed_attempts
|
||||
self.class.increment_counter(:failed_attempts, id)
|
||||
reload
|
||||
|
||||
@@ -8,11 +8,11 @@ module Devise
|
||||
#
|
||||
# == Options
|
||||
#
|
||||
# Oauthable adds the following options to devise_for:
|
||||
# Oauthable adds the following options to +devise+:
|
||||
#
|
||||
# * +omniauth_providers+: Which providers are available to this model. It expects an array:
|
||||
#
|
||||
# devise_for :database_authenticatable, :omniauthable, omniauth_providers: [:twitter]
|
||||
# devise :database_authenticatable, :omniauthable, omniauth_providers: [:twitter]
|
||||
#
|
||||
module Omniauthable
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
@@ -7,7 +7,7 @@ module Devise
|
||||
#
|
||||
# ==Options
|
||||
#
|
||||
# Recoverable adds the following options to devise_for:
|
||||
# Recoverable adds the following options to +devise+:
|
||||
#
|
||||
# * +reset_password_keys+: the keys you want to use when recovering the password for an account
|
||||
# * +reset_password_within+: the time period within which the password must be reset or the token expires.
|
||||
@@ -99,24 +99,13 @@ module Devise
|
||||
send_devise_notification(:reset_password_instructions, token, {})
|
||||
end
|
||||
|
||||
if Devise.activerecord51?
|
||||
def clear_reset_password_token?
|
||||
encrypted_password_changed = respond_to?(:will_save_change_to_encrypted_password?) && will_save_change_to_encrypted_password?
|
||||
authentication_keys_changed = self.class.authentication_keys.any? do |attribute|
|
||||
respond_to?("will_save_change_to_#{attribute}?") && send("will_save_change_to_#{attribute}?")
|
||||
end
|
||||
|
||||
authentication_keys_changed || encrypted_password_changed
|
||||
def clear_reset_password_token?
|
||||
encrypted_password_changed = devise_respond_to_and_will_save_change_to_attribute?(:encrypted_password)
|
||||
authentication_keys_changed = self.class.authentication_keys.any? do |attribute|
|
||||
devise_respond_to_and_will_save_change_to_attribute?(attribute)
|
||||
end
|
||||
else
|
||||
def clear_reset_password_token?
|
||||
encrypted_password_changed = respond_to?(:encrypted_password_changed?) && encrypted_password_changed?
|
||||
authentication_keys_changed = self.class.authentication_keys.any? do |attribute|
|
||||
respond_to?("#{attribute}_changed?") && send("#{attribute}_changed?")
|
||||
end
|
||||
|
||||
authentication_keys_changed || encrypted_password_changed
|
||||
end
|
||||
authentication_keys_changed || encrypted_password_changed
|
||||
end
|
||||
|
||||
module ClassMethods
|
||||
|
||||
@@ -15,7 +15,7 @@ module Devise
|
||||
#
|
||||
# == Options
|
||||
#
|
||||
# Rememberable adds the following options in devise_for:
|
||||
# Rememberable adds the following options to +devise+:
|
||||
#
|
||||
# * +remember_for+: the time you want the user will be remembered without
|
||||
# asking for credentials. After this time the user will be blocked and
|
||||
|
||||
@@ -11,7 +11,7 @@ module Devise
|
||||
#
|
||||
# == Options
|
||||
#
|
||||
# Timeoutable adds the following options to devise_for:
|
||||
# Timeoutable adds the following options to +devise+:
|
||||
#
|
||||
# * +timeout_in+: the interval to timeout the user session without activity.
|
||||
#
|
||||
|
||||
@@ -9,11 +9,13 @@ module Devise
|
||||
#
|
||||
# == Options
|
||||
#
|
||||
# Validatable adds the following options to devise_for:
|
||||
# Validatable adds the following options to +devise+:
|
||||
#
|
||||
# * +email_regexp+: the regular expression used to validate e-mails;
|
||||
# * +password_length+: a range expressing password length. Defaults to 6..128.
|
||||
#
|
||||
# Since +password_length+ is applied in a proc within `validates_length_of` it can be overridden
|
||||
# at runtime.
|
||||
module Validatable
|
||||
# All validations used by this module.
|
||||
VALIDATIONS = [:validates_presence_of, :validates_uniqueness_of, :validates_format_of,
|
||||
@@ -29,17 +31,12 @@ module Devise
|
||||
|
||||
base.class_eval do
|
||||
validates_presence_of :email, if: :email_required?
|
||||
if Devise.activerecord51?
|
||||
validates_uniqueness_of :email, allow_blank: true, case_sensitive: true, if: :will_save_change_to_email?
|
||||
validates_format_of :email, with: email_regexp, allow_blank: true, if: :will_save_change_to_email?
|
||||
else
|
||||
validates_uniqueness_of :email, allow_blank: true, if: :email_changed?
|
||||
validates_format_of :email, with: email_regexp, allow_blank: true, if: :email_changed?
|
||||
end
|
||||
validates_uniqueness_of :email, allow_blank: true, case_sensitive: true, if: :devise_will_save_change_to_email?
|
||||
validates_format_of :email, with: email_regexp, allow_blank: true, if: :devise_will_save_change_to_email?
|
||||
|
||||
validates_presence_of :password, if: :password_required?
|
||||
validates_confirmation_of :password, if: :password_required?
|
||||
validates_length_of :password, within: password_length, allow_blank: true
|
||||
validates_length_of :password, minimum: proc { password_length.min }, maximum: proc { password_length.max }, allow_blank: true
|
||||
end
|
||||
end
|
||||
|
||||
@@ -47,7 +44,7 @@ module Devise
|
||||
unavailable_validations = VALIDATIONS.select { |v| !base.respond_to?(v) }
|
||||
|
||||
unless unavailable_validations.empty?
|
||||
raise "Could not use :validatable module since #{base} does not respond " <<
|
||||
raise "Could not use :validatable module since #{base} does not respond " \
|
||||
"to the following methods: #{unavailable_validations.to_sentence}."
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,17 +1,14 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
begin
|
||||
gem "omniauth", ">= 1.0.0"
|
||||
|
||||
require "omniauth"
|
||||
require "omniauth/version"
|
||||
rescue LoadError
|
||||
warn "Could not load 'omniauth'. Please ensure you have the omniauth gem >= 1.0.0 installed and listed in your Gemfile."
|
||||
raise
|
||||
end
|
||||
|
||||
unless OmniAuth::VERSION =~ /^1\./
|
||||
raise "You are using an old OmniAuth version, please ensure you have 1.0.0.pr2 version or later installed."
|
||||
end
|
||||
|
||||
# Clean up the default path_prefix. It will be automatically set by Devise.
|
||||
OmniAuth.config.path_prefix = nil
|
||||
|
||||
|
||||
69
lib/devise/orm.rb
Normal file
69
lib/devise/orm.rb
Normal file
@@ -0,0 +1,69 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Devise
|
||||
module Orm # :nodoc:
|
||||
def self.active_record?(model)
|
||||
defined?(ActiveRecord) && model < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def self.included(model)
|
||||
if Devise::Orm.active_record?(model)
|
||||
model.include DirtyTrackingActiveRecordMethods
|
||||
else
|
||||
model.include DirtyTrackingMongoidMethods
|
||||
end
|
||||
end
|
||||
|
||||
module DirtyTrackingActiveRecordMethods
|
||||
def devise_email_before_last_save
|
||||
email_before_last_save
|
||||
end
|
||||
|
||||
def devise_email_in_database
|
||||
email_in_database
|
||||
end
|
||||
|
||||
def devise_saved_change_to_email?
|
||||
saved_change_to_email?
|
||||
end
|
||||
|
||||
def devise_saved_change_to_encrypted_password?
|
||||
saved_change_to_encrypted_password?
|
||||
end
|
||||
|
||||
def devise_will_save_change_to_email?
|
||||
will_save_change_to_email?
|
||||
end
|
||||
|
||||
def devise_respond_to_and_will_save_change_to_attribute?(attribute)
|
||||
respond_to?("will_save_change_to_#{attribute}?") && send("will_save_change_to_#{attribute}?")
|
||||
end
|
||||
end
|
||||
|
||||
module DirtyTrackingMongoidMethods
|
||||
def devise_email_before_last_save
|
||||
respond_to?(:email_previously_was) ? email_previously_was : email_was
|
||||
end
|
||||
|
||||
def devise_email_in_database
|
||||
email_was
|
||||
end
|
||||
|
||||
def devise_saved_change_to_email?
|
||||
respond_to?(:email_previously_changed?) ? email_previously_changed? : email_changed?
|
||||
end
|
||||
|
||||
def devise_saved_change_to_encrypted_password?
|
||||
respond_to?(:encrypted_password_previously_changed?) ? encrypted_password_previously_changed? : encrypted_password_changed?
|
||||
end
|
||||
|
||||
def devise_will_save_change_to_email?
|
||||
email_changed?
|
||||
end
|
||||
|
||||
def devise_respond_to_and_will_save_change_to_attribute?(attribute)
|
||||
respond_to?("#{attribute}_changed?") && send("#{attribute}_changed?")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -130,8 +130,7 @@ module Devise
|
||||
#
|
||||
# Returns an +ActiveSupport::HashWithIndifferentAccess+.
|
||||
def cast_to_hash(params)
|
||||
# TODO: Remove the `with_indifferent_access` method call when we only support Rails 5+.
|
||||
params && params.to_h.with_indifferent_access
|
||||
params && params.to_h
|
||||
end
|
||||
|
||||
def default_params
|
||||
|
||||
@@ -17,6 +17,10 @@ module Devise
|
||||
app.reload_routes! if Devise.reload_routes
|
||||
end
|
||||
|
||||
initializer "devise.deprecator" do |app|
|
||||
app.deprecators[:devise] = Devise.deprecator if app.respond_to?(:deprecators)
|
||||
end
|
||||
|
||||
initializer "devise.url_helpers" do
|
||||
Devise.include_helpers(Devise::Controllers)
|
||||
end
|
||||
@@ -34,7 +38,7 @@ module Devise
|
||||
end
|
||||
|
||||
initializer "devise.secret_key" do |app|
|
||||
Devise.secret_key ||= Devise::SecretKeyFinder.new(app).find
|
||||
Devise.secret_key ||= app.secret_key_base
|
||||
|
||||
Devise.token_generator ||=
|
||||
if secret_key = Devise.secret_key
|
||||
@@ -43,5 +47,11 @@ module Devise
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
initializer "devise.configure_zeitwerk" do
|
||||
if Rails.autoloaders.zeitwerk_enabled? && !defined?(ActionMailer)
|
||||
Rails.autoloaders.main.ignore("#{root}/app/mailers/devise/mailer.rb")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
begin
|
||||
require 'active_support/deprecation/constant_accessor'
|
||||
|
||||
module Devise
|
||||
DeprecatedConstantAccessor = ActiveSupport::Deprecation::DeprecatedConstantAccessor #:nodoc:
|
||||
end
|
||||
rescue LoadError
|
||||
|
||||
# Copy of constant deprecation module from Rails / Active Support version 6, so we can use it
|
||||
# with Rails <= 5.0 versions. This can be removed once we support only Rails 5.1 or greater.
|
||||
module Devise
|
||||
module DeprecatedConstantAccessor #:nodoc:
|
||||
def self.included(base)
|
||||
require "active_support/inflector/methods"
|
||||
|
||||
extension = Module.new do
|
||||
def const_missing(missing_const_name)
|
||||
if class_variable_defined?(:@@_deprecated_constants)
|
||||
if (replacement = class_variable_get(:@@_deprecated_constants)[missing_const_name.to_s])
|
||||
replacement[:deprecator].warn(replacement[:message] || "#{name}::#{missing_const_name} is deprecated! Use #{replacement[:new]} instead.", Rails::VERSION::MAJOR == 4 ? caller : caller_locations)
|
||||
return ActiveSupport::Inflector.constantize(replacement[:new].to_s)
|
||||
end
|
||||
end
|
||||
super
|
||||
end
|
||||
|
||||
def deprecate_constant(const_name, new_constant, message: nil, deprecator: ActiveSupport::Deprecation.instance)
|
||||
class_variable_set(:@@_deprecated_constants, {}) unless class_variable_defined?(:@@_deprecated_constants)
|
||||
class_variable_get(:@@_deprecated_constants)[const_name.to_s] = { new: new_constant, message: message, deprecator: deprecator }
|
||||
end
|
||||
end
|
||||
base.singleton_class.prepend extension
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -235,7 +235,6 @@ module ActionDispatch::Routing
|
||||
options[:constraints] = (@scope[:constraints] || {}).merge(options[:constraints] || {})
|
||||
options[:defaults] = (@scope[:defaults] || {}).merge(options[:defaults] || {})
|
||||
options[:options] = @scope[:options] || {}
|
||||
options[:options][:format] = false if options[:format] == false
|
||||
|
||||
resources.map!(&:to_sym)
|
||||
|
||||
@@ -413,7 +412,7 @@ module ActionDispatch::Routing
|
||||
controller: controllers[:registrations]
|
||||
}
|
||||
|
||||
resource :registration, options do
|
||||
resource :registration, **options do
|
||||
get :cancel
|
||||
end
|
||||
end
|
||||
@@ -447,7 +446,7 @@ ERROR
|
||||
match "#{path_prefix}/#{provider}",
|
||||
to: "#{controllers[:omniauth_callbacks]}#passthru",
|
||||
as: "#{provider}_omniauth_authorize",
|
||||
via: [:get, :post]
|
||||
via: OmniAuth.config.allowed_request_methods
|
||||
|
||||
match "#{path_prefix}/#{provider}/callback",
|
||||
to: "#{controllers[:omniauth_callbacks]}##{provider}",
|
||||
@@ -462,7 +461,7 @@ ERROR
|
||||
current_scope = @scope.dup
|
||||
|
||||
exclusive = { as: new_as, path: new_path, module: nil }
|
||||
exclusive.merge!(options.slice(:constraints, :defaults, :options))
|
||||
exclusive.merge!(options.slice(:constraints, :format, :defaults, :options))
|
||||
|
||||
if @scope.respond_to? :new
|
||||
@scope = @scope.new exclusive
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Devise
|
||||
class SecretKeyFinder
|
||||
def initialize(application)
|
||||
@application = application
|
||||
end
|
||||
|
||||
def find
|
||||
if @application.respond_to?(:credentials) && key_exists?(@application.credentials)
|
||||
@application.credentials.secret_key_base
|
||||
elsif @application.respond_to?(:secrets) && key_exists?(@application.secrets)
|
||||
@application.secrets.secret_key_base
|
||||
elsif @application.config.respond_to?(:secret_key_base) && key_exists?(@application.config)
|
||||
@application.config.secret_key_base
|
||||
elsif @application.respond_to?(:secret_key_base) && key_exists?(@application)
|
||||
@application.secret_key_base
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def key_exists?(object)
|
||||
object.secret_key_base.present?
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -64,17 +64,7 @@ module Devise
|
||||
#
|
||||
# sign_in users(:alice)
|
||||
# sign_in users(:alice), scope: :admin
|
||||
def sign_in(resource, deprecated = nil, scope: nil)
|
||||
if deprecated.present?
|
||||
scope = resource
|
||||
resource = deprecated
|
||||
|
||||
ActiveSupport::Deprecation.warn <<-DEPRECATION.strip_heredoc
|
||||
[Devise] sign_in(:#{scope}, resource) on controller tests is deprecated and will be removed from Devise.
|
||||
Please use sign_in(resource, scope: :#{scope}) instead.
|
||||
DEPRECATION
|
||||
end
|
||||
|
||||
def sign_in(resource, scope: nil)
|
||||
scope ||= Devise::Mapping.find_scope!(resource)
|
||||
|
||||
warden.instance_variable_get(:@users).delete(scope)
|
||||
@@ -141,7 +131,6 @@ module Devise
|
||||
|
||||
status, headers, response = Devise.warden_config[:failure_app].call(env).to_a
|
||||
@controller.response.headers.merge!(headers)
|
||||
@controller.response.content_type = headers["Content-Type"] unless Rails::VERSION::MAJOR >= 5
|
||||
@controller.status = status
|
||||
@controller.response_body = response.body
|
||||
nil # causes process return @response
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Devise
|
||||
module TestHelpers
|
||||
def self.included(base)
|
||||
base.class_eval do
|
||||
ActiveSupport::Deprecation.warn <<-DEPRECATION.strip_heredoc
|
||||
[Devise] including `Devise::TestHelpers` is deprecated and will be removed from Devise.
|
||||
For controller tests, please include `Devise::Test::ControllerHelpers` instead.
|
||||
DEPRECATION
|
||||
include Devise::Test::ControllerHelpers
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,5 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Devise
|
||||
VERSION = "4.7.2".freeze
|
||||
VERSION = "5.0.0.rc".freeze
|
||||
end
|
||||
|
||||
@@ -5,7 +5,7 @@ require 'generators/devise/orm_helpers'
|
||||
|
||||
module ActiveRecord
|
||||
module Generators
|
||||
class DeviseGenerator < ActiveRecord::Generators::Base
|
||||
class DeviseGenerator < Base
|
||||
argument :attributes, type: :array, default: [], banner: "field:type field:type"
|
||||
|
||||
class_option :primary_key_type, type: :string, desc: "The type for primary key"
|
||||
@@ -82,23 +82,32 @@ RUBY
|
||||
postgresql?
|
||||
end
|
||||
|
||||
def rails5_and_up?
|
||||
Rails::VERSION::MAJOR >= 5
|
||||
def rails61_and_up?
|
||||
Rails::VERSION::MAJOR > 6 || (Rails::VERSION::MAJOR == 6 && Rails::VERSION::MINOR >= 1)
|
||||
end
|
||||
|
||||
def postgresql?
|
||||
config = ActiveRecord::Base.configurations[Rails.env]
|
||||
config && config['adapter'] == 'postgresql'
|
||||
ar_config && ar_config['adapter'] == 'postgresql'
|
||||
end
|
||||
|
||||
def migration_version
|
||||
if rails5_and_up?
|
||||
"[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]"
|
||||
end
|
||||
end
|
||||
def ar_config
|
||||
if ActiveRecord::Base.configurations.respond_to?(:configs_for)
|
||||
if rails61_and_up?
|
||||
ActiveRecord::Base.configurations.configs_for(env_name: Rails.env, name: "primary").configuration_hash
|
||||
else
|
||||
ActiveRecord::Base.configurations.configs_for(env_name: Rails.env, spec_name: "primary").config
|
||||
end
|
||||
else
|
||||
ActiveRecord::Base.configurations[Rails.env]
|
||||
end
|
||||
end
|
||||
|
||||
def migration_version
|
||||
"[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]"
|
||||
end
|
||||
|
||||
def primary_key_type
|
||||
primary_key_string if rails5_and_up?
|
||||
primary_key_string
|
||||
end
|
||||
|
||||
def primary_key_string
|
||||
|
||||
@@ -11,7 +11,7 @@ module Devise
|
||||
Create inherited Devise controllers in your app/controllers folder.
|
||||
|
||||
Use -c to specify which controller you want to overwrite.
|
||||
If you do no specify a controller, all controllers will be created.
|
||||
If you do not specify a controller, all controllers will be created.
|
||||
For example:
|
||||
|
||||
rails generate devise:controllers users -c=sessions
|
||||
|
||||
@@ -157,6 +157,9 @@ Devise.setup do |config|
|
||||
# initial account confirmation) to be applied. Requires additional unconfirmed_email
|
||||
# db field (see migrations). Until confirmed, new email is stored in
|
||||
# unconfirmed_email column, and copied to email column on successful confirmation.
|
||||
# Also, when used in conjunction with `send_email_changed_notification`,
|
||||
# the notification is sent to the original email when the change is requested,
|
||||
# not when the unconfirmed email is confirmed.
|
||||
config.reconfirmable = true
|
||||
|
||||
# Defines which key will be used when confirming an account
|
||||
@@ -256,14 +259,14 @@ Devise.setup do |config|
|
||||
|
||||
# ==> Navigation configuration
|
||||
# Lists the formats that should be treated as navigational. Formats like
|
||||
# :html, should redirect to the sign in page when the user does not have
|
||||
# :html should redirect to the sign in page when the user does not have
|
||||
# access, but formats like :xml or :json, should return 401.
|
||||
#
|
||||
# If you have any extra navigational formats, like :iphone or :mobile, you
|
||||
# should add them to the navigational formats lists.
|
||||
#
|
||||
# The "*/*" below is required to match Internet Explorer requests.
|
||||
# config.navigational_formats = ['*/*', :html]
|
||||
# config.navigational_formats = ['*/*', :html, :turbo_stream]
|
||||
|
||||
# The default HTTP method used to sign out a resource. Default is :delete.
|
||||
config.sign_out_via = :delete
|
||||
@@ -277,9 +280,9 @@ Devise.setup do |config|
|
||||
# If you want to use other strategies, that are not supported by Devise, or
|
||||
# change the failure app, you can configure them inside the config.warden block.
|
||||
#
|
||||
# config.warden do |manager|
|
||||
# manager.intercept_401 = false
|
||||
# manager.default_strategies(scope: :user).unshift :some_external_strategy
|
||||
# config.warden do |warden_config|
|
||||
# warden_config.intercept_401 = false
|
||||
# warden_config.default_strategies(scope: :user).unshift :some_external_strategy
|
||||
# end
|
||||
|
||||
# ==> Mountable engine configurations
|
||||
@@ -296,12 +299,14 @@ Devise.setup do |config|
|
||||
# so you need to do it manually. For the users scope, it would be:
|
||||
# config.omniauth_path_prefix = '/my_engine/users/auth'
|
||||
|
||||
# ==> Turbolinks configuration
|
||||
# If your app is using Turbolinks, Turbolinks::Controller needs to be included to make redirection work correctly:
|
||||
#
|
||||
# ActiveSupport.on_load(:devise_failure_app) do
|
||||
# include Turbolinks::Controller
|
||||
# end
|
||||
# ==> Hotwire/Turbo configuration
|
||||
# When using Devise with Hotwire/Turbo, the http status for error responses
|
||||
# and some redirects must match the following. The default in Devise for existing
|
||||
# apps is `200 OK` and `302 Found` respectively, but new apps are generated with
|
||||
# these new defaults that match Hotwire/Turbo behavior.
|
||||
# Note: These might become the new default in future versions of Devise.
|
||||
config.responder.error_status = <%= Rack::Utils::SYMBOL_TO_STATUS_CODE.key(422).inspect %>
|
||||
config.responder.redirect_status = :see_other
|
||||
|
||||
# ==> Configuration for :registerable
|
||||
|
||||
|
||||
@@ -30,6 +30,6 @@
|
||||
|
||||
<h3>Cancel my account</h3>
|
||||
|
||||
<p>Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete %></p>
|
||||
<div>Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?", turbo_confirm: "Are you sure?" }, method: :delete %></div>
|
||||
|
||||
<%= link_to "Back", :back %>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
require 'test_helper'
|
||||
require 'ostruct'
|
||||
require 'warden/strategies/base'
|
||||
require 'devise/test_helpers'
|
||||
require 'devise/test/controller_helpers'
|
||||
|
||||
class CustomStrategyController < ActionController::Base
|
||||
def new
|
||||
|
||||
@@ -14,8 +14,8 @@ class HelperMethodsTest < Devise::ControllerTestCase
|
||||
end
|
||||
|
||||
test 'does not respond_to helper or helper_method' do
|
||||
refute_respond_to @controller.class, :helper
|
||||
refute_respond_to @controller.class, :helper_method
|
||||
assert_not_respond_to @controller.class, :helper
|
||||
assert_not_respond_to @controller.class, :helper_method
|
||||
end
|
||||
|
||||
test 'defines methods like current_user' do
|
||||
|
||||
@@ -64,30 +64,30 @@ class ControllerAuthenticatableTest < Devise::ControllerTestCase
|
||||
end
|
||||
|
||||
test 'proxy authenticate_user! to authenticate with user scope' do
|
||||
@mock_warden.expects(:authenticate!).with(scope: :user)
|
||||
@mock_warden.expects(:authenticate!).with({ scope: :user, locale: :en })
|
||||
@controller.authenticate_user!
|
||||
end
|
||||
|
||||
test 'proxy authenticate_user! options to authenticate with user scope' do
|
||||
@mock_warden.expects(:authenticate!).with(scope: :user, recall: "foo")
|
||||
@mock_warden.expects(:authenticate!).with({ scope: :user, recall: "foo", locale: :en })
|
||||
@controller.authenticate_user!(recall: "foo")
|
||||
end
|
||||
|
||||
test 'proxy authenticate_admin! to authenticate with admin scope' do
|
||||
@mock_warden.expects(:authenticate!).with(scope: :admin)
|
||||
@mock_warden.expects(:authenticate!).with({ scope: :admin, locale: :en })
|
||||
@controller.authenticate_admin!
|
||||
end
|
||||
|
||||
test 'proxy authenticate_[group]! to authenticate!? with each scope' do
|
||||
[:user, :admin].each do |scope|
|
||||
@mock_warden.expects(:authenticate!).with(scope: scope)
|
||||
@mock_warden.expects(:authenticate!).with({ scope: scope, locale: :en })
|
||||
@mock_warden.expects(:authenticate?).with(scope: scope).returns(false)
|
||||
end
|
||||
@controller.authenticate_commenter!
|
||||
end
|
||||
|
||||
test 'proxy authenticate_publisher_account! to authenticate with namespaced publisher account scope' do
|
||||
@mock_warden.expects(:authenticate!).with(scope: :publisher_account)
|
||||
@mock_warden.expects(:authenticate!).with({ scope: :publisher_account, locale: :en })
|
||||
@controller.authenticate_publisher_account!
|
||||
end
|
||||
|
||||
@@ -98,7 +98,7 @@ class ControllerAuthenticatableTest < Devise::ControllerTestCase
|
||||
|
||||
test 'proxy admin_signed_in? to authenticatewith admin scope' do
|
||||
@mock_warden.expects(:authenticate).with(scope: :admin)
|
||||
refute @controller.admin_signed_in?
|
||||
assert_not @controller.admin_signed_in?
|
||||
end
|
||||
|
||||
test 'proxy publisher_account_signed_in? to authenticate with namespaced publisher account scope' do
|
||||
@@ -127,14 +127,14 @@ class ControllerAuthenticatableTest < Devise::ControllerTestCase
|
||||
test 'sign in proxy to set_user on warden' do
|
||||
user = User.new
|
||||
@mock_warden.expects(:user).returns(nil)
|
||||
@mock_warden.expects(:set_user).with(user, scope: :user).returns(true)
|
||||
@mock_warden.expects(:set_user).with(user, { scope: :user }).returns(true)
|
||||
@controller.sign_in(:user, user)
|
||||
end
|
||||
|
||||
test 'sign in accepts a resource as argument' do
|
||||
user = User.new
|
||||
@mock_warden.expects(:user).returns(nil)
|
||||
@mock_warden.expects(:set_user).with(user, scope: :user).returns(true)
|
||||
@mock_warden.expects(:set_user).with(user, { scope: :user }).returns(true)
|
||||
@controller.sign_in(user)
|
||||
end
|
||||
|
||||
@@ -148,7 +148,7 @@ class ControllerAuthenticatableTest < Devise::ControllerTestCase
|
||||
test 'sign in again when the user is already in only if force is given' do
|
||||
user = User.new
|
||||
@mock_warden.expects(:user).returns(user)
|
||||
@mock_warden.expects(:set_user).with(user, scope: :user).returns(true)
|
||||
@mock_warden.expects(:set_user).with(user, { scope: :user }).returns(true)
|
||||
@controller.sign_in(user, force: true)
|
||||
end
|
||||
|
||||
@@ -269,7 +269,7 @@ class ControllerAuthenticatableTest < Devise::ControllerTestCase
|
||||
user = User.new
|
||||
@controller.session[:user_return_to] = "/foo.bar"
|
||||
@mock_warden.expects(:user).with(:user).returns(nil)
|
||||
@mock_warden.expects(:set_user).with(user, scope: :user).returns(true)
|
||||
@mock_warden.expects(:set_user).with(user, { scope: :user }).returns(true)
|
||||
@controller.expects(:redirect_to).with("/foo.bar")
|
||||
@controller.sign_in_and_redirect(user)
|
||||
end
|
||||
@@ -277,7 +277,7 @@ class ControllerAuthenticatableTest < Devise::ControllerTestCase
|
||||
test 'sign in and redirect uses the configured after sign in path' do
|
||||
admin = Admin.new
|
||||
@mock_warden.expects(:user).with(:admin).returns(nil)
|
||||
@mock_warden.expects(:set_user).with(admin, scope: :admin).returns(true)
|
||||
@mock_warden.expects(:set_user).with(admin, { scope: :admin }).returns(true)
|
||||
@controller.expects(:redirect_to).with(admin_root_path)
|
||||
@controller.sign_in_and_redirect(admin)
|
||||
end
|
||||
@@ -319,10 +319,10 @@ class ControllerAuthenticatableTest < Devise::ControllerTestCase
|
||||
|
||||
test 'is_flashing_format? is guarded against flash (middleware) not being loaded' do
|
||||
@controller.request.expects(:respond_to?).with(:flash).returns(false)
|
||||
refute @controller.is_flashing_format?
|
||||
assert_not @controller.is_flashing_format?
|
||||
end
|
||||
|
||||
test 'is not a devise controller' do
|
||||
refute @controller.devise_controller?
|
||||
assert_not @controller.devise_controller?
|
||||
end
|
||||
end
|
||||
|
||||
@@ -55,7 +55,7 @@ class HelpersTest < Devise::ControllerTestCase
|
||||
end
|
||||
|
||||
test 'require no authentication tests current mapping' do
|
||||
@mock_warden.expects(:authenticate?).with(:rememberable, scope: :user).returns(true)
|
||||
@mock_warden.expects(:authenticate?).with(:rememberable, { scope: :user }).returns(true)
|
||||
@mock_warden.expects(:user).with(:user).returns(User.new)
|
||||
@controller.expects(:redirect_to).with(root_path)
|
||||
@controller.send :require_no_authentication
|
||||
@@ -71,7 +71,7 @@ class HelpersTest < Devise::ControllerTestCase
|
||||
end
|
||||
|
||||
test 'require no authentication sets a flash message' do
|
||||
@mock_warden.expects(:authenticate?).with(:rememberable, scope: :user).returns(true)
|
||||
@mock_warden.expects(:authenticate?).with(:rememberable, { scope: :user }).returns(true)
|
||||
@mock_warden.expects(:user).with(:user).returns(User.new)
|
||||
@controller.expects(:redirect_to).with(root_path)
|
||||
@controller.send :require_no_authentication
|
||||
@@ -121,7 +121,7 @@ class HelpersTest < Devise::ControllerTestCase
|
||||
MyController.send(:public, :navigational_formats)
|
||||
|
||||
swap Devise, navigational_formats: ['*/*', :html] do
|
||||
refute @controller.navigational_formats.include?("*/*")
|
||||
assert_not @controller.navigational_formats.include?("*/*")
|
||||
end
|
||||
|
||||
MyController.send(:protected, :navigational_formats)
|
||||
|
||||
@@ -74,7 +74,7 @@ class SessionsControllerTest < Devise::ControllerTestCase
|
||||
assert_template "devise/sessions/new"
|
||||
end
|
||||
|
||||
test "#destroy doesn't set the flash if the requested format is not navigational" do
|
||||
test "#destroy doesn't set the flash and returns 204 status if the requested format is not navigational" do
|
||||
request.env["devise.mapping"] = Devise.mappings[:user]
|
||||
user = create_user
|
||||
user.confirm
|
||||
@@ -88,21 +88,15 @@ class SessionsControllerTest < Devise::ControllerTestCase
|
||||
assert_equal 204, @response.status
|
||||
end
|
||||
|
||||
if defined?(ActiveRecord) && ActiveRecord::Base.respond_to?(:mass_assignment_sanitizer)
|
||||
test "#new doesn't raise mass-assignment exception even if sign-in key is attr_protected" do
|
||||
request.env["devise.mapping"] = Devise.mappings[:user]
|
||||
test "#destroy returns 401 status if user is not signed in and the requested format is not navigational" do
|
||||
request.env["devise.mapping"] = Devise.mappings[:user]
|
||||
delete :destroy, format: 'json'
|
||||
assert_equal 401, @response.status
|
||||
end
|
||||
|
||||
ActiveRecord::Base.mass_assignment_sanitizer = :strict
|
||||
User.class_eval { attr_protected :email }
|
||||
|
||||
begin
|
||||
assert_nothing_raised do
|
||||
get :new, user: { email: "allez viens!" }
|
||||
end
|
||||
ensure
|
||||
ActiveRecord::Base.mass_assignment_sanitizer = :logger
|
||||
User.class_eval { attr_accessible :email }
|
||||
end
|
||||
end
|
||||
test "#destroy returns 302 status if user is not signed in and the requested format is navigational" do
|
||||
request.env["devise.mapping"] = Devise.mappings[:user]
|
||||
delete :destroy
|
||||
assert_equal 302, @response.status
|
||||
end
|
||||
end
|
||||
|
||||
@@ -71,8 +71,8 @@ class DeviseTest < ActiveSupport::TestCase
|
||||
test 'add new module using the helper method' do
|
||||
Devise.add_module(:coconut)
|
||||
assert_equal 1, Devise::ALL.select { |v| v == :coconut }.size
|
||||
refute Devise::STRATEGIES.include?(:coconut)
|
||||
refute defined?(Devise::Models::Coconut)
|
||||
assert_not Devise::STRATEGIES.include?(:coconut)
|
||||
assert_not defined?(Devise::Models::Coconut)
|
||||
Devise::ALL.delete(:coconut)
|
||||
|
||||
Devise.add_module(:banana, strategy: :fruits)
|
||||
@@ -86,13 +86,18 @@ class DeviseTest < ActiveSupport::TestCase
|
||||
Devise::CONTROLLERS.delete(:kivi)
|
||||
end
|
||||
|
||||
test 'should complain when comparing empty or different sized passes' do
|
||||
test 'Devise.secure_compare fails when comparing different strings or nil' do
|
||||
[nil, ""].each do |empty|
|
||||
refute Devise.secure_compare(empty, "something")
|
||||
refute Devise.secure_compare("something", empty)
|
||||
refute Devise.secure_compare(empty, empty)
|
||||
assert_not Devise.secure_compare(empty, "something")
|
||||
assert_not Devise.secure_compare("something", empty)
|
||||
end
|
||||
refute Devise.secure_compare("size_1", "size_four")
|
||||
assert_not Devise.secure_compare(nil, nil)
|
||||
assert_not Devise.secure_compare("size_1", "size_four")
|
||||
end
|
||||
|
||||
test 'Devise.secure_compare passes when strings are the same, even two empty strings' do
|
||||
assert Devise.secure_compare("", "")
|
||||
assert Devise.secure_compare("something", "something")
|
||||
end
|
||||
|
||||
test 'Devise.email_regexp should match valid email addresses' do
|
||||
|
||||
@@ -79,7 +79,6 @@ class FailureTest < ActiveSupport::TestCase
|
||||
'HTTP_HOST' => 'test.host',
|
||||
'REQUEST_METHOD' => 'GET',
|
||||
'warden.options' => { scope: :user },
|
||||
'rack.session' => {},
|
||||
'action_dispatch.request.formats' => Array(env_params.delete('formats') || Mime[:html]),
|
||||
'rack.input' => "",
|
||||
'warden' => OpenStruct.new(message: nil)
|
||||
@@ -185,22 +184,39 @@ class FailureTest < ActiveSupport::TestCase
|
||||
|
||||
test 'uses the proxy failure message as symbol' do
|
||||
call_failure('warden' => OpenStruct.new(message: :invalid))
|
||||
assert_equal 'Invalid Email or password.', @request.flash[:alert]
|
||||
assert_equal 'Invalid email or password.', @request.flash[:alert]
|
||||
assert_equal 'http://test.host/users/sign_in', @response.second["Location"]
|
||||
end
|
||||
|
||||
test 'supports authentication_keys as a Hash for the flash message' do
|
||||
swap Devise, authentication_keys: { email: true, login: true } do
|
||||
call_failure('warden' => OpenStruct.new(message: :invalid))
|
||||
assert_equal 'Invalid Email, Login or password.', @request.flash[:alert]
|
||||
assert_equal 'Invalid email, login or password.', @request.flash[:alert]
|
||||
end
|
||||
end
|
||||
|
||||
test 'downcases authentication_keys for the flash message' do
|
||||
call_failure('warden' => OpenStruct.new(message: :invalid))
|
||||
assert_equal 'Invalid email or password.', @request.flash[:alert]
|
||||
end
|
||||
|
||||
test 'humanizes the flash message' do
|
||||
call_failure('warden' => OpenStruct.new(message: :invalid))
|
||||
assert_equal @request.flash[:alert], @request.flash[:alert].humanize
|
||||
end
|
||||
|
||||
test 'uses custom i18n options' do
|
||||
call_failure('warden' => OpenStruct.new(message: :does_not_exist), app: FailureWithI18nOptions)
|
||||
assert_equal 'User Steve does not exist', @request.flash[:alert]
|
||||
end
|
||||
|
||||
test 'respects the i18n locale passed via warden options when redirecting' do
|
||||
call_failure('warden' => OpenStruct.new(message: :invalid), 'warden.options' => { locale: :"pt-BR" })
|
||||
|
||||
assert_equal 'Email ou senha inválidos.', @request.flash[:alert]
|
||||
assert_equal 'http://test.host/users/sign_in', @response.second["Location"]
|
||||
end
|
||||
|
||||
test 'uses the proxy failure message as string' do
|
||||
call_failure('warden' => OpenStruct.new(message: 'Hello world'))
|
||||
assert_equal 'Hello world', @request.flash[:alert]
|
||||
@@ -214,14 +230,18 @@ class FailureTest < ActiveSupport::TestCase
|
||||
|
||||
test 'set up a default message' do
|
||||
call_failure
|
||||
assert_match(/You are being/, @response.last.body)
|
||||
assert_match(/redirected/, @response.last.body)
|
||||
assert_match(/users\/sign_in/, @response.last.body)
|
||||
if Devise::Test.rails71_and_up?
|
||||
assert_empty @response.last.body
|
||||
else
|
||||
assert_match(/You are being/, @response.last.body)
|
||||
assert_match(/redirected/, @response.last.body)
|
||||
assert_match(/users\/sign_in/, @response.last.body)
|
||||
end
|
||||
end
|
||||
|
||||
test 'works for any navigational format' do
|
||||
swap Devise, navigational_formats: [:xml] do
|
||||
call_failure('formats' => Mime[:xml])
|
||||
swap Devise, navigational_formats: [:json] do
|
||||
call_failure('formats' => Mime[:json])
|
||||
assert_equal 302, @response.first
|
||||
end
|
||||
end
|
||||
@@ -236,7 +256,7 @@ class FailureTest < ActiveSupport::TestCase
|
||||
|
||||
context 'For HTTP request' do
|
||||
test 'return 401 status' do
|
||||
call_failure('formats' => Mime[:xml])
|
||||
call_failure('formats' => Mime[:json])
|
||||
assert_equal 401, @response.first
|
||||
end
|
||||
|
||||
@@ -258,13 +278,13 @@ class FailureTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
test 'return WWW-authenticate headers if model allows' do
|
||||
call_failure('formats' => Mime[:xml])
|
||||
call_failure('formats' => Mime[:json])
|
||||
assert_equal 'Basic realm="Application"', @response.second["WWW-Authenticate"]
|
||||
end
|
||||
|
||||
test 'does not return WWW-authenticate headers if model does not allow' do
|
||||
swap Devise, http_authenticatable: false do
|
||||
call_failure('formats' => Mime[:xml])
|
||||
call_failure('formats' => Mime[:json])
|
||||
assert_nil @response.second["WWW-Authenticate"]
|
||||
end
|
||||
end
|
||||
@@ -278,7 +298,13 @@ class FailureTest < ActiveSupport::TestCase
|
||||
|
||||
test 'uses the failure message as response body' do
|
||||
call_failure('formats' => Mime[:xml], 'warden' => OpenStruct.new(message: :invalid))
|
||||
assert_match '<error>Invalid Email or password.</error>', @response.third.body
|
||||
assert_match '<error>Invalid email or password.</error>', @response.third.body
|
||||
end
|
||||
|
||||
test 'respects the i18n locale passed via warden options when responding to HTTP request' do
|
||||
call_failure('formats' => Mime[:json], 'warden' => OpenStruct.new(message: :invalid), 'warden.options' => { locale: :"pt-BR" })
|
||||
|
||||
assert_equal %({"error":"Email ou senha inválidos."}), @response.third.body
|
||||
end
|
||||
|
||||
context 'on ajax call' do
|
||||
@@ -327,7 +353,7 @@ class FailureTest < ActiveSupport::TestCase
|
||||
}
|
||||
call_failure(env)
|
||||
assert_includes @response.third.body, '<h2>Log in</h2>'
|
||||
assert_includes @response.third.body, 'Invalid Email or password.'
|
||||
assert_includes @response.third.body, 'Invalid email or password.'
|
||||
end
|
||||
|
||||
test 'calls the original controller if not confirmed email' do
|
||||
@@ -362,12 +388,77 @@ class FailureTest < ActiveSupport::TestCase
|
||||
}
|
||||
call_failure(env)
|
||||
assert_includes @response.third.body, '<h2>Log in</h2>'
|
||||
assert_includes @response.third.body, 'Invalid Email or password.'
|
||||
assert_includes @response.third.body, 'Invalid email or password.'
|
||||
assert_equal '/sample', @request.env["SCRIPT_NAME"]
|
||||
assert_equal '/users/sign_in', @request.env["PATH_INFO"]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
test 'respects the i18n locale passed via warden options when recalling original controller' do
|
||||
env = {
|
||||
"warden.options" => { recall: "devise/sessions#new", attempted_path: "/users/sign_in", locale: :"pt-BR" },
|
||||
"devise.mapping" => Devise.mappings[:user],
|
||||
"warden" => stub_everything
|
||||
}
|
||||
call_failure(env)
|
||||
|
||||
assert_includes @response.third.body, '<h2>Log in</h2>'
|
||||
assert_includes @response.third.body, 'Email ou senha inválidos.'
|
||||
end
|
||||
|
||||
# TODO: remove conditional/else when supporting only responders 3.1+
|
||||
if ActionController::Responder.respond_to?(:error_status=)
|
||||
test 'respects the configured responder `error_status` for the status code' do
|
||||
swap Devise.responder, error_status: :unprocessable_entity do
|
||||
env = {
|
||||
"warden.options" => { recall: "devise/sessions#new", attempted_path: "/users/sign_in" },
|
||||
"devise.mapping" => Devise.mappings[:user],
|
||||
"warden" => stub_everything
|
||||
}
|
||||
call_failure(env)
|
||||
|
||||
assert_equal 422, @response.first
|
||||
assert_includes @response.third.body, 'Invalid email or password.'
|
||||
end
|
||||
end
|
||||
|
||||
test 'respects the configured responder `redirect_status` if the recall app returns a redirect status code' do
|
||||
swap Devise.responder, redirect_status: :see_other do
|
||||
env = {
|
||||
"warden.options" => { recall: "devise/registrations#cancel", attempted_path: "/users/cancel" },
|
||||
"devise.mapping" => Devise.mappings[:user],
|
||||
"warden" => stub_everything
|
||||
}
|
||||
call_failure(env)
|
||||
|
||||
assert_equal 303, @response.first
|
||||
end
|
||||
end
|
||||
else
|
||||
test 'uses default hardcoded responder `error_status` for the status code since responders version does not support configuring it' do
|
||||
env = {
|
||||
"warden.options" => { recall: "devise/sessions#new", attempted_path: "/users/sign_in" },
|
||||
"devise.mapping" => Devise.mappings[:user],
|
||||
"warden" => stub_everything
|
||||
}
|
||||
call_failure(env)
|
||||
|
||||
assert_equal 200, @response.first
|
||||
assert_includes @response.third.body, 'Invalid email or password.'
|
||||
end
|
||||
|
||||
test 'users default hardcoded responder `redirect_status` for the status code since responders version does not support configuring it' do
|
||||
env = {
|
||||
"warden.options" => { recall: "devise/registrations#cancel", attempted_path: "/users/cancel" },
|
||||
"devise.mapping" => Devise.mappings[:user],
|
||||
"warden" => stub_everything
|
||||
}
|
||||
call_failure(env)
|
||||
|
||||
assert_equal 302, @response.first
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "Lazy loading" do
|
||||
@@ -375,6 +466,7 @@ class FailureTest < ActiveSupport::TestCase
|
||||
assert_equal "yes it does", Devise::FailureApp.new.lazy_loading_works?
|
||||
end
|
||||
end
|
||||
|
||||
context "Without Flash Support" do
|
||||
test "returns to the default redirect location without a flash message" do
|
||||
call_failure request_klass: RequestWithoutFlashSupport
|
||||
|
||||
@@ -20,11 +20,7 @@ if DEVISE_ORM == :active_record
|
||||
Rails.application.config.paths.add "db/migrate", with: "db2/migrate"
|
||||
|
||||
run_generator %w(monster)
|
||||
if Rails.version >= '5.0.3'
|
||||
assert_migration "db2/migrate/devise_create_monsters.rb", /def change/
|
||||
else
|
||||
assert_migration "db/migrate/devise_create_monsters.rb", /def change/
|
||||
end
|
||||
assert_migration "db2/migrate/devise_create_monsters.rb", /def change/
|
||||
|
||||
Rails.application.config.paths["db/migrate"] = old_paths
|
||||
end
|
||||
@@ -49,11 +45,7 @@ if DEVISE_ORM == :active_record
|
||||
assert_file "app/models/monster.rb"
|
||||
run_generator %w(monster)
|
||||
|
||||
if Rails.version >= '5.0.3'
|
||||
assert_migration "db2/migrate/add_devise_to_monsters.rb"
|
||||
else
|
||||
assert_migration "db/migrate/add_devise_to_monsters.rb"
|
||||
end
|
||||
assert_migration "db2/migrate/add_devise_to_monsters.rb"
|
||||
|
||||
Rails.application.config.paths["db/migrate"] = old_paths
|
||||
end
|
||||
@@ -84,11 +76,7 @@ if DEVISE_ORM == :active_record
|
||||
|
||||
test "add primary key type with rails 5 when specified in rails generator" do
|
||||
run_generator ["monster", "--primary_key_type=uuid"]
|
||||
if Devise::Test.rails5_and_up?
|
||||
assert_migration "db/migrate/devise_create_monsters.rb", /create_table :monsters, id: :uuid do/
|
||||
else
|
||||
assert_migration "db/migrate/devise_create_monsters.rb", /create_table :monsters do/
|
||||
end
|
||||
assert_migration "db/migrate/devise_create_monsters.rb", /create_table :monsters, id: :uuid do/
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -37,5 +37,4 @@ class DeviseGeneratorTest < Rails::Generators::TestCase
|
||||
FileUtils.mkdir_p(destination)
|
||||
FileUtils.cp routes, destination
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -23,4 +23,12 @@ class InstallGeneratorTest < Rails::Generators::TestCase
|
||||
assert_no_file "config/initializers/devise.rb"
|
||||
assert_no_file "config/locales/devise.en.yml"
|
||||
end
|
||||
|
||||
test "responder error_status based on rack version" do
|
||||
run_generator(["--orm=active_record"])
|
||||
|
||||
error_status = Rack::RELEASE >= "3.1" ? :unprocessable_content : :unprocessable_entity
|
||||
|
||||
assert_file "config/initializers/devise.rb", /config\.responder\.error_status = #{error_status.inspect}/
|
||||
end
|
||||
end
|
||||
|
||||
@@ -34,10 +34,6 @@ class DeviseHelperTest < Devise::IntegrationTest
|
||||
end
|
||||
|
||||
test 'test errors.messages.not_saved with multiple errors from i18n' do
|
||||
# Dirty tracking behavior prevents email validations from being applied:
|
||||
# https://github.com/mongoid/mongoid/issues/756
|
||||
(pending "Fails on Mongoid < 2.1"; break) if defined?(Mongoid) && Mongoid::VERSION.to_f < 2.1
|
||||
|
||||
get new_user_registration_path
|
||||
|
||||
fill_in 'email', with: 'invalid_email'
|
||||
|
||||
@@ -6,7 +6,7 @@ class AuthenticationSanityTest < Devise::IntegrationTest
|
||||
test 'sign in should not run model validations' do
|
||||
sign_in_as_user
|
||||
|
||||
refute User.validations_performed
|
||||
assert_not User.validations_performed
|
||||
end
|
||||
|
||||
test 'home should be accessible without sign in' do
|
||||
@@ -18,13 +18,13 @@ class AuthenticationSanityTest < Devise::IntegrationTest
|
||||
test 'sign in as user should not authenticate admin scope' do
|
||||
sign_in_as_user
|
||||
assert warden.authenticated?(:user)
|
||||
refute warden.authenticated?(:admin)
|
||||
assert_not warden.authenticated?(:admin)
|
||||
end
|
||||
|
||||
test 'sign in as admin should not authenticate user scope' do
|
||||
sign_in_as_admin
|
||||
assert warden.authenticated?(:admin)
|
||||
refute warden.authenticated?(:user)
|
||||
assert_not warden.authenticated?(:user)
|
||||
end
|
||||
|
||||
test 'sign in as both user and admin at same time' do
|
||||
@@ -39,7 +39,7 @@ class AuthenticationSanityTest < Devise::IntegrationTest
|
||||
sign_in_as_user
|
||||
sign_in_as_admin
|
||||
delete destroy_user_session_path
|
||||
refute warden.authenticated?(:user)
|
||||
assert_not warden.authenticated?(:user)
|
||||
assert warden.authenticated?(:admin)
|
||||
end
|
||||
end
|
||||
@@ -50,7 +50,7 @@ class AuthenticationSanityTest < Devise::IntegrationTest
|
||||
sign_in_as_admin
|
||||
|
||||
delete destroy_admin_session_path
|
||||
refute warden.authenticated?(:admin)
|
||||
assert_not warden.authenticated?(:admin)
|
||||
assert warden.authenticated?(:user)
|
||||
end
|
||||
end
|
||||
@@ -61,8 +61,8 @@ class AuthenticationSanityTest < Devise::IntegrationTest
|
||||
sign_in_as_admin
|
||||
|
||||
delete destroy_user_session_path
|
||||
refute warden.authenticated?(:user)
|
||||
refute warden.authenticated?(:admin)
|
||||
assert_not warden.authenticated?(:user)
|
||||
assert_not warden.authenticated?(:admin)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -72,21 +72,21 @@ class AuthenticationSanityTest < Devise::IntegrationTest
|
||||
sign_in_as_admin
|
||||
|
||||
delete destroy_admin_session_path
|
||||
refute warden.authenticated?(:admin)
|
||||
refute warden.authenticated?(:user)
|
||||
assert_not warden.authenticated?(:admin)
|
||||
assert_not warden.authenticated?(:user)
|
||||
end
|
||||
end
|
||||
|
||||
test 'not signed in as admin should not be able to access admins actions' do
|
||||
get admins_path
|
||||
assert_redirected_to new_admin_session_path
|
||||
refute warden.authenticated?(:admin)
|
||||
assert_not warden.authenticated?(:admin)
|
||||
end
|
||||
|
||||
test 'signed in as user should not be able to access admins actions' do
|
||||
sign_in_as_user
|
||||
assert warden.authenticated?(:user)
|
||||
refute warden.authenticated?(:admin)
|
||||
assert_not warden.authenticated?(:admin)
|
||||
|
||||
get admins_path
|
||||
assert_redirected_to new_admin_session_path
|
||||
@@ -95,7 +95,7 @@ class AuthenticationSanityTest < Devise::IntegrationTest
|
||||
test 'signed in as admin should be able to access admin actions' do
|
||||
sign_in_as_admin
|
||||
assert warden.authenticated?(:admin)
|
||||
refute warden.authenticated?(:user)
|
||||
assert_not warden.authenticated?(:user)
|
||||
|
||||
get admins_path
|
||||
|
||||
@@ -123,7 +123,7 @@ class AuthenticationSanityTest < Devise::IntegrationTest
|
||||
|
||||
get root_path
|
||||
assert_contain 'Signed out successfully'
|
||||
refute warden.authenticated?(:admin)
|
||||
assert_not warden.authenticated?(:admin)
|
||||
end
|
||||
|
||||
test 'unauthenticated admin set message on sign out' do
|
||||
@@ -146,13 +146,13 @@ class AuthenticationRoutesRestrictions < Devise::IntegrationTest
|
||||
test 'not signed in should not be able to access private route (authenticate denied)' do
|
||||
get private_path
|
||||
assert_redirected_to new_admin_session_path
|
||||
refute warden.authenticated?(:admin)
|
||||
assert_not warden.authenticated?(:admin)
|
||||
end
|
||||
|
||||
test 'signed in as user should not be able to access private route restricted to admins (authenticate denied)' do
|
||||
sign_in_as_user
|
||||
assert warden.authenticated?(:user)
|
||||
refute warden.authenticated?(:admin)
|
||||
assert_not warden.authenticated?(:admin)
|
||||
get private_path
|
||||
assert_redirected_to new_admin_session_path
|
||||
end
|
||||
@@ -160,7 +160,7 @@ class AuthenticationRoutesRestrictions < Devise::IntegrationTest
|
||||
test 'signed in as admin should be able to access private route restricted to admins (authenticate accepted)' do
|
||||
sign_in_as_admin
|
||||
assert warden.authenticated?(:admin)
|
||||
refute warden.authenticated?(:user)
|
||||
assert_not warden.authenticated?(:user)
|
||||
|
||||
get private_path
|
||||
|
||||
@@ -172,7 +172,7 @@ class AuthenticationRoutesRestrictions < Devise::IntegrationTest
|
||||
test 'signed in as inactive admin should not be able to access private/active route restricted to active admins (authenticate denied)' do
|
||||
sign_in_as_admin(active: false)
|
||||
assert warden.authenticated?(:admin)
|
||||
refute warden.authenticated?(:user)
|
||||
assert_not warden.authenticated?(:user)
|
||||
|
||||
assert_raises ActionController::RoutingError do
|
||||
get "/private/active"
|
||||
@@ -182,7 +182,7 @@ class AuthenticationRoutesRestrictions < Devise::IntegrationTest
|
||||
test 'signed in as active admin should be able to access private/active route restricted to active admins (authenticate accepted)' do
|
||||
sign_in_as_admin(active: true)
|
||||
assert warden.authenticated?(:admin)
|
||||
refute warden.authenticated?(:user)
|
||||
assert_not warden.authenticated?(:user)
|
||||
|
||||
get private_active_path
|
||||
|
||||
@@ -194,7 +194,7 @@ class AuthenticationRoutesRestrictions < Devise::IntegrationTest
|
||||
test 'signed in as admin should get admin dashboard (authenticated accepted)' do
|
||||
sign_in_as_admin
|
||||
assert warden.authenticated?(:admin)
|
||||
refute warden.authenticated?(:user)
|
||||
assert_not warden.authenticated?(:user)
|
||||
|
||||
get dashboard_path
|
||||
|
||||
@@ -206,7 +206,7 @@ class AuthenticationRoutesRestrictions < Devise::IntegrationTest
|
||||
test 'signed in as user should get user dashboard (authenticated accepted)' do
|
||||
sign_in_as_user
|
||||
assert warden.authenticated?(:user)
|
||||
refute warden.authenticated?(:admin)
|
||||
assert_not warden.authenticated?(:admin)
|
||||
|
||||
get dashboard_path
|
||||
|
||||
@@ -224,7 +224,7 @@ class AuthenticationRoutesRestrictions < Devise::IntegrationTest
|
||||
test 'signed in as inactive admin should not be able to access dashboard/active route restricted to active admins (authenticated denied)' do
|
||||
sign_in_as_admin(active: false)
|
||||
assert warden.authenticated?(:admin)
|
||||
refute warden.authenticated?(:user)
|
||||
assert_not warden.authenticated?(:user)
|
||||
|
||||
assert_raises ActionController::RoutingError do
|
||||
get "/dashboard/active"
|
||||
@@ -234,7 +234,7 @@ class AuthenticationRoutesRestrictions < Devise::IntegrationTest
|
||||
test 'signed in as active admin should be able to access dashboard/active route restricted to active admins (authenticated accepted)' do
|
||||
sign_in_as_admin(active: true)
|
||||
assert warden.authenticated?(:admin)
|
||||
refute warden.authenticated?(:user)
|
||||
assert_not warden.authenticated?(:user)
|
||||
|
||||
get dashboard_active_path
|
||||
|
||||
@@ -246,7 +246,7 @@ class AuthenticationRoutesRestrictions < Devise::IntegrationTest
|
||||
test 'signed in user should not see unauthenticated page (unauthenticated denied)' do
|
||||
sign_in_as_user
|
||||
assert warden.authenticated?(:user)
|
||||
refute warden.authenticated?(:admin)
|
||||
assert_not warden.authenticated?(:admin)
|
||||
|
||||
assert_raises ActionController::RoutingError do
|
||||
get join_path
|
||||
@@ -273,6 +273,15 @@ class AuthenticationRedirectTest < Devise::IntegrationTest
|
||||
assert_contain 'You need to sign in or sign up before continuing.'
|
||||
end
|
||||
|
||||
test 'redirect from warden respects i18n locale set at the controller' do
|
||||
get admins_path(locale: "pt-BR")
|
||||
|
||||
assert_redirected_to new_admin_session_path
|
||||
follow_redirect!
|
||||
|
||||
assert_contain 'Para continuar, faça login ou registre-se.'
|
||||
end
|
||||
|
||||
test 'redirect to default url if no other was configured' do
|
||||
sign_in_as_user
|
||||
assert_template 'home/index'
|
||||
@@ -344,16 +353,20 @@ class AuthenticationSessionTest < Devise::IntegrationTest
|
||||
end
|
||||
|
||||
test 'refreshes _csrf_token' do
|
||||
ApplicationController.allow_forgery_protection = true
|
||||
|
||||
begin
|
||||
swap ApplicationController, allow_forgery_protection: true do
|
||||
get new_user_session_path
|
||||
token = request.session[:_csrf_token]
|
||||
token_from_session = request.session[:_csrf_token]
|
||||
|
||||
if Devise::Test.rails71_and_up?
|
||||
token_from_env = request.env["action_controller.csrf_token"]
|
||||
end
|
||||
|
||||
sign_in_as_user
|
||||
assert_not_equal request.session[:_csrf_token], token
|
||||
ensure
|
||||
ApplicationController.allow_forgery_protection = false
|
||||
assert_not_equal request.session[:_csrf_token], token_from_session
|
||||
|
||||
if Devise::Test.rails71_and_up?
|
||||
assert_not_equal request.env["action_controller.csrf_token"], token_from_env
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -393,7 +406,7 @@ class AuthenticationWithScopedViewsTest < Devise::IntegrationTest
|
||||
end
|
||||
|
||||
assert_match %r{Special user view}, response.body
|
||||
assert !Devise::PasswordsController.scoped_views?
|
||||
assert_not Devise::PasswordsController.scoped_views?
|
||||
ensure
|
||||
Devise::SessionsController.send :remove_instance_variable, :@scoped_views
|
||||
end
|
||||
@@ -420,13 +433,13 @@ class AuthenticationOthersTest < Devise::IntegrationTest
|
||||
test 'handles unverified requests gets rid of caches' do
|
||||
swap ApplicationController, allow_forgery_protection: true do
|
||||
post exhibit_user_url(1)
|
||||
refute warden.authenticated?(:user)
|
||||
assert_not warden.authenticated?(:user)
|
||||
|
||||
sign_in_as_user
|
||||
assert warden.authenticated?(:user)
|
||||
|
||||
post exhibit_user_url(1)
|
||||
refute warden.authenticated?(:user)
|
||||
assert_not warden.authenticated?(:user)
|
||||
assert_equal "User is not authenticated", response.body
|
||||
end
|
||||
end
|
||||
@@ -462,14 +475,6 @@ class AuthenticationOthersTest < Devise::IntegrationTest
|
||||
end
|
||||
end
|
||||
|
||||
test 'sign in stub in xml format' do
|
||||
get new_user_session_path(format: 'xml')
|
||||
assert_match '<?xml version="1.0" encoding="UTF-8"?>', response.body
|
||||
assert_match %r{<user>.*</user>}m, response.body
|
||||
assert_match '<email></email>', response.body
|
||||
assert_match '<password nil="true"', response.body
|
||||
end
|
||||
|
||||
test 'sign in stub in json format' do
|
||||
get new_user_session_path(format: 'json')
|
||||
assert_match '{"user":{', response.body
|
||||
@@ -489,30 +494,30 @@ class AuthenticationOthersTest < Devise::IntegrationTest
|
||||
test 'uses the mapping from router' do
|
||||
sign_in_as_user visit: "/as/sign_in"
|
||||
assert warden.authenticated?(:user)
|
||||
refute warden.authenticated?(:admin)
|
||||
assert_not warden.authenticated?(:admin)
|
||||
end
|
||||
|
||||
test 'sign in with xml format returns xml response' do
|
||||
test 'sign in with json format returns json response' do
|
||||
create_user
|
||||
post user_session_path(format: 'xml'), params: { user: {email: "user@test.com", password: '12345678'} }
|
||||
post user_session_path(format: 'json'), params: { user: {email: "user@test.com", password: '12345678'} }
|
||||
assert_response :success
|
||||
assert_includes response.body, %(<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<user>)
|
||||
assert_includes response.body, '{"user":{'
|
||||
end
|
||||
|
||||
test 'sign in with xml format is idempotent' do
|
||||
get new_user_session_path(format: 'xml')
|
||||
test 'sign in with json format is idempotent' do
|
||||
get new_user_session_path(format: 'json')
|
||||
assert_response :success
|
||||
|
||||
create_user
|
||||
post user_session_path(format: 'xml'), params: { user: {email: "user@test.com", password: '12345678'} }
|
||||
post user_session_path(format: 'json'), params: { user: {email: "user@test.com", password: '12345678'} }
|
||||
assert_response :success
|
||||
|
||||
get new_user_session_path(format: 'xml')
|
||||
get new_user_session_path(format: 'json')
|
||||
assert_response :success
|
||||
|
||||
post user_session_path(format: 'xml'), params: { user: {email: "user@test.com", password: '12345678'} }
|
||||
post user_session_path(format: 'json'), params: { user: {email: "user@test.com", password: '12345678'} }
|
||||
assert_response :success
|
||||
assert_includes response.body, %(<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<user>)
|
||||
assert_includes response.body, '{"user":{'
|
||||
end
|
||||
|
||||
test 'sign out with html redirects' do
|
||||
@@ -527,18 +532,11 @@ class AuthenticationOthersTest < Devise::IntegrationTest
|
||||
assert_current_url '/'
|
||||
end
|
||||
|
||||
test 'sign out with xml format returns no content' do
|
||||
sign_in_as_user
|
||||
delete destroy_user_session_path(format: 'xml')
|
||||
assert_response :no_content
|
||||
refute warden.authenticated?(:user)
|
||||
end
|
||||
|
||||
test 'sign out with json format returns no content' do
|
||||
sign_in_as_user
|
||||
delete destroy_user_session_path(format: 'json')
|
||||
assert_response :no_content
|
||||
refute warden.authenticated?(:user)
|
||||
assert_not warden.authenticated?(:user)
|
||||
end
|
||||
|
||||
test 'sign out with non-navigational format via XHR does not redirect' do
|
||||
@@ -546,7 +544,7 @@ class AuthenticationOthersTest < Devise::IntegrationTest
|
||||
sign_in_as_admin
|
||||
get destroy_sign_out_via_get_session_path, xhr: true, headers: { "HTTP_ACCEPT" => "application/json,text/javascript,*/*" } # NOTE: Bug is triggered by combination of XHR and */*.
|
||||
assert_response :no_content
|
||||
refute warden.authenticated?(:user)
|
||||
assert_not warden.authenticated?(:user)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -556,7 +554,7 @@ class AuthenticationOthersTest < Devise::IntegrationTest
|
||||
sign_in_as_user
|
||||
delete destroy_user_session_path, xhr: true, headers: { "HTTP_ACCEPT" => "text/html,*/*" }
|
||||
assert_response :redirect
|
||||
refute warden.authenticated?(:user)
|
||||
assert_not warden.authenticated?(:user)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -565,8 +563,8 @@ class AuthenticationKeysTest < Devise::IntegrationTest
|
||||
test 'missing authentication keys cause authentication to abort' do
|
||||
swap Devise, authentication_keys: [:subdomain] do
|
||||
sign_in_as_user
|
||||
assert_contain "Invalid Subdomain or password."
|
||||
refute warden.authenticated?(:user)
|
||||
assert_contain "Invalid subdomain or password."
|
||||
assert_not warden.authenticated?(:user)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -583,7 +581,7 @@ class AuthenticationRequestKeysTest < Devise::IntegrationTest
|
||||
host! 'foo.bar.baz'
|
||||
|
||||
swap Devise, request_keys: [:subdomain] do
|
||||
User.expects(:find_for_authentication).with(subdomain: 'foo', email: 'user@test.com').returns(create_user)
|
||||
User.expects(:find_for_authentication).with({ subdomain: 'foo', email: 'user@test.com' }).returns(create_user)
|
||||
sign_in_as_user
|
||||
assert warden.authenticated?(:user)
|
||||
end
|
||||
@@ -595,7 +593,7 @@ class AuthenticationRequestKeysTest < Devise::IntegrationTest
|
||||
sign_in_as_user
|
||||
end
|
||||
|
||||
refute warden.authenticated?(:user)
|
||||
assert_not warden.authenticated?(:user)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -604,8 +602,8 @@ class AuthenticationRequestKeysTest < Devise::IntegrationTest
|
||||
|
||||
swap Devise, request_keys: [:subdomain] do
|
||||
sign_in_as_user
|
||||
assert_contain "Invalid Email or password."
|
||||
refute warden.authenticated?(:user)
|
||||
assert_contain "Invalid email or password."
|
||||
assert_not warden.authenticated?(:user)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -628,7 +626,7 @@ class AuthenticationSignOutViaTest < Devise::IntegrationTest
|
||||
test 'allow sign out via delete when sign_out_via provides only delete' do
|
||||
sign_in!(:sign_out_via_delete)
|
||||
delete destroy_sign_out_via_delete_session_path
|
||||
refute warden.authenticated?(:sign_out_via_delete)
|
||||
assert_not warden.authenticated?(:sign_out_via_delete)
|
||||
end
|
||||
|
||||
test 'do not allow sign out via get when sign_out_via provides only delete' do
|
||||
@@ -642,7 +640,7 @@ class AuthenticationSignOutViaTest < Devise::IntegrationTest
|
||||
test 'allow sign out via post when sign_out_via provides only post' do
|
||||
sign_in!(:sign_out_via_post)
|
||||
post destroy_sign_out_via_post_session_path
|
||||
refute warden.authenticated?(:sign_out_via_post)
|
||||
assert_not warden.authenticated?(:sign_out_via_post)
|
||||
end
|
||||
|
||||
test 'do not allow sign out via get when sign_out_via provides only post' do
|
||||
@@ -656,13 +654,13 @@ class AuthenticationSignOutViaTest < Devise::IntegrationTest
|
||||
test 'allow sign out via delete when sign_out_via provides delete and post' do
|
||||
sign_in!(:sign_out_via_delete_or_post)
|
||||
delete destroy_sign_out_via_delete_or_post_session_path
|
||||
refute warden.authenticated?(:sign_out_via_delete_or_post)
|
||||
assert_not warden.authenticated?(:sign_out_via_delete_or_post)
|
||||
end
|
||||
|
||||
test 'allow sign out via post when sign_out_via provides delete and post' do
|
||||
sign_in!(:sign_out_via_delete_or_post)
|
||||
post destroy_sign_out_via_delete_or_post_session_path
|
||||
refute warden.authenticated?(:sign_out_via_delete_or_post)
|
||||
assert_not warden.authenticated?(:sign_out_via_delete_or_post)
|
||||
end
|
||||
|
||||
test 'do not allow sign out via get when sign_out_via provides delete and post' do
|
||||
|
||||
@@ -43,12 +43,12 @@ class ConfirmationTest < Devise::IntegrationTest
|
||||
test 'user with valid confirmation token should not be able to confirm an account after the token has expired' do
|
||||
swap Devise, confirm_within: 3.days do
|
||||
user = create_user(confirm: false, confirmation_sent_at: 4.days.ago)
|
||||
refute user.confirmed?
|
||||
assert_not user.confirmed?
|
||||
visit_user_confirmation_with_token(user.raw_confirmation_token)
|
||||
|
||||
assert_have_selector '#error_explanation'
|
||||
assert_contain %r{needs to be confirmed within 3 days}
|
||||
refute user.reload.confirmed?
|
||||
assert_not user.reload.confirmed?
|
||||
assert_current_url "/users/confirmation?confirmation_token=#{user.raw_confirmation_token}"
|
||||
end
|
||||
end
|
||||
@@ -86,7 +86,7 @@ class ConfirmationTest < Devise::IntegrationTest
|
||||
test 'user with valid confirmation token should be able to confirm an account before the token has expired' do
|
||||
swap Devise, confirm_within: 3.days do
|
||||
user = create_user(confirm: false, confirmation_sent_at: 2.days.ago)
|
||||
refute user.confirmed?
|
||||
assert_not user.confirmed?
|
||||
visit_user_confirmation_with_token(user.raw_confirmation_token)
|
||||
|
||||
assert_contain 'Your email address has been successfully confirmed.'
|
||||
@@ -132,7 +132,16 @@ class ConfirmationTest < Devise::IntegrationTest
|
||||
sign_in_as_user(confirm: false)
|
||||
|
||||
assert_contain 'You have to confirm your email address before continuing'
|
||||
refute warden.authenticated?(:user)
|
||||
assert_not warden.authenticated?(:user)
|
||||
end
|
||||
end
|
||||
|
||||
test 'not confirmed user redirect respects i18n locale set' do
|
||||
swap Devise, allow_unconfirmed_access_for: 0.days do
|
||||
sign_in_as_user(confirm: false, visit: new_user_session_path(locale: "pt-BR"))
|
||||
|
||||
assert_contain 'Você precisa confirmar seu email para continuar'
|
||||
assert_not warden.authenticated?(:user)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -142,8 +151,8 @@ class ConfirmationTest < Devise::IntegrationTest
|
||||
fill_in 'password', with: 'invalid'
|
||||
end
|
||||
|
||||
assert_contain 'Invalid Email or password'
|
||||
refute warden.authenticated?(:user)
|
||||
assert_contain 'Invalid email or password'
|
||||
assert_not warden.authenticated?(:user)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -178,13 +187,13 @@ class ConfirmationTest < Devise::IntegrationTest
|
||||
test "should not be able to confirm an email with a blank confirmation token" do
|
||||
visit_user_confirmation_with_token("")
|
||||
|
||||
assert_contain "Confirmation token can't be blank"
|
||||
assert_contain %r{Confirmation token can['’]t be blank}
|
||||
end
|
||||
|
||||
test "should not be able to confirm an email with a nil confirmation token" do
|
||||
visit_user_confirmation_with_token(nil)
|
||||
|
||||
assert_contain "Confirmation token can't be blank"
|
||||
assert_contain %r{Confirmation token can['’]t be blank}
|
||||
end
|
||||
|
||||
test "should not be able to confirm user with blank confirmation token" do
|
||||
@@ -193,7 +202,7 @@ class ConfirmationTest < Devise::IntegrationTest
|
||||
|
||||
visit_user_confirmation_with_token("")
|
||||
|
||||
assert_contain "Confirmation token can't be blank"
|
||||
assert_contain %r{Confirmation token can['’]t be blank}
|
||||
end
|
||||
|
||||
test "should not be able to confirm user with nil confirmation token" do
|
||||
@@ -202,7 +211,7 @@ class ConfirmationTest < Devise::IntegrationTest
|
||||
|
||||
visit_user_confirmation_with_token(nil)
|
||||
|
||||
assert_contain "Confirmation token can't be blank"
|
||||
assert_contain %r{Confirmation token can['’]t be blank}
|
||||
end
|
||||
|
||||
test 'error message is configurable by resource name' do
|
||||
@@ -214,42 +223,34 @@ class ConfirmationTest < Devise::IntegrationTest
|
||||
end
|
||||
end
|
||||
|
||||
test 'resent confirmation token with valid E-Mail in XML format should return valid response' do
|
||||
test 'resent confirmation token with valid e-mail in JSON format should return empty and valid response' do
|
||||
user = create_user(confirm: false)
|
||||
post user_confirmation_path(format: 'xml'), params: { user: { email: user.email } }
|
||||
assert_response :success
|
||||
assert_equal({}.to_xml, response.body)
|
||||
end
|
||||
|
||||
test 'resent confirmation token with invalid E-Mail in XML format should return invalid response' do
|
||||
create_user(confirm: false)
|
||||
post user_confirmation_path(format: 'xml'), params: { user: { email: 'invalid.test@test.com' } }
|
||||
assert_response :unprocessable_entity
|
||||
assert_includes response.body, %(<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<errors>)
|
||||
end
|
||||
|
||||
test 'confirm account with valid confirmation token in XML format should return valid response' do
|
||||
user = create_user(confirm: false)
|
||||
get user_confirmation_path(confirmation_token: user.raw_confirmation_token, format: 'xml')
|
||||
assert_response :success
|
||||
assert_includes response.body, %(<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<user>)
|
||||
end
|
||||
|
||||
test 'confirm account with invalid confirmation token in XML format should return invalid response' do
|
||||
create_user(confirm: false)
|
||||
get user_confirmation_path(confirmation_token: 'invalid_confirmation', format: 'xml')
|
||||
assert_response :unprocessable_entity
|
||||
assert_includes response.body, %(<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<errors>)
|
||||
end
|
||||
|
||||
test 'request an account confirmation account with JSON, should return an empty JSON' do
|
||||
user = create_user(confirm: false)
|
||||
|
||||
post user_confirmation_path, params: { user: { email: user.email }, format: :json }
|
||||
post user_confirmation_path(format: 'json'), params: { user: { email: user.email } }
|
||||
assert_response :success
|
||||
assert_equal({}.to_json, response.body)
|
||||
end
|
||||
|
||||
test 'resent confirmation token with invalid e-mail in JSON format should return invalid response' do
|
||||
create_user(confirm: false)
|
||||
post user_confirmation_path(format: 'json'), params: { user: { email: 'invalid.test@test.com' } }
|
||||
assert_response :unprocessable_entity
|
||||
assert_includes response.body, '{"errors":{'
|
||||
end
|
||||
|
||||
test 'confirm account with valid confirmation token in JSON format should return valid response' do
|
||||
user = create_user(confirm: false)
|
||||
get user_confirmation_path(confirmation_token: user.raw_confirmation_token, format: 'json')
|
||||
assert_response :success
|
||||
assert_includes response.body, '{"user":{'
|
||||
end
|
||||
|
||||
test 'confirm account with invalid confirmation token in JSON format should return invalid response' do
|
||||
create_user(confirm: false)
|
||||
get user_confirmation_path(confirmation_token: 'invalid_confirmation', format: 'json')
|
||||
assert_response :unprocessable_entity
|
||||
assert_includes response.body, '{"confirmation_token":['
|
||||
end
|
||||
|
||||
test "when in paranoid mode and with a valid e-mail, should not say that the e-mail is valid" do
|
||||
swap Devise, paranoid: true do
|
||||
user = create_user(confirm: false)
|
||||
@@ -316,7 +317,7 @@ class ConfirmationOnChangeTest < Devise::IntegrationTest
|
||||
assert_contain 'Your email address has been successfully confirmed.'
|
||||
assert_current_url '/admin_area/sign_in'
|
||||
assert admin.reload.confirmed?
|
||||
refute admin.reload.pending_reconfirmation?
|
||||
assert_not admin.reload.pending_reconfirmation?
|
||||
end
|
||||
|
||||
test 'admin with previously valid confirmation token should not be able to confirm email after email changed again' do
|
||||
@@ -338,7 +339,7 @@ class ConfirmationOnChangeTest < Devise::IntegrationTest
|
||||
assert_contain 'Your email address has been successfully confirmed.'
|
||||
assert_current_url '/admin_area/sign_in'
|
||||
assert admin.reload.confirmed?
|
||||
refute admin.reload.pending_reconfirmation?
|
||||
assert_not admin.reload.pending_reconfirmation?
|
||||
end
|
||||
|
||||
test 'admin email should be unique also within unconfirmed_email' do
|
||||
|
||||
@@ -21,7 +21,7 @@ class DatabaseAuthenticationTest < Devise::IntegrationTest
|
||||
fill_in 'email', with: 'foo@bar.com'
|
||||
end
|
||||
|
||||
refute warden.authenticated?(:user)
|
||||
assert_not warden.authenticated?(:user)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -43,14 +43,14 @@ class DatabaseAuthenticationTest < Devise::IntegrationTest
|
||||
fill_in 'email', with: ' foo@bar.com '
|
||||
end
|
||||
|
||||
refute warden.authenticated?(:user)
|
||||
assert_not warden.authenticated?(:user)
|
||||
end
|
||||
end
|
||||
|
||||
test 'sign in should not authenticate if not using proper authentication keys' do
|
||||
swap Devise, authentication_keys: [:username] do
|
||||
sign_in_as_user
|
||||
refute warden.authenticated?(:user)
|
||||
assert_not warden.authenticated?(:user)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -61,7 +61,7 @@ class DatabaseAuthenticationTest < Devise::IntegrationTest
|
||||
end
|
||||
|
||||
assert_contain 'Invalid email address'
|
||||
refute warden.authenticated?(:admin)
|
||||
assert_not warden.authenticated?(:admin)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -70,8 +70,8 @@ class DatabaseAuthenticationTest < Devise::IntegrationTest
|
||||
fill_in 'password', with: 'abcdef'
|
||||
end
|
||||
|
||||
assert_contain 'Invalid Email or password'
|
||||
refute warden.authenticated?(:admin)
|
||||
assert_contain 'Invalid email or password'
|
||||
assert_not warden.authenticated?(:admin)
|
||||
end
|
||||
|
||||
test 'when in paranoid mode and without a valid e-mail' do
|
||||
@@ -82,7 +82,7 @@ class DatabaseAuthenticationTest < Devise::IntegrationTest
|
||||
end
|
||||
|
||||
assert_not_contain 'Not found in database'
|
||||
assert_contain 'Invalid Email or password.'
|
||||
assert_contain 'Invalid email or password.'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -6,7 +6,7 @@ class HttpAuthenticationTest < Devise::IntegrationTest
|
||||
test 'sign in with HTTP should not run model validations' do
|
||||
sign_in_as_new_user_with_http
|
||||
|
||||
refute User.validations_performed
|
||||
assert_not User.validations_performed
|
||||
end
|
||||
|
||||
test 'handles unverified requests gets rid of caches but continues signed in' do
|
||||
@@ -22,10 +22,10 @@ class HttpAuthenticationTest < Devise::IntegrationTest
|
||||
swap Devise, skip_session_storage: [] do
|
||||
sign_in_as_new_user_with_http
|
||||
assert_response 200
|
||||
assert_match '<email>user@test.com</email>', response.body
|
||||
assert_match '"email":"user@test.com"', response.body
|
||||
assert warden.authenticated?(:user)
|
||||
|
||||
get users_path(format: :xml)
|
||||
get users_path(format: :json)
|
||||
assert_response 200
|
||||
end
|
||||
end
|
||||
@@ -34,10 +34,10 @@ class HttpAuthenticationTest < Devise::IntegrationTest
|
||||
swap Devise, skip_session_storage: [:http_auth] do
|
||||
sign_in_as_new_user_with_http
|
||||
assert_response 200
|
||||
assert_match '<email>user@test.com</email>', response.body
|
||||
assert_match '"email":"user@test.com"', response.body
|
||||
assert warden.authenticated?(:user)
|
||||
|
||||
get users_path(format: :xml)
|
||||
get users_path(format: :json)
|
||||
assert_response 401
|
||||
end
|
||||
end
|
||||
@@ -51,8 +51,8 @@ class HttpAuthenticationTest < Devise::IntegrationTest
|
||||
test 'uses the request format as response content type' do
|
||||
sign_in_as_new_user_with_http("unknown")
|
||||
assert_equal 401, status
|
||||
assert_equal "application/xml; charset=utf-8", headers["Content-Type"]
|
||||
assert_match "<error>Invalid Email or password.</error>", response.body
|
||||
assert_equal "application/json; charset=utf-8", headers["Content-Type"]
|
||||
assert_match '"error":"Invalid email or password."', response.body
|
||||
end
|
||||
|
||||
test 'returns a custom response with www-authenticate and chosen realm' do
|
||||
@@ -67,7 +67,7 @@ class HttpAuthenticationTest < Devise::IntegrationTest
|
||||
swap Devise, authentication_keys: [:username] do
|
||||
sign_in_as_new_user_with_http("usertest")
|
||||
assert_response :success
|
||||
assert_match '<email>user@test.com</email>', response.body
|
||||
assert_match '"email":"user@test.com"', response.body
|
||||
assert warden.authenticated?(:user)
|
||||
end
|
||||
end
|
||||
@@ -76,7 +76,7 @@ class HttpAuthenticationTest < Devise::IntegrationTest
|
||||
swap Devise, authentication_keys: { username: false, email: false } do
|
||||
sign_in_as_new_user_with_http("usertest")
|
||||
assert_response :success
|
||||
assert_match '<email>user@test.com</email>', response.body
|
||||
assert_match '"email":"user@test.com"', response.body
|
||||
assert warden.authenticated?(:user)
|
||||
end
|
||||
end
|
||||
@@ -85,7 +85,7 @@ class HttpAuthenticationTest < Devise::IntegrationTest
|
||||
swap Devise, authentication_keys: { email: false, username: false }, http_authentication_key: :username do
|
||||
sign_in_as_new_user_with_http("usertest")
|
||||
assert_response :success
|
||||
assert_match '<email>user@test.com</email>', response.body
|
||||
assert_match '"email":"user@test.com"', response.body
|
||||
assert warden.authenticated?(:user)
|
||||
end
|
||||
end
|
||||
@@ -101,14 +101,13 @@ class HttpAuthenticationTest < Devise::IntegrationTest
|
||||
private
|
||||
def sign_in_as_new_user_with_http(username = "user@test.com", password = "12345678")
|
||||
user = create_user
|
||||
get users_path(format: :xml), headers: { "HTTP_AUTHORIZATION" => "Basic #{Base64.encode64("#{username}:#{password}")}" }
|
||||
get users_path(format: :json), headers: { "HTTP_AUTHORIZATION" => "Basic #{Base64.encode64("#{username}:#{password}")}" }
|
||||
user
|
||||
end
|
||||
|
||||
# Sign in with oauth2 token. This is just to test that it isn't misinterpreted as basic authentication
|
||||
def add_oauth2_header
|
||||
user = create_user
|
||||
get users_path(format: :xml), headers: { "HTTP_AUTHORIZATION" => "OAuth #{Base64.encode64("#{user.email}:12345678")}" }
|
||||
get users_path(format: :json), headers: { "HTTP_AUTHORIZATION" => "OAuth #{Base64.encode64("#{user.email}:12345678")}" }
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -87,7 +87,7 @@ class LockTest < Devise::IntegrationTest
|
||||
|
||||
assert_current_url "/users/sign_in"
|
||||
assert_contain 'Your account has been unlocked successfully. Please sign in to continue.'
|
||||
refute user.reload.access_locked?
|
||||
assert_not user.reload.access_locked?
|
||||
end
|
||||
|
||||
test "user should not send a new e-mail if already locked" do
|
||||
@@ -130,46 +130,39 @@ class LockTest < Devise::IntegrationTest
|
||||
end
|
||||
end
|
||||
|
||||
test 'user should be able to request a new unlock token via XML request' do
|
||||
test 'user should be able to request a new unlock token via JSON request and should return empty and valid response' do
|
||||
user = create_user(locked: true)
|
||||
ActionMailer::Base.deliveries.clear
|
||||
|
||||
post user_unlock_path(format: 'xml'), params: { user: {email: user.email} }
|
||||
post user_unlock_path(format: 'json'), params: { user: {email: user.email} }
|
||||
assert_response :success
|
||||
assert_equal({}.to_xml, response.body)
|
||||
assert_equal({}.to_json, response.body)
|
||||
assert_equal 1, ActionMailer::Base.deliveries.size
|
||||
end
|
||||
|
||||
test 'unlocked user should not be able to request a unlock token via XML request' do
|
||||
test 'unlocked user should not be able to request a unlock token via JSON request' do
|
||||
user = create_user(locked: false)
|
||||
ActionMailer::Base.deliveries.clear
|
||||
|
||||
post user_unlock_path(format: 'xml'), params: { user: {email: user.email} }
|
||||
post user_unlock_path(format: 'json'), params: { user: {email: user.email} }
|
||||
assert_response :unprocessable_entity
|
||||
assert_includes response.body, %(<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<errors>)
|
||||
assert_includes response.body, '{"errors":{'
|
||||
assert_equal 0, ActionMailer::Base.deliveries.size
|
||||
end
|
||||
|
||||
test 'user with valid unlock token should be able to unlock account via XML request' do
|
||||
test 'user with valid unlock token should be able to unlock account via JSON request' do
|
||||
user = create_user()
|
||||
raw = user.lock_access!
|
||||
assert user.access_locked?
|
||||
get user_unlock_path(format: 'xml', unlock_token: raw)
|
||||
get user_unlock_path(format: 'json', unlock_token: raw)
|
||||
assert_response :success
|
||||
assert_includes response.body, %(<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<user>)
|
||||
assert_includes response.body, '{"user":{'
|
||||
end
|
||||
|
||||
test 'user with invalid unlock token should not be able to unlock the account via XML request' do
|
||||
get user_unlock_path(format: 'xml', unlock_token: 'invalid_token')
|
||||
test 'user with invalid unlock token should not be able to unlock the account via JSON request' do
|
||||
get user_unlock_path(format: 'json', unlock_token: 'invalid_token')
|
||||
assert_response :unprocessable_entity
|
||||
assert_includes response.body, %(<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<errors>)
|
||||
end
|
||||
|
||||
test "when using json to ask a unlock request, should not return the user" do
|
||||
user = create_user(locked: true)
|
||||
post user_unlock_path(format: "json", user: {email: user.email})
|
||||
assert_response :success
|
||||
assert_equal({}.to_json, response.body)
|
||||
assert_includes response.body, '{"unlock_token":['
|
||||
end
|
||||
|
||||
test "in paranoid mode, when trying to unlock a user that exists it should not say that it exists if it is locked" do
|
||||
|
||||
@@ -23,6 +23,9 @@ class OmniauthableIntegrationTest < Devise::IntegrationTest
|
||||
"extra" => {"user_hash" => FACEBOOK_INFO}
|
||||
}
|
||||
OmniAuth.config.add_camelization 'facebook', 'FaceBook'
|
||||
if OmniAuth.config.respond_to?(:request_validation_phase)
|
||||
OmniAuth.config.request_validation_phase = ->(env) {}
|
||||
end
|
||||
end
|
||||
|
||||
teardown do
|
||||
@@ -45,17 +48,17 @@ class OmniauthableIntegrationTest < Devise::IntegrationTest
|
||||
test "omniauth sign in should not run model validations" do
|
||||
stub_action!(:sign_in_facebook) do
|
||||
create_user
|
||||
visit "/users/sign_in"
|
||||
click_link "Sign in with FaceBook"
|
||||
post "/users/auth/facebook"
|
||||
follow_redirect!
|
||||
assert warden.authenticated?(:user)
|
||||
|
||||
refute User.validations_performed
|
||||
assert_not User.validations_performed
|
||||
end
|
||||
end
|
||||
|
||||
test "can access omniauth.auth in the env hash" do
|
||||
visit "/users/sign_in"
|
||||
click_link "Sign in with FaceBook"
|
||||
post "/users/auth/facebook"
|
||||
follow_redirect!
|
||||
|
||||
json = ActiveSupport::JSON.decode(response.body)
|
||||
|
||||
@@ -68,8 +71,8 @@ class OmniauthableIntegrationTest < Devise::IntegrationTest
|
||||
|
||||
test "cleans up session on sign up" do
|
||||
assert_no_difference "User.count" do
|
||||
visit "/users/sign_in"
|
||||
click_link "Sign in with FaceBook"
|
||||
post "/users/auth/facebook"
|
||||
follow_redirect!
|
||||
end
|
||||
|
||||
assert session["devise.facebook_data"]
|
||||
@@ -84,49 +87,80 @@ class OmniauthableIntegrationTest < Devise::IntegrationTest
|
||||
assert_current_url "/"
|
||||
assert_contain "You have signed up successfully."
|
||||
assert_contain "Hello User user@example.com"
|
||||
refute session["devise.facebook_data"]
|
||||
assert_not session["devise.facebook_data"]
|
||||
end
|
||||
|
||||
test "cleans up session on cancel" do
|
||||
assert_no_difference "User.count" do
|
||||
visit "/users/sign_in"
|
||||
click_link "Sign in with FaceBook"
|
||||
post "/users/auth/facebook"
|
||||
follow_redirect!
|
||||
end
|
||||
|
||||
assert session["devise.facebook_data"]
|
||||
visit "/users/cancel"
|
||||
assert !session["devise.facebook_data"]
|
||||
assert_not session["devise.facebook_data"]
|
||||
end
|
||||
|
||||
test "cleans up session on sign in" do
|
||||
assert_no_difference "User.count" do
|
||||
visit "/users/sign_in"
|
||||
click_link "Sign in with FaceBook"
|
||||
post "/users/auth/facebook"
|
||||
follow_redirect!
|
||||
end
|
||||
|
||||
assert session["devise.facebook_data"]
|
||||
sign_in_as_user
|
||||
assert !session["devise.facebook_data"]
|
||||
assert_not session["devise.facebook_data"]
|
||||
end
|
||||
|
||||
test "sign in and send remember token if configured" do
|
||||
visit "/users/sign_in"
|
||||
click_link "Sign in with FaceBook"
|
||||
post "/users/auth/facebook"
|
||||
follow_redirect!
|
||||
assert_nil warden.cookies["remember_user_token"]
|
||||
|
||||
stub_action!(:sign_in_facebook) do
|
||||
create_user
|
||||
visit "/users/sign_in"
|
||||
click_link "Sign in with FaceBook"
|
||||
post "/users/auth/facebook"
|
||||
follow_redirect!
|
||||
assert warden.authenticated?(:user)
|
||||
assert warden.cookies["remember_user_token"]
|
||||
end
|
||||
end
|
||||
|
||||
test "authorization path via GET when Omniauth allowed_request_methods includes GET" do
|
||||
original_allowed = OmniAuth.config.allowed_request_methods
|
||||
OmniAuth.config.allowed_request_methods = [:get, :post]
|
||||
|
||||
get "/users/auth/facebook"
|
||||
|
||||
assert_response(:redirect)
|
||||
ensure
|
||||
OmniAuth.config.allowed_request_methods = original_allowed
|
||||
end
|
||||
|
||||
test "authorization path via GET when Omniauth allowed_request_methods doesn't include GET" do
|
||||
original_allowed = OmniAuth.config.allowed_request_methods
|
||||
OmniAuth.config.allowed_request_methods = [:post]
|
||||
|
||||
assert_raises(ActionController::RoutingError) do
|
||||
get "/users/auth/facebook"
|
||||
end
|
||||
ensure
|
||||
OmniAuth.config.allowed_request_methods = original_allowed
|
||||
end
|
||||
|
||||
test "generates a link to authenticate with provider" do
|
||||
visit "/users/sign_in"
|
||||
assert_select "form[action=?][method=post]", "/users/auth/facebook" do
|
||||
assert_select "input[type=submit][value=?]", "Sign in with FaceBook"
|
||||
end
|
||||
end
|
||||
|
||||
test "generates a proper link when SCRIPT_NAME is set" do
|
||||
header 'SCRIPT_NAME', '/q'
|
||||
visit "/users/sign_in"
|
||||
assert_select "a", href: "/q/users/auth/facebook"
|
||||
assert_select "form[action=?][method=post]", "/q/users/auth/facebook" do
|
||||
assert_select "input[type=submit][value=?]", "Sign in with FaceBook"
|
||||
end
|
||||
end
|
||||
|
||||
test "handles callback error parameter according to the specification" do
|
||||
@@ -139,10 +173,10 @@ class OmniauthableIntegrationTest < Devise::IntegrationTest
|
||||
test "handles other exceptions from OmniAuth" do
|
||||
OmniAuth.config.mock_auth[:facebook] = :invalid_credentials
|
||||
|
||||
visit "/users/sign_in"
|
||||
click_link "Sign in with FaceBook"
|
||||
post "/users/auth/facebook"
|
||||
follow_redirect!
|
||||
follow_redirect!
|
||||
|
||||
assert_current_url "/users/sign_in"
|
||||
assert_contain 'Could not authenticate you from FaceBook because "Invalid credentials".'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -12,13 +12,13 @@ class PasswordTest < Devise::IntegrationTest
|
||||
def request_forgot_password(&block)
|
||||
visit_new_password_path
|
||||
assert_response :success
|
||||
refute warden.authenticated?(:user)
|
||||
assert_not warden.authenticated?(:user)
|
||||
|
||||
fill_in 'email', with: 'user@test.com'
|
||||
yield if block_given?
|
||||
|
||||
Devise.stubs(:friendly_token).returns("abcdef")
|
||||
click_button 'Send me reset password instructions'
|
||||
click_button 'Send me password reset instructions'
|
||||
end
|
||||
|
||||
def reset_password(options = {}, &block)
|
||||
@@ -160,7 +160,7 @@ class PasswordTest < Devise::IntegrationTest
|
||||
assert_current_url '/users/password'
|
||||
assert_have_selector '#error_explanation'
|
||||
assert_contain %r{Reset password token(.*)invalid}
|
||||
refute user.reload.valid_password?('987654321')
|
||||
assert_not user.reload.valid_password?('987654321')
|
||||
end
|
||||
|
||||
test 'not authenticated user with valid reset password token but invalid password should not be able to change their password' do
|
||||
@@ -173,8 +173,8 @@ class PasswordTest < Devise::IntegrationTest
|
||||
assert_response :success
|
||||
assert_current_url '/users/password'
|
||||
assert_have_selector '#error_explanation'
|
||||
assert_contain "Password confirmation doesn't match Password"
|
||||
refute user.reload.valid_password?('987654321')
|
||||
assert_contain %r{Password confirmation doesn['’]t match Password}
|
||||
assert_not user.reload.valid_password?('987654321')
|
||||
end
|
||||
|
||||
test 'not authenticated user with valid data should be able to change their password' do
|
||||
@@ -194,7 +194,7 @@ class PasswordTest < Devise::IntegrationTest
|
||||
reset_password { fill_in 'Confirm new password', with: 'other_password' }
|
||||
assert_response :success
|
||||
assert_have_selector '#error_explanation'
|
||||
refute user.reload.valid_password?('987654321')
|
||||
assert_not user.reload.valid_password?('987654321')
|
||||
|
||||
reset_password visit: false
|
||||
assert_contain 'Your password has been changed successfully.'
|
||||
@@ -218,7 +218,32 @@ class PasswordTest < Devise::IntegrationTest
|
||||
assert_contain 'Your password has been changed successfully.'
|
||||
assert_not_contain 'You are now signed in.'
|
||||
assert_equal new_user_session_path, @request.path
|
||||
assert !warden.authenticated?(:user)
|
||||
assert_not warden.authenticated?(:user)
|
||||
end
|
||||
end
|
||||
|
||||
test 'does not sign in user automatically after changing its password if resource_class.sign_in_after_reset_password is false' do
|
||||
swap_model_config User, sign_in_after_reset_password: false do
|
||||
create_user
|
||||
request_forgot_password
|
||||
reset_password
|
||||
|
||||
assert_contain 'Your password has been changed successfully'
|
||||
assert_not_contain 'You are now signed in.'
|
||||
assert_equal new_user_session_path, @request.path
|
||||
assert_not warden.authenticated?(:user)
|
||||
end
|
||||
end
|
||||
|
||||
test 'sign in user automatically after changing its password if resource_class.sign_in_after_reset_password is true' do
|
||||
swap Devise, sign_in_after_reset_password: false do
|
||||
swap_model_config User, sign_in_after_reset_password: true do
|
||||
create_user
|
||||
request_forgot_password
|
||||
reset_password
|
||||
|
||||
assert warden.authenticated?(:user)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -232,7 +257,7 @@ class PasswordTest < Devise::IntegrationTest
|
||||
assert_contain 'Your password has been changed successfully.'
|
||||
assert_not_contain 'You are now signed in.'
|
||||
assert_equal new_user_session_path, @request.path
|
||||
assert !warden.authenticated?(:user)
|
||||
assert_not warden.authenticated?(:user)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -244,7 +269,7 @@ class PasswordTest < Devise::IntegrationTest
|
||||
reset_password
|
||||
|
||||
assert_contain 'Your password has been changed successfully.'
|
||||
assert !user.reload.access_locked?
|
||||
assert_not user.reload.access_locked?
|
||||
assert warden.authenticated?(:user)
|
||||
end
|
||||
end
|
||||
@@ -256,75 +281,65 @@ class PasswordTest < Devise::IntegrationTest
|
||||
reset_password
|
||||
|
||||
assert_contain 'Your password has been changed successfully.'
|
||||
assert !user.reload.access_locked?
|
||||
assert_not user.reload.access_locked?
|
||||
assert warden.authenticated?(:user)
|
||||
end
|
||||
end
|
||||
|
||||
test 'reset password request with valid E-Mail in XML format should return valid response' do
|
||||
test 'reset password request with valid e-mail in JSON format should return empty and valid response' do
|
||||
create_user
|
||||
post user_password_path(format: 'xml'), params: { user: {email: "user@test.com"} }
|
||||
post user_password_path(format: 'json'), params: { user: {email: "user@test.com"} }
|
||||
assert_response :success
|
||||
assert_equal({}.to_xml, response.body)
|
||||
assert_equal({}.to_json, response.body)
|
||||
end
|
||||
|
||||
test 'reset password request with invalid E-Mail in XML format should return valid response' do
|
||||
test 'reset password request with invalid e-mail in JSON format should return valid response' do
|
||||
create_user
|
||||
post user_password_path(format: 'xml'), params: { user: {email: "invalid.test@test.com"} }
|
||||
post user_password_path(format: 'json'), params: { user: {email: "invalid.test@test.com"} }
|
||||
assert_response :unprocessable_entity
|
||||
assert_includes response.body, %(<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<errors>)
|
||||
assert_includes response.body, '{"errors":{'
|
||||
end
|
||||
|
||||
test 'reset password request with invalid E-Mail in XML format should return empty and valid response' do
|
||||
test 'reset password request with invalid e-mail in JSON format should return empty and valid response in paranoid mode' do
|
||||
swap Devise, paranoid: true do
|
||||
create_user
|
||||
post user_password_path(format: 'xml'), params: { user: {email: "invalid@test.com"} }
|
||||
post user_password_path(format: 'json'), params: { user: {email: "invalid@test.com"} }
|
||||
assert_response :success
|
||||
assert_equal({}.to_xml, response.body)
|
||||
assert_equal({}.to_json, response.body)
|
||||
end
|
||||
end
|
||||
|
||||
test 'change password with valid parameters in XML format should return valid response' do
|
||||
test 'change password with valid parameters in JSON format should return valid response' do
|
||||
create_user
|
||||
request_forgot_password
|
||||
put user_password_path(format: 'xml'), params: { user: {
|
||||
put user_password_path(format: 'json'), params: { user: {
|
||||
reset_password_token: 'abcdef', password: '987654321', password_confirmation: '987654321'
|
||||
}
|
||||
}
|
||||
} }
|
||||
assert_response :success
|
||||
assert warden.authenticated?(:user)
|
||||
end
|
||||
|
||||
test 'change password with invalid token in XML format should return invalid response' do
|
||||
test 'change password with invalid token in JSON format should return invalid response' do
|
||||
create_user
|
||||
request_forgot_password
|
||||
put user_password_path(format: 'xml'), params: { user: {reset_password_token: 'invalid.token', password: '987654321', password_confirmation: '987654321'} }
|
||||
put user_password_path(format: 'json'), params: { user: {reset_password_token: 'invalid.token', password: '987654321', password_confirmation: '987654321'} }
|
||||
assert_response :unprocessable_entity
|
||||
assert_includes response.body, %(<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<errors>)
|
||||
assert_includes response.body, '{"errors":{'
|
||||
end
|
||||
|
||||
test 'change password with invalid new password in XML format should return invalid response' do
|
||||
test 'change password with invalid new password in JSON format should return invalid response' do
|
||||
user = create_user
|
||||
request_forgot_password
|
||||
put user_password_path(format: 'xml'), params: { user: {reset_password_token: user.reload.reset_password_token, password: '', password_confirmation: '987654321'} }
|
||||
put user_password_path(format: 'json'), params: { user: {reset_password_token: user.reload.reset_password_token, password: '', password_confirmation: '987654321'} }
|
||||
assert_response :unprocessable_entity
|
||||
assert_includes response.body, %(<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<errors>)
|
||||
end
|
||||
|
||||
test "when using json requests to ask a confirmable request, should not return the object" do
|
||||
user = create_user(confirm: false)
|
||||
|
||||
post user_password_path(format: :json), params: { user: { email: user.email } }
|
||||
|
||||
assert_response :success
|
||||
assert_equal "{}", response.body
|
||||
assert_includes response.body, '{"errors":{'
|
||||
end
|
||||
|
||||
test "when in paranoid mode and with an invalid e-mail, asking to reset a password should display a message that does not indicates that the e-mail does not exists in the database" do
|
||||
swap Devise, paranoid: true do
|
||||
visit_new_password_path
|
||||
fill_in "email", with: "arandomemail@test.com"
|
||||
click_button 'Send me reset password instructions'
|
||||
click_button 'Send me password reset instructions'
|
||||
|
||||
assert_not_contain "1 error prohibited this user from being saved:"
|
||||
assert_not_contain "Email not found"
|
||||
@@ -338,7 +353,7 @@ class PasswordTest < Devise::IntegrationTest
|
||||
user = create_user
|
||||
visit_new_password_path
|
||||
fill_in 'email', with: user.email
|
||||
click_button 'Send me reset password instructions'
|
||||
click_button 'Send me password reset instructions'
|
||||
|
||||
assert_contain "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
|
||||
assert_current_url "/users/sign_in"
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user