clearance 1.6.1 → 1.7.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/.travis.yml +1 -0
- data/Appraisals +7 -4
- data/Gemfile.lock +3 -3
- data/LICENSE +1 -1
- data/NEWS.md +7 -0
- data/README.md +6 -6
- data/app/controllers/clearance/passwords_controller.rb +1 -1
- data/app/controllers/clearance/sessions_controller.rb +1 -1
- data/app/controllers/clearance/users_controller.rb +1 -1
- data/features/integration_with_rspec.feature +1 -0
- data/gemfiles/rails4.0.gemfile +2 -1
- data/gemfiles/rails4.1.gemfile +1 -1
- data/lib/clearance.rb +3 -0
- data/lib/clearance/authorization.rb +10 -2
- data/lib/clearance/testing/deny_access_matcher.rb +1 -1
- data/lib/clearance/version.rb +1 -1
- data/lib/generators/clearance/views/views_generator.rb +1 -1
- data/spec/controllers/apis_controller_spec.rb +1 -1
- data/spec/controllers/forgeries_controller_spec.rb +1 -1
- data/spec/controllers/permissions_controller_spec.rb +1 -1
- 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: 4a379553672fd5a49ba2e23f23f3179d0e023b8b
|
4
|
+
data.tar.gz: 51022e7a675360f0c142a9812d753fa2a6cf240b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 562072cad198bc2e707fbf163ffc279e7b5f6abdc70fc98b777df0f669b33026e6924954429fdabf888512f58535ebe3a80999edb9f79cf92ea711cbde96a0cf
|
7
|
+
data.tar.gz: a19e25467230e87006d4dd1d08932333df4ef47814d60a51766f0648475e8ca67d4a15b86c87b7baaddb739897aa9f5468be7df77bfcaa53c1e87faf99548117
|
data/.travis.yml
CHANGED
data/Appraisals
CHANGED
@@ -1,13 +1,16 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
if RUBY_VERSION < "2.2.0"
|
2
|
+
appraise 'rails3.2' do
|
3
|
+
gem 'rails', '~> 3.2.21'
|
4
|
+
end
|
3
5
|
end
|
4
6
|
|
5
7
|
appraise 'rails4.0' do
|
6
|
-
gem 'rails', '~> 4.0.
|
8
|
+
gem 'rails', '~> 4.0.13'
|
9
|
+
gem 'test-unit'
|
7
10
|
end
|
8
11
|
|
9
12
|
appraise 'rails4.1' do
|
10
|
-
gem 'rails', '~> 4.1.
|
13
|
+
gem 'rails', '~> 4.1.9'
|
11
14
|
end
|
12
15
|
|
13
16
|
appraise 'rails4.2' do
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
clearance (1.
|
4
|
+
clearance (1.7.0)
|
5
5
|
bcrypt
|
6
6
|
email_validator (~> 1.4)
|
7
7
|
rails (>= 3.1)
|
@@ -68,7 +68,7 @@ GEM
|
|
68
68
|
childprocess (0.5.5)
|
69
69
|
ffi (~> 1.0, >= 1.0.11)
|
70
70
|
coderay (1.1.0)
|
71
|
-
cucumber (1.3.
|
71
|
+
cucumber (1.3.18)
|
72
72
|
builder (>= 2.1.2)
|
73
73
|
diff-lcs (>= 1.1.3)
|
74
74
|
gherkin (~> 2.12)
|
@@ -104,7 +104,7 @@ GEM
|
|
104
104
|
mime-types (>= 1.16, < 3)
|
105
105
|
method_source (0.8.2)
|
106
106
|
mime-types (2.4.3)
|
107
|
-
mini_portile (0.6.
|
107
|
+
mini_portile (0.6.2)
|
108
108
|
minitest (5.5.0)
|
109
109
|
multi_json (1.10.1)
|
110
110
|
multi_test (0.1.1)
|
data/LICENSE
CHANGED
data/NEWS.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
Thank you to all the [contributors](https://github.com/thoughtbot/clearance/graphs/contributors)!
|
2
2
|
|
3
|
+
New for 1.7.0 (January, 8, 2015)
|
4
|
+
* The `authorize` filter has been deprecated in favor of `require_login`. Update
|
5
|
+
all reference to the filter including any calls to `skip_before_filter` or
|
6
|
+
`skip_before_action`.
|
7
|
+
* The `Clearance.root` method has been deprecated.
|
8
|
+
* Fix the negation of the `deny_access` matcher in Rails 4.0.x on Ruby 2.2
|
9
|
+
|
3
10
|
New for 1.6.1 (January 6, 2015)
|
4
11
|
* Secure cookies are no longer overwritten when the user visits a non-HTTPS URL.
|
5
12
|
|
data/README.md
CHANGED
@@ -100,11 +100,11 @@ Clearance.configure do |config|
|
|
100
100
|
end
|
101
101
|
```
|
102
102
|
|
103
|
-
Use `
|
103
|
+
Use `require_login` to control access in controllers:
|
104
104
|
|
105
105
|
```ruby
|
106
106
|
class ArticlesController < ApplicationController
|
107
|
-
before_filter :
|
107
|
+
before_filter :require_login
|
108
108
|
|
109
109
|
def index
|
110
110
|
current_user.articles
|
@@ -460,10 +460,10 @@ Run the specs:
|
|
460
460
|
|
461
461
|
rake
|
462
462
|
|
463
|
-
Testing
|
464
|
-
|
463
|
+
Testing controller actions that require login
|
464
|
+
---------------------------------------------
|
465
465
|
|
466
|
-
To test controller actions that are protected by `before_filter :
|
466
|
+
To test controller actions that are protected by `before_filter :require_login`,
|
467
467
|
require Clearance's test helpers and matchers in your test suite.
|
468
468
|
|
469
469
|
For `rspec`, add this line to your `spec/spec_helper.rb`:
|
@@ -555,7 +555,7 @@ you. Thank you!
|
|
555
555
|
License
|
556
556
|
-------
|
557
557
|
|
558
|
-
Clearance is copyright © 2009
|
558
|
+
Clearance is copyright © 2009 thoughtbot. It is free software, and may be
|
559
559
|
redistributed under the terms specified in the `LICENSE` file.
|
560
560
|
|
561
561
|
The names and logos for thoughtbot are trademarks of thoughtbot, inc.
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'active_support/deprecation'
|
2
2
|
|
3
3
|
class Clearance::PasswordsController < Clearance::BaseController
|
4
|
-
skip_before_filter :
|
4
|
+
skip_before_filter :require_login, only: [:create, :edit, :new, :update]
|
5
5
|
before_filter :forbid_missing_token, only: [:edit, :update]
|
6
6
|
before_filter :forbid_non_existent_user, only: [:edit, :update]
|
7
7
|
|
data/gemfiles/rails4.0.gemfile
CHANGED
data/gemfiles/rails4.1.gemfile
CHANGED
data/lib/clearance.rb
CHANGED
@@ -11,6 +11,9 @@ require 'clearance/constraints'
|
|
11
11
|
|
12
12
|
module Clearance
|
13
13
|
def self.root
|
14
|
+
warn "#{Kernel.caller.first}: [DEPRECATION] `Clearance.root` is " +
|
15
|
+
"deprecated and will be removed in the next major release. If you need " +
|
16
|
+
"to find Clearance's root, you can use the `Gem::Specification` API."
|
14
17
|
File.expand_path('../..', __FILE__)
|
15
18
|
end
|
16
19
|
end
|
@@ -3,15 +3,23 @@ module Clearance
|
|
3
3
|
extend ActiveSupport::Concern
|
4
4
|
|
5
5
|
included do
|
6
|
-
hide_action :authorize, :deny_access
|
6
|
+
hide_action :authorize, :deny_access, :require_login
|
7
7
|
end
|
8
8
|
|
9
|
-
def
|
9
|
+
def require_login
|
10
10
|
unless signed_in?
|
11
11
|
deny_access
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
+
def authorize
|
16
|
+
warn "[DEPRECATION] Clearance's `authorize` before_filter is " +
|
17
|
+
"deprecated. Use `require_login` instead. Be sure to update any " +
|
18
|
+
"instances of `skip_before_filter :authorize` or " +
|
19
|
+
"`skip_before_action :authorize` as well"
|
20
|
+
require_login
|
21
|
+
end
|
22
|
+
|
15
23
|
def deny_access(flash_message = nil)
|
16
24
|
respond_to do |format|
|
17
25
|
format.any(:js, :json, :xml) { head :unauthorized }
|
@@ -64,7 +64,7 @@ module Clearance
|
|
64
64
|
@failure_message_when_negated <<
|
65
65
|
"Didn't expect to redirect to #{@url}."
|
66
66
|
true
|
67
|
-
rescue MiniTest::Assertion
|
67
|
+
rescue MiniTest::Assertion, ::Test::Unit::AssertionFailedError
|
68
68
|
@failure_message << "Expected to redirect to #{@url} but did not."
|
69
69
|
false
|
70
70
|
end
|
data/lib/clearance/version.rb
CHANGED
@@ -4,7 +4,7 @@ class ForgeriesController < ActionController::Base
|
|
4
4
|
include Clearance::Controller
|
5
5
|
|
6
6
|
protect_from_forgery
|
7
|
-
before_filter :
|
7
|
+
before_filter :require_login
|
8
8
|
|
9
9
|
# This is off in test by default, but we need it for this test
|
10
10
|
self.allow_forgery_protection = true
|
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.7.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: 2015-01-
|
28
|
+
date: 2015-01-08 00:00:00.000000000 Z
|
29
29
|
dependencies:
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: bcrypt
|