clearance 1.9.0 → 1.10.1
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/.travis.yml +2 -2
- data/CONTRIBUTING.md +4 -1
- data/Gemfile.lock +12 -18
- data/NEWS.md +9 -1
- data/README.md +3 -1
- data/app/views/layouts/application.html.erb +2 -2
- data/app/views/passwords/create.html.erb +1 -1
- data/app/views/passwords/edit.html.erb +2 -2
- data/app/views/passwords/new.html.erb +2 -2
- data/app/views/sessions/_form.html.erb +2 -2
- data/app/views/sessions/new.html.erb +1 -1
- data/app/views/users/new.html.erb +2 -2
- data/lib/clearance/password_strategies/bcrypt_migration_from_sha1.rb +9 -0
- data/lib/clearance/password_strategies/blowfish.rb +8 -0
- data/lib/clearance/password_strategies/sha1.rb +8 -0
- data/lib/clearance/version.rb +1 -1
- data/spec/password_strategies/bcrypt_migration_from_sha1_spec.rb +6 -0
- data/spec/password_strategies/blowfish_spec.rb +6 -0
- data/spec/password_strategies/sha1_spec.rb +6 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f17291a4d13d462f49a5fc69684b8709714749aa
|
4
|
+
data.tar.gz: 30d2cbfaf5855833fa24c7c33b1d51bf50e7db25
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee5ec1d2dd6d3790e53379b09da0b00654268ec650dc1b4fca1b7776c647d9ca34ddd0940d6fe0e4657619e1cc67d8546066bc31744c3d342954ed6a3a573cfb
|
7
|
+
data.tar.gz: 46ee3ac5bf3104289785a31bd935133d46325ef5da7c3827477fcd2fcc294569cbd992b58ba92765f7acf265ee5e90bec66f6908e06ac9b990bcaf67f858e46e
|
data/.travis.yml
CHANGED
data/CONTRIBUTING.md
CHANGED
@@ -1,4 +1,7 @@
|
|
1
|
-
We love pull requests.
|
1
|
+
We love pull requests from everyone. By participating in this project, you agree
|
2
|
+
to abide by the thoughtbot [code of conduct].
|
3
|
+
|
4
|
+
[code of conduct]: https://thoughtbot.com/open-source-code-of-conduct
|
2
5
|
|
3
6
|
1. Fork the repo.
|
4
7
|
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
clearance (1.
|
4
|
+
clearance (1.10.1)
|
5
5
|
bcrypt
|
6
6
|
email_validator (~> 1.4)
|
7
7
|
rails (>= 3.1)
|
@@ -64,7 +64,7 @@ GEM
|
|
64
64
|
coderay (1.1.0)
|
65
65
|
database_cleaner (1.3.0)
|
66
66
|
diff-lcs (1.2.5)
|
67
|
-
email_validator (1.
|
67
|
+
email_validator (1.6.0)
|
68
68
|
activemodel
|
69
69
|
erubis (2.7.0)
|
70
70
|
factory_girl (4.5.0)
|
@@ -72,27 +72,25 @@ GEM
|
|
72
72
|
factory_girl_rails (4.5.0)
|
73
73
|
factory_girl (~> 4.5.0)
|
74
74
|
railties (>= 3.0.0)
|
75
|
-
globalid (0.3.
|
75
|
+
globalid (0.3.5)
|
76
76
|
activesupport (>= 4.1.0)
|
77
|
-
hike (1.2.3)
|
78
77
|
i18n (0.7.0)
|
79
78
|
json (1.8.2)
|
80
|
-
loofah (2.0.
|
79
|
+
loofah (2.0.2)
|
81
80
|
nokogiri (>= 1.5.9)
|
82
81
|
mail (2.6.3)
|
83
82
|
mime-types (>= 1.16, < 3)
|
84
83
|
method_source (0.8.2)
|
85
|
-
mime-types (2.
|
84
|
+
mime-types (2.5)
|
86
85
|
mini_portile (0.6.2)
|
87
|
-
minitest (5.
|
88
|
-
multi_json (1.11.0)
|
86
|
+
minitest (5.6.1)
|
89
87
|
nokogiri (1.6.6.2)
|
90
88
|
mini_portile (~> 0.6.0)
|
91
89
|
pry (0.10.1)
|
92
90
|
coderay (~> 1.1.0)
|
93
91
|
method_source (~> 0.8.1)
|
94
92
|
slop (~> 3.4)
|
95
|
-
rack (1.6.
|
93
|
+
rack (1.6.1)
|
96
94
|
rack-test (0.6.3)
|
97
95
|
rack (>= 1.0)
|
98
96
|
rails (4.2.0)
|
@@ -108,11 +106,11 @@ GEM
|
|
108
106
|
sprockets-rails
|
109
107
|
rails-deprecated_sanitizer (1.0.3)
|
110
108
|
activesupport (>= 4.2.0.alpha)
|
111
|
-
rails-dom-testing (1.0.
|
109
|
+
rails-dom-testing (1.0.6)
|
112
110
|
activesupport (>= 4.2.0.beta, < 5.0)
|
113
111
|
nokogiri (~> 1.6.0)
|
114
112
|
rails-deprecated_sanitizer (>= 1.0.1)
|
115
|
-
rails-html-sanitizer (1.0.
|
113
|
+
rails-html-sanitizer (1.0.2)
|
116
114
|
loofah (~> 2.0)
|
117
115
|
railties (4.2.0)
|
118
116
|
actionpack (= 4.2.0)
|
@@ -140,19 +138,15 @@ GEM
|
|
140
138
|
shoulda-matchers (2.8.0)
|
141
139
|
activesupport (>= 3.0.0)
|
142
140
|
slop (3.6.0)
|
143
|
-
sprockets (
|
144
|
-
hike (~> 1.2)
|
145
|
-
multi_json (~> 1.0)
|
141
|
+
sprockets (3.1.0)
|
146
142
|
rack (~> 1.0)
|
147
|
-
|
148
|
-
sprockets-rails (2.2.4)
|
143
|
+
sprockets-rails (2.3.1)
|
149
144
|
actionpack (>= 3.0)
|
150
145
|
activesupport (>= 3.0)
|
151
146
|
sprockets (>= 2.8, < 4.0)
|
152
147
|
sqlite3 (1.3.10)
|
153
148
|
thor (0.19.1)
|
154
|
-
thread_safe (0.3.
|
155
|
-
tilt (1.4.1)
|
149
|
+
thread_safe (0.3.5)
|
156
150
|
timecop (0.7.1)
|
157
151
|
tzinfo (1.2.2)
|
158
152
|
thread_safe (~> 0.1)
|
data/NEWS.md
CHANGED
@@ -3,6 +3,15 @@
|
|
3
3
|
The noteworthy changes for each Clearance version are included here. For a
|
4
4
|
complete changelog, see the git history.
|
5
5
|
|
6
|
+
## [1.10.1] - May 15, 2015
|
7
|
+
|
8
|
+
### Deprecated
|
9
|
+
- All clearance-provided password strategies other than BCrypt have been
|
10
|
+
deprecated. You can continue to use those strategies without a deprecation
|
11
|
+
warning by adding `clearance-deprecated_password_strategies` to your Gemfile.
|
12
|
+
|
13
|
+
[1.10.1]: https://github.com/thoughtbot/clearance/compare/v1.9.0...v1.10.1
|
14
|
+
|
6
15
|
## [1.9.0] - April 3, 2015
|
7
16
|
|
8
17
|
### Added
|
@@ -17,7 +26,6 @@ complete changelog, see the git history.
|
|
17
26
|
- Change password template now contains "Change my password" link text to
|
18
27
|
address an issue linking the URL in some mail clients.
|
19
28
|
|
20
|
-
|
21
29
|
[1.9.0]: https://github.com/thoughtbot/clearance/compare/v1.8.1...v1.9.0
|
22
30
|
|
23
31
|
## [1.8.1] - March 3, 2015
|
data/README.md
CHANGED
@@ -155,7 +155,8 @@ See [app/controllers/clearance](/app/controllers/clearance) for the default
|
|
155
155
|
behavior. Many protected methods were extracted in these controllers in an
|
156
156
|
attempt to make overrides and hooks simpler.
|
157
157
|
|
158
|
-
To override a Clearance controller, subclass it
|
158
|
+
To override a Clearance controller, subclass it and update the routes to
|
159
|
+
point to your new controller (see the "Routes" section).
|
159
160
|
|
160
161
|
```ruby
|
161
162
|
class PasswordsController < Clearance::PasswordsController
|
@@ -172,6 +173,7 @@ sessions#url_after_create
|
|
172
173
|
sessions#url_for_signed_in_users
|
173
174
|
users#url_after_create
|
174
175
|
application#url_after_denied_access_when_signed_in
|
176
|
+
application#url_after_denied_access_when_signed_out
|
175
177
|
```
|
176
178
|
|
177
179
|
To override them all at once, change the global configuration of `redirect_url`.
|
@@ -7,9 +7,9 @@
|
|
7
7
|
<body>
|
8
8
|
<div id="header">
|
9
9
|
<% if signed_in? -%>
|
10
|
-
<%= button_to t(
|
10
|
+
<%= button_to t(".sign_out"), sign_out_path, method: :delete %>
|
11
11
|
<% else -%>
|
12
|
-
<%= link_to t(
|
12
|
+
<%= link_to t(".sign_in"), sign_in_path %>
|
13
13
|
<% end -%>
|
14
14
|
</div>
|
15
15
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<div id="clearance" class="password-reset">
|
2
|
-
<h2><%= t
|
2
|
+
<h2><%= t(".title") %></h2>
|
3
3
|
|
4
|
-
<p><%= t
|
4
|
+
<p><%= t(".description") %></p>
|
5
5
|
|
6
6
|
<%= form_for :password_reset,
|
7
7
|
url: user_password_path(@user, token: @user.confirmation_token),
|
@@ -15,8 +15,8 @@
|
|
15
15
|
|
16
16
|
<div class="other-links">
|
17
17
|
<% if Clearance.configuration.allow_sign_up? %>
|
18
|
-
<%= link_to t(
|
18
|
+
<%= link_to t(".sign_up"), sign_up_path %>
|
19
19
|
<% end %>
|
20
|
-
<%= link_to t(
|
20
|
+
<%= link_to t(".forgot_password"), new_password_path %>
|
21
21
|
</div>
|
22
22
|
<% end %>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<div id="clearance" class="sign-up">
|
2
|
-
<h2><%= t(
|
2
|
+
<h2><%= t(".title") %></h2>
|
3
3
|
|
4
4
|
<%= form_for @user do |form| %>
|
5
5
|
<%= render partial: '/users/form', object: form %>
|
@@ -9,7 +9,7 @@
|
|
9
9
|
</div>
|
10
10
|
|
11
11
|
<div class="other-links">
|
12
|
-
<%= link_to t(
|
12
|
+
<%= link_to t(".sign_in"), sign_in_path %>
|
13
13
|
</div>
|
14
14
|
<% end %>
|
15
15
|
</div>
|
@@ -1,6 +1,13 @@
|
|
1
1
|
module Clearance
|
2
2
|
module PasswordStrategies
|
3
3
|
module BCryptMigrationFromSHA1
|
4
|
+
DEPRECATION_MESSAGE = "[DEPRECATION] The BCryptMigrationFromSha1 " \
|
5
|
+
"password strategy has been deprecated and will be removed from " \
|
6
|
+
"Clearance 2.0. BCrypt is the only officially supported strategy, " \
|
7
|
+
"though you are free to provide your own. To continue using this " \
|
8
|
+
"strategy, add clearance-deprecated_password_strategies to your " \
|
9
|
+
"Gemfile."
|
10
|
+
|
4
11
|
class BCryptUser
|
5
12
|
include Clearance::PasswordStrategies::BCrypt
|
6
13
|
|
@@ -22,10 +29,12 @@ module Clearance
|
|
22
29
|
end
|
23
30
|
|
24
31
|
def authenticated?(password)
|
32
|
+
warn "#{Kernel.caller.first}: #{DEPRECATION_MESSAGE}"
|
25
33
|
authenticated_with_sha1?(password) || authenticated_with_bcrypt?(password)
|
26
34
|
end
|
27
35
|
|
28
36
|
def password=(new_password)
|
37
|
+
warn "#{Kernel.caller.first}: #{DEPRECATION_MESSAGE}"
|
29
38
|
@password = new_password
|
30
39
|
BCryptUser.new(self).password = new_password
|
31
40
|
end
|
@@ -4,11 +4,19 @@ require 'base64'
|
|
4
4
|
module Clearance
|
5
5
|
module PasswordStrategies
|
6
6
|
module Blowfish
|
7
|
+
DEPRECATION_MESSAGE = "[DEPRECATION] The Blowfish password strategy " \
|
8
|
+
"has been deprecated and will be removed from Clearance 2.0. BCrypt " \
|
9
|
+
"is the only officially supported strategy, though you are free to " \
|
10
|
+
"provide your own. To continue using this strategy add " \
|
11
|
+
"clearance-deprecated_password_strategies to your Gemfile."
|
12
|
+
|
7
13
|
def authenticated?(password)
|
14
|
+
warn "#{Kernel.caller.first}: #{DEPRECATION_MESSAGE}"
|
8
15
|
encrypted_password == encrypt(password)
|
9
16
|
end
|
10
17
|
|
11
18
|
def password=(new_password)
|
19
|
+
warn "#{Kernel.caller.first}: #{DEPRECATION_MESSAGE}"
|
12
20
|
@password = new_password
|
13
21
|
initialize_salt_if_necessary
|
14
22
|
|
@@ -3,13 +3,21 @@ module Clearance
|
|
3
3
|
module SHA1
|
4
4
|
require 'digest/sha1'
|
5
5
|
|
6
|
+
DEPRECATION_MESSAGE = "[DEPRECATION] The SHA1 password strategy " \
|
7
|
+
"has been deprecated and will be removed from Clearance 2.0. BCrypt " \
|
8
|
+
"is the only officially supported strategy, though you are free to " \
|
9
|
+
"provide your own. To continue using this strategy add " \
|
10
|
+
"clearance-deprecated_password_strategies to your Gemfile."
|
11
|
+
|
6
12
|
extend ActiveSupport::Concern
|
7
13
|
|
8
14
|
def authenticated?(password)
|
15
|
+
warn "#{Kernel.caller.first}: #{DEPRECATION_MESSAGE}"
|
9
16
|
encrypted_password == encrypt(password)
|
10
17
|
end
|
11
18
|
|
12
19
|
def password=(new_password)
|
20
|
+
warn "#{Kernel.caller.first}: #{DEPRECATION_MESSAGE}"
|
13
21
|
@password = new_password
|
14
22
|
initialize_salt_if_necessary
|
15
23
|
|
data/lib/clearance/version.rb
CHANGED
@@ -2,6 +2,12 @@ require "spec_helper"
|
|
2
2
|
include FakeModelWithPasswordStrategy
|
3
3
|
|
4
4
|
describe Clearance::PasswordStrategies::BCryptMigrationFromSHA1 do
|
5
|
+
around do |example|
|
6
|
+
silence_warnings do
|
7
|
+
example.run
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
5
11
|
describe "#password=" do
|
6
12
|
it "encrypts the password into a BCrypt-encrypted encrypted_password" do
|
7
13
|
stub_bcrypt_password
|
@@ -2,6 +2,12 @@ require "spec_helper"
|
|
2
2
|
include FakeModelWithPasswordStrategy
|
3
3
|
|
4
4
|
describe Clearance::PasswordStrategies::Blowfish do
|
5
|
+
around do |example|
|
6
|
+
silence_warnings do
|
7
|
+
example.run
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
5
11
|
describe "#password=" do
|
6
12
|
context "when the password is set" do
|
7
13
|
it "does not initialize the salt" do
|
@@ -2,6 +2,12 @@ require "spec_helper"
|
|
2
2
|
include FakeModelWithPasswordStrategy
|
3
3
|
|
4
4
|
describe Clearance::PasswordStrategies::SHA1 do
|
5
|
+
around do |example|
|
6
|
+
silence_warnings do
|
7
|
+
example.run
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
5
11
|
describe "#password=" do
|
6
12
|
context "when the salt is set" do
|
7
13
|
it "does not initialize the salt when assigned" do
|
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: 1.
|
4
|
+
version: 1.10.1
|
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: 2015-
|
28
|
+
date: 2015-05-15 00:00:00.000000000 Z
|
29
29
|
dependencies:
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: bcrypt
|