clearance 2.2.1 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of clearance might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.erb-lint.yml +5 -0
- data/Appraisals +14 -19
- data/Gemfile +11 -7
- data/Gemfile.lock +65 -20
- data/NEWS.md +16 -0
- data/README.md +1 -18
- data/RELEASING.md +25 -0
- data/Rakefile +6 -1
- data/app/controllers/clearance/passwords_controller.rb +1 -2
- data/app/views/clearance_mailer/change_password.html.erb +2 -2
- data/app/views/clearance_mailer/change_password.text.erb +2 -2
- data/gemfiles/rails_5.0.gemfile +10 -9
- data/gemfiles/rails_5.1.gemfile +11 -10
- data/gemfiles/rails_5.2.gemfile +11 -10
- data/gemfiles/rails_6.0.gemfile +11 -10
- data/lib/clearance/back_door.rb +2 -1
- data/lib/clearance/password_strategies.rb +0 -4
- data/lib/clearance/session.rb +1 -1
- data/lib/clearance/version.rb +1 -1
- data/spec/clearance/back_door_spec.rb +20 -4
- data/spec/clearance/session_spec.rb +19 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 777ea26a3647f9d843995457a9fc073036fe60c7e3119c97a063345fbe85a7df
|
4
|
+
data.tar.gz: c57adcad1e84434b6ffc9dc6e4af275d14b1c4844736536ecf32ee00180f4429
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb8a5c80c163df705026f5ebbfde61ed51475abe3ce24681dce56bbdb4394b37cf491e4ec8aecf33c00d4cc11f1a8826afd45c49a3465864d825da5b651d8e64
|
7
|
+
data.tar.gz: 3f24bdba4f83baf3a62ec80457a62e4d8dccec82f1f5b2f37d4b9514badffde150dc2b85b6e207a91a875264a85e679da49a9fb38e22c898bcfb1d200f537161
|
data/.erb-lint.yml
ADDED
data/Appraisals
CHANGED
@@ -1,23 +1,18 @@
|
|
1
|
-
|
2
|
-
5.0
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
1
|
+
appraise "rails_5.0" do
|
2
|
+
gem "railties", "~> 5.0"
|
3
|
+
gem 'rspec-rails', '~> 3.1'
|
4
|
+
gem 'capybara', '>= 2.6.2', '< 3.33.0'
|
5
|
+
gem 'sqlite3', '~> 1.3.13'
|
6
|
+
end
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
gem "rails-controller-testing"
|
8
|
+
appraise "rails_5.1" do
|
9
|
+
gem "railties", "~> 5.1"
|
10
|
+
end
|
12
11
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
gem 'sqlite3', '~> 1.4.0'
|
17
|
-
else
|
18
|
-
gem 'sqlite3', '~> 1.3.13'
|
19
|
-
gem 'rspec-rails', '~> 3.1'
|
20
|
-
end
|
12
|
+
appraise "rails_5.2" do
|
13
|
+
gem "railties", "~> 5.2"
|
14
|
+
end
|
21
15
|
|
22
|
-
|
16
|
+
appraise "rails_6.0" do
|
17
|
+
gem "railties", "~> 6.0"
|
23
18
|
end
|
data/Gemfile
CHANGED
@@ -2,13 +2,17 @@ source 'https://rubygems.org'
|
|
2
2
|
|
3
3
|
gemspec
|
4
4
|
|
5
|
-
gem 'addressable'
|
5
|
+
gem 'addressable'
|
6
6
|
gem 'ammeter'
|
7
7
|
gem 'appraisal'
|
8
|
-
gem 'capybara'
|
9
|
-
gem 'database_cleaner'
|
10
|
-
gem '
|
11
|
-
gem '
|
8
|
+
gem 'capybara'
|
9
|
+
gem 'database_cleaner'
|
10
|
+
gem 'erb_lint', require: false
|
11
|
+
gem 'factory_bot_rails'
|
12
|
+
gem 'nokogiri'
|
12
13
|
gem 'pry', require: false
|
13
|
-
gem '
|
14
|
-
gem '
|
14
|
+
gem 'rails-controller-testing'
|
15
|
+
gem 'rspec-rails'
|
16
|
+
gem 'shoulda-matchers'
|
17
|
+
gem 'sqlite3'
|
18
|
+
gem 'timecop'
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
clearance (2.
|
4
|
+
clearance (2.3.0)
|
5
5
|
actionmailer (>= 5.0)
|
6
6
|
activemodel (>= 5.0)
|
7
7
|
activerecord (>= 5.0)
|
@@ -46,8 +46,8 @@ GEM
|
|
46
46
|
minitest (~> 5.1)
|
47
47
|
tzinfo (~> 1.1)
|
48
48
|
zeitwerk (~> 2.2, >= 2.2.2)
|
49
|
-
addressable (2.
|
50
|
-
public_suffix (>= 2.0.2, <
|
49
|
+
addressable (2.7.0)
|
50
|
+
public_suffix (>= 2.0.2, < 5.0)
|
51
51
|
ammeter (1.1.4)
|
52
52
|
activesupport (>= 3.0)
|
53
53
|
railties (>= 3.0)
|
@@ -59,7 +59,16 @@ GEM
|
|
59
59
|
argon2 (2.0.2)
|
60
60
|
ffi (~> 1.9)
|
61
61
|
ffi-compiler (>= 0.1)
|
62
|
-
|
62
|
+
ast (2.4.1)
|
63
|
+
bcrypt (3.1.15)
|
64
|
+
better_html (1.0.15)
|
65
|
+
actionview (>= 4.0)
|
66
|
+
activesupport (>= 4.0)
|
67
|
+
ast (~> 2.0)
|
68
|
+
erubi (~> 1.4)
|
69
|
+
html_tokenizer (~> 0.0.6)
|
70
|
+
parser (>= 2.4)
|
71
|
+
smart_properties
|
63
72
|
builder (3.2.4)
|
64
73
|
capybara (3.33.0)
|
65
74
|
addressable
|
@@ -76,19 +85,27 @@ GEM
|
|
76
85
|
diff-lcs (1.4.4)
|
77
86
|
email_validator (2.0.1)
|
78
87
|
activemodel
|
88
|
+
erb_lint (0.0.34)
|
89
|
+
activesupport
|
90
|
+
better_html (~> 1.0.7)
|
91
|
+
html_tokenizer
|
92
|
+
rainbow
|
93
|
+
rubocop (~> 0.79)
|
94
|
+
smart_properties
|
79
95
|
erubi (1.9.0)
|
80
|
-
factory_bot (
|
81
|
-
activesupport (>=
|
82
|
-
factory_bot_rails (
|
83
|
-
factory_bot (~>
|
84
|
-
railties (>=
|
96
|
+
factory_bot (6.1.0)
|
97
|
+
activesupport (>= 5.0.0)
|
98
|
+
factory_bot_rails (6.1.0)
|
99
|
+
factory_bot (~> 6.1.0)
|
100
|
+
railties (>= 5.0.0)
|
85
101
|
ffi (1.13.1)
|
86
102
|
ffi-compiler (1.0.1)
|
87
103
|
ffi (>= 1.0.0)
|
88
104
|
rake
|
89
105
|
globalid (0.4.2)
|
90
106
|
activesupport (>= 4.2.0)
|
91
|
-
|
107
|
+
html_tokenizer (0.0.7)
|
108
|
+
i18n (1.8.5)
|
92
109
|
concurrent-ruby (~> 1.0)
|
93
110
|
loofah (2.6.0)
|
94
111
|
crass (~> 1.0.2)
|
@@ -101,13 +118,20 @@ GEM
|
|
101
118
|
minitest (5.14.1)
|
102
119
|
nokogiri (1.10.10)
|
103
120
|
mini_portile2 (~> 2.4.0)
|
121
|
+
parallel (1.19.2)
|
122
|
+
parser (2.7.1.4)
|
123
|
+
ast (~> 2.4.1)
|
104
124
|
pry (0.13.1)
|
105
125
|
coderay (~> 1.1)
|
106
126
|
method_source (~> 1.0)
|
107
|
-
public_suffix (
|
127
|
+
public_suffix (4.0.5)
|
108
128
|
rack (2.2.3)
|
109
129
|
rack-test (1.1.0)
|
110
130
|
rack (>= 1.0, < 3)
|
131
|
+
rails-controller-testing (1.0.5)
|
132
|
+
actionpack (>= 5.0.1.rc1)
|
133
|
+
actionview (>= 5.0.1.rc1)
|
134
|
+
activesupport (>= 5.0.1.rc1)
|
111
135
|
rails-dom-testing (2.0.3)
|
112
136
|
activesupport (>= 4.2.0)
|
113
137
|
nokogiri (>= 1.6)
|
@@ -119,8 +143,10 @@ GEM
|
|
119
143
|
method_source
|
120
144
|
rake (>= 0.8.7)
|
121
145
|
thor (>= 0.20.3, < 2.0)
|
146
|
+
rainbow (3.0.0)
|
122
147
|
rake (13.0.1)
|
123
148
|
regexp_parser (1.7.1)
|
149
|
+
rexml (3.2.4)
|
124
150
|
rspec-core (3.9.2)
|
125
151
|
rspec-support (~> 3.9.3)
|
126
152
|
rspec-expectations (3.9.2)
|
@@ -138,32 +164,51 @@ GEM
|
|
138
164
|
rspec-mocks (~> 3.9)
|
139
165
|
rspec-support (~> 3.9)
|
140
166
|
rspec-support (3.9.3)
|
167
|
+
rubocop (0.88.0)
|
168
|
+
parallel (~> 1.10)
|
169
|
+
parser (>= 2.7.1.1)
|
170
|
+
rainbow (>= 2.2.2, < 4.0)
|
171
|
+
regexp_parser (>= 1.7)
|
172
|
+
rexml
|
173
|
+
rubocop-ast (>= 0.1.0, < 1.0)
|
174
|
+
ruby-progressbar (~> 1.7)
|
175
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
176
|
+
rubocop-ast (0.3.0)
|
177
|
+
parser (>= 2.7.1.4)
|
178
|
+
ruby-progressbar (1.10.1)
|
141
179
|
shoulda-matchers (4.3.0)
|
142
180
|
activesupport (>= 4.2.0)
|
181
|
+
smart_properties (1.15.0)
|
182
|
+
sqlite3 (1.4.2)
|
143
183
|
thor (1.0.1)
|
144
184
|
thread_safe (0.3.6)
|
145
185
|
timecop (0.9.1)
|
146
186
|
tzinfo (1.2.7)
|
147
187
|
thread_safe (~> 0.1)
|
188
|
+
unicode-display_width (1.7.0)
|
148
189
|
xpath (3.2.0)
|
149
190
|
nokogiri (~> 1.8)
|
150
|
-
zeitwerk (2.
|
191
|
+
zeitwerk (2.4.0)
|
151
192
|
|
152
193
|
PLATFORMS
|
153
194
|
ruby
|
154
195
|
|
155
196
|
DEPENDENCIES
|
156
|
-
addressable
|
197
|
+
addressable
|
157
198
|
ammeter
|
158
199
|
appraisal
|
159
|
-
capybara
|
200
|
+
capybara
|
160
201
|
clearance!
|
161
|
-
database_cleaner
|
162
|
-
|
163
|
-
|
202
|
+
database_cleaner
|
203
|
+
erb_lint
|
204
|
+
factory_bot_rails
|
205
|
+
nokogiri
|
164
206
|
pry
|
165
|
-
|
166
|
-
|
207
|
+
rails-controller-testing
|
208
|
+
rspec-rails
|
209
|
+
shoulda-matchers
|
210
|
+
sqlite3
|
211
|
+
timecop
|
167
212
|
|
168
213
|
BUNDLED WITH
|
169
|
-
2.1.
|
214
|
+
2.1.4
|
data/NEWS.md
CHANGED
@@ -3,6 +3,22 @@
|
|
3
3
|
The noteworthy changes for each Clearance version are included here. For a
|
4
4
|
complete changelog, see the git history for each version via the version links.
|
5
5
|
|
6
|
+
## [2.3.0] - August 14, 2020
|
7
|
+
|
8
|
+
### Fixed
|
9
|
+
|
10
|
+
- Delete cookie correctly when a callable object is set as the custom domain
|
11
|
+
setting.
|
12
|
+
- Strip `as` parameter when signing in through the back door.
|
13
|
+
- Remove broken autoload for deprecated password strategies.
|
14
|
+
|
15
|
+
### Changed
|
16
|
+
|
17
|
+
- Deliver password reset email inline rather than in the background.
|
18
|
+
- Remove unnecessary unsafe interpolation in erb templates.
|
19
|
+
|
20
|
+
[2.3.0]: https://github.com/thoughtbot/clearance/compare/v2.2.0...v2.3.0
|
21
|
+
|
6
22
|
## [2.2.1] - August 7, 2020
|
7
23
|
|
8
24
|
### Fixed
|
data/README.md
CHANGED
@@ -60,6 +60,7 @@ Clearance.configure do |config|
|
|
60
60
|
config.password_strategy = Clearance::PasswordStrategies::BCrypt
|
61
61
|
config.redirect_url = "/"
|
62
62
|
config.rotate_csrf_on_sign_in = true
|
63
|
+
config.same_site = nil
|
63
64
|
config.secure_cookie = false
|
64
65
|
config.sign_in_guards = []
|
65
66
|
config.user_model = "User"
|
@@ -285,24 +286,6 @@ and `password` attributes. Over-riding the `email_optional?` or
|
|
285
286
|
`skip_password_validation?` methods to return `true` will disable those
|
286
287
|
validations from being added.
|
287
288
|
|
288
|
-
### Deliver Email in Background Job
|
289
|
-
|
290
|
-
Clearance has a password reset mailer. If you are using Rails 4.2 and Clearance
|
291
|
-
1.6 or greater, Clearance will use ActiveJob's `deliver_later` method to
|
292
|
-
automatically take advantage of your configured queue.
|
293
|
-
|
294
|
-
If you are using an earlier version of Rails, you can override the
|
295
|
-
`Clearance::Passwords` controller and define the behavior you need in the
|
296
|
-
`deliver_email` method.
|
297
|
-
|
298
|
-
```ruby
|
299
|
-
class PasswordsController < Clearance::PasswordsController
|
300
|
-
def deliver_email(user)
|
301
|
-
ClearanceMailer.delay.change_password(user)
|
302
|
-
end
|
303
|
-
end
|
304
|
-
```
|
305
|
-
|
306
289
|
## Extending Sign In
|
307
290
|
|
308
291
|
By default, Clearance will sign in any user with valid credentials. If you need
|
data/RELEASING.md
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# Releasing
|
2
|
+
|
3
|
+
1. Update version file accordingly.
|
4
|
+
1. Run `bundle install` to update Gemfile.lock
|
5
|
+
1. Update `NEWS.md` to reflect the changes since last release.
|
6
|
+
1. Commit changes.
|
7
|
+
There shouldn't be code changes,
|
8
|
+
and thus CI doesn't need to run,
|
9
|
+
you can then add "[ci skip]" to the commit message.
|
10
|
+
1. Push the new commit
|
11
|
+
1. Tag the release: `git tag -s vVERSION`
|
12
|
+
- We recommend the [_quick guide on how to sign a commit_] from GitHub.
|
13
|
+
1. Push changes: `git push --tags`
|
14
|
+
1. Build and publish:
|
15
|
+
```bash
|
16
|
+
gem build clearance.gemspec
|
17
|
+
gem push clearance-*.gem
|
18
|
+
```
|
19
|
+
1. Add a new GitHub release using the recent `NEWS.md` as the content. Sample
|
20
|
+
URL: https://github.com/thoughtbot/clearance/releases/new?tag=vVERSION
|
21
|
+
1. Announce the new release,
|
22
|
+
making sure to say "thank you" to the contributors
|
23
|
+
who helped shape this version!
|
24
|
+
|
25
|
+
[_quick guide on how to sign a commit_]: https://docs.github.com/en/github/authenticating-to-github/signing-commits
|
data/Rakefile
CHANGED
@@ -22,5 +22,10 @@ RSpec::Core::RakeTask.new("spec:acceptance") do |task|
|
|
22
22
|
task.verbose = false
|
23
23
|
end
|
24
24
|
|
25
|
+
desc "Lint ERB templates"
|
26
|
+
task :erb_lint do
|
27
|
+
sh("bundle", "exec", "erblint", "app/views/**/*.erb")
|
28
|
+
end
|
29
|
+
|
25
30
|
desc "Run the specs and acceptance tests"
|
26
|
-
task default: %w(spec spec:acceptance)
|
31
|
+
task default: %w(spec spec:acceptance erb_lint)
|
@@ -45,8 +45,7 @@ class Clearance::PasswordsController < Clearance::BaseController
|
|
45
45
|
private
|
46
46
|
|
47
47
|
def deliver_email(user)
|
48
|
-
|
49
|
-
mail.deliver_later
|
48
|
+
::ClearanceMailer.change_password(user).deliver_now
|
50
49
|
end
|
51
50
|
|
52
51
|
def password_from_password_reset_params
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
<p>
|
4
4
|
<%= link_to t(".link_text", default: "Change my password"),
|
5
|
-
edit_user_password_url(@user, token: @user.confirmation_token
|
5
|
+
edit_user_password_url(@user, token: @user.confirmation_token) %>
|
6
6
|
</p>
|
7
7
|
|
8
|
-
<p><%=
|
8
|
+
<p><%= t(".closing") %></p>
|
data/gemfiles/rails_5.0.gemfile
CHANGED
@@ -2,19 +2,20 @@
|
|
2
2
|
|
3
3
|
source "https://rubygems.org"
|
4
4
|
|
5
|
-
gem "addressable"
|
5
|
+
gem "addressable"
|
6
6
|
gem "ammeter"
|
7
7
|
gem "appraisal"
|
8
|
-
gem "capybara", ">= 2.6.2"
|
9
|
-
gem "database_cleaner"
|
10
|
-
gem "
|
11
|
-
gem "
|
8
|
+
gem "capybara", ">= 2.6.2", "< 3.33.0"
|
9
|
+
gem "database_cleaner"
|
10
|
+
gem "erb_lint", require: false
|
11
|
+
gem "factory_bot_rails"
|
12
|
+
gem "nokogiri"
|
12
13
|
gem "pry", require: false
|
13
|
-
gem "shoulda-matchers", "~> 4.1"
|
14
|
-
gem "timecop", "~> 0.6"
|
15
|
-
gem "railties", "~> 5.0.0"
|
16
14
|
gem "rails-controller-testing"
|
17
|
-
gem "sqlite3", "~> 1.3.13"
|
18
15
|
gem "rspec-rails", "~> 3.1"
|
16
|
+
gem "shoulda-matchers"
|
17
|
+
gem "sqlite3", "~> 1.3.13"
|
18
|
+
gem "timecop"
|
19
|
+
gem "railties", "~> 5.0"
|
19
20
|
|
20
21
|
gemspec path: "../"
|
data/gemfiles/rails_5.1.gemfile
CHANGED
@@ -2,19 +2,20 @@
|
|
2
2
|
|
3
3
|
source "https://rubygems.org"
|
4
4
|
|
5
|
-
gem "addressable"
|
5
|
+
gem "addressable"
|
6
6
|
gem "ammeter"
|
7
7
|
gem "appraisal"
|
8
|
-
gem "capybara"
|
9
|
-
gem "database_cleaner"
|
10
|
-
gem "
|
11
|
-
gem "
|
8
|
+
gem "capybara"
|
9
|
+
gem "database_cleaner"
|
10
|
+
gem "erb_lint", require: false
|
11
|
+
gem "factory_bot_rails"
|
12
|
+
gem "nokogiri"
|
12
13
|
gem "pry", require: false
|
13
|
-
gem "shoulda-matchers", "~> 4.1"
|
14
|
-
gem "timecop", "~> 0.6"
|
15
|
-
gem "railties", "~> 5.1.0"
|
16
14
|
gem "rails-controller-testing"
|
17
|
-
gem "
|
18
|
-
gem "
|
15
|
+
gem "rspec-rails"
|
16
|
+
gem "shoulda-matchers"
|
17
|
+
gem "sqlite3"
|
18
|
+
gem "timecop"
|
19
|
+
gem "railties", "~> 5.1"
|
19
20
|
|
20
21
|
gemspec path: "../"
|
data/gemfiles/rails_5.2.gemfile
CHANGED
@@ -2,19 +2,20 @@
|
|
2
2
|
|
3
3
|
source "https://rubygems.org"
|
4
4
|
|
5
|
-
gem "addressable"
|
5
|
+
gem "addressable"
|
6
6
|
gem "ammeter"
|
7
7
|
gem "appraisal"
|
8
|
-
gem "capybara"
|
9
|
-
gem "database_cleaner"
|
10
|
-
gem "
|
11
|
-
gem "
|
8
|
+
gem "capybara"
|
9
|
+
gem "database_cleaner"
|
10
|
+
gem "erb_lint", require: false
|
11
|
+
gem "factory_bot_rails"
|
12
|
+
gem "nokogiri"
|
12
13
|
gem "pry", require: false
|
13
|
-
gem "shoulda-matchers", "~> 4.1"
|
14
|
-
gem "timecop", "~> 0.6"
|
15
|
-
gem "railties", "~> 5.2.0"
|
16
14
|
gem "rails-controller-testing"
|
17
|
-
gem "
|
18
|
-
gem "
|
15
|
+
gem "rspec-rails"
|
16
|
+
gem "shoulda-matchers"
|
17
|
+
gem "sqlite3"
|
18
|
+
gem "timecop"
|
19
|
+
gem "railties", "~> 5.2"
|
19
20
|
|
20
21
|
gemspec path: "../"
|
data/gemfiles/rails_6.0.gemfile
CHANGED
@@ -2,19 +2,20 @@
|
|
2
2
|
|
3
3
|
source "https://rubygems.org"
|
4
4
|
|
5
|
-
gem "addressable"
|
5
|
+
gem "addressable"
|
6
6
|
gem "ammeter"
|
7
7
|
gem "appraisal"
|
8
|
-
gem "capybara"
|
9
|
-
gem "database_cleaner"
|
10
|
-
gem "
|
11
|
-
gem "
|
8
|
+
gem "capybara"
|
9
|
+
gem "database_cleaner"
|
10
|
+
gem "erb_lint", require: false
|
11
|
+
gem "factory_bot_rails"
|
12
|
+
gem "nokogiri"
|
12
13
|
gem "pry", require: false
|
13
|
-
gem "shoulda-matchers", "~> 4.1"
|
14
|
-
gem "timecop", "~> 0.6"
|
15
|
-
gem "railties", "~> 6.0.0"
|
16
14
|
gem "rails-controller-testing"
|
17
|
-
gem "rspec-rails"
|
18
|
-
gem "
|
15
|
+
gem "rspec-rails"
|
16
|
+
gem "shoulda-matchers"
|
17
|
+
gem "sqlite3"
|
18
|
+
gem "timecop"
|
19
|
+
gem "railties", "~> 6.0"
|
19
20
|
|
20
21
|
gemspec path: "../"
|
data/lib/clearance/back_door.rb
CHANGED
@@ -49,7 +49,8 @@ module Clearance
|
|
49
49
|
# @api private
|
50
50
|
def sign_in_through_the_back_door(env)
|
51
51
|
params = Rack::Utils.parse_query(env["QUERY_STRING"])
|
52
|
-
user_param = params
|
52
|
+
user_param = params.delete("as")
|
53
|
+
env["QUERY_STRING"] = Rack::Utils.build_query(params)
|
53
54
|
|
54
55
|
if user_param.present?
|
55
56
|
user = find_user(user_param)
|
@@ -15,9 +15,5 @@ module Clearance
|
|
15
15
|
module PasswordStrategies
|
16
16
|
autoload :BCrypt, "clearance/password_strategies/bcrypt"
|
17
17
|
autoload :Argon2, "clearance/password_strategies/argon2"
|
18
|
-
autoload :BCryptMigrationFromSHA1,
|
19
|
-
"clearance/password_strategies/bcrypt_migration_from_sha1"
|
20
|
-
autoload :Blowfish, "clearance/password_strategies/blowfish"
|
21
|
-
autoload :SHA1, "clearance/password_strategies/sha1"
|
22
18
|
end
|
23
19
|
end
|
data/lib/clearance/session.rb
CHANGED
data/lib/clearance/version.rb
CHANGED
@@ -46,6 +46,18 @@ describe Clearance::BackDoor do
|
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
+
it "strips 'as' from the params" do
|
50
|
+
user_id = "123"
|
51
|
+
user = double("user")
|
52
|
+
allow(User).to receive(:find).with(user_id).and_return(user)
|
53
|
+
env = build_env(as: user_id, foo: :bar)
|
54
|
+
back_door = Clearance::BackDoor.new(mock_app)
|
55
|
+
|
56
|
+
back_door.call(env)
|
57
|
+
|
58
|
+
expect(env["QUERY_STRING"]).to eq("foo=bar")
|
59
|
+
end
|
60
|
+
|
49
61
|
context "when the environments are disabled" do
|
50
62
|
before do
|
51
63
|
Clearance.configuration.allowed_backdoor_environments = nil
|
@@ -84,14 +96,18 @@ describe Clearance::BackDoor do
|
|
84
96
|
env_for_user_id("")
|
85
97
|
end
|
86
98
|
|
87
|
-
def
|
99
|
+
def build_env(params)
|
100
|
+
query = Rack::Utils.build_query(params)
|
88
101
|
clearance = double("clearance", sign_in: true)
|
89
|
-
Rack::MockRequest.env_for("
|
102
|
+
Rack::MockRequest.env_for("/?#{query}").merge(clearance: clearance)
|
103
|
+
end
|
104
|
+
|
105
|
+
def env_for_user_id(user_id)
|
106
|
+
build_env(as: user_id)
|
90
107
|
end
|
91
108
|
|
92
109
|
def env_for_username(username)
|
93
|
-
|
94
|
-
Rack::MockRequest.env_for("/?as=#{username}").merge(clearance: clearance)
|
110
|
+
build_env(as: username)
|
95
111
|
end
|
96
112
|
|
97
113
|
def mock_app
|
@@ -378,6 +378,25 @@ describe Clearance::Session do
|
|
378
378
|
expect(cookie_jar.deleted?(:remember_token, domain: domain)).to be true
|
379
379
|
end
|
380
380
|
end
|
381
|
+
|
382
|
+
context 'with callable cookie domain' do
|
383
|
+
it 'clears cookie' do
|
384
|
+
domain = '.example.com'
|
385
|
+
Clearance.configuration.cookie_domain = ->(_) { domain }
|
386
|
+
user = create(:user)
|
387
|
+
env = env_with_remember_token(
|
388
|
+
value: user.remember_token,
|
389
|
+
domain: domain
|
390
|
+
)
|
391
|
+
session = Clearance::Session.new(env)
|
392
|
+
cookie_jar = ActionDispatch::Request.new(env).cookie_jar
|
393
|
+
expect(cookie_jar.deleted?(:remember_token, domain: domain)).to be false
|
394
|
+
|
395
|
+
session.sign_out
|
396
|
+
|
397
|
+
expect(cookie_jar.deleted?(:remember_token, domain: domain)).to be true
|
398
|
+
end
|
399
|
+
end
|
381
400
|
end
|
382
401
|
|
383
402
|
def env_with_cookies(cookies)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clearance
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Croak
|
@@ -25,7 +25,7 @@ authors:
|
|
25
25
|
autorequire:
|
26
26
|
bindir: bin
|
27
27
|
cert_chain: []
|
28
|
-
date: 2020-08-
|
28
|
+
date: 2020-08-14 00:00:00.000000000 Z
|
29
29
|
dependencies:
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: bcrypt
|
@@ -144,6 +144,7 @@ extra_rdoc_files:
|
|
144
144
|
- LICENSE
|
145
145
|
- README.md
|
146
146
|
files:
|
147
|
+
- ".erb-lint.yml"
|
147
148
|
- ".gitignore"
|
148
149
|
- ".travis.yml"
|
149
150
|
- ".yardopts"
|
@@ -154,6 +155,7 @@ files:
|
|
154
155
|
- LICENSE
|
155
156
|
- NEWS.md
|
156
157
|
- README.md
|
158
|
+
- RELEASING.md
|
157
159
|
- Rakefile
|
158
160
|
- app/controllers/clearance/base_controller.rb
|
159
161
|
- app/controllers/clearance/passwords_controller.rb
|
@@ -308,7 +310,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
308
310
|
- !ruby/object:Gem::Version
|
309
311
|
version: '0'
|
310
312
|
requirements: []
|
311
|
-
rubygems_version: 3.
|
313
|
+
rubygems_version: 3.1.2
|
312
314
|
signing_key:
|
313
315
|
specification_version: 4
|
314
316
|
summary: Rails authentication & authorization with email & password.
|