clearance 1.4.3 → 1.5.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/Gemfile +3 -2
- data/Gemfile.lock +90 -85
- data/NEWS.md +5 -0
- data/README.md +26 -8
- data/config/routes.rb +20 -18
- data/db/schema.rb +4 -4
- data/features/copy_routes_to_host_application.feature +9 -0
- data/lib/clearance/configuration.rb +6 -1
- data/lib/clearance/version.rb +1 -1
- data/lib/generators/clearance/routes/routes_generator.rb +23 -0
- data/lib/generators/clearance/routes/templates/routes.rb +12 -0
- data/spec/clearance/back_door_spec.rb +4 -4
- data/spec/clearance/rack_session_spec.rb +3 -3
- data/spec/clearance/session_spec.rb +47 -25
- data/spec/configuration_spec.rb +22 -11
- data/spec/controllers/apis_controller_spec.rb +1 -1
- data/spec/controllers/forgeries_controller_spec.rb +3 -3
- data/spec/controllers/passwords_controller_spec.rb +38 -35
- data/spec/controllers/permissions_controller_spec.rb +5 -5
- data/spec/controllers/sessions_controller_spec.rb +4 -4
- data/spec/controllers/users_controller_spec.rb +8 -8
- data/spec/mailers/clearance_mailer_spec.rb +6 -6
- data/spec/models/bcrypt_migration_from_sha1_spec.rb +12 -12
- data/spec/models/bcrypt_spec.rb +5 -5
- data/spec/models/blowfish_spec.rb +3 -3
- data/spec/models/password_strategies_spec.rb +2 -2
- data/spec/models/sha1_spec.rb +4 -4
- data/spec/models/user_spec.rb +38 -38
- data/spec/routing/clearance_routes_spec.rb +31 -6
- data/spec/spec_helper.rb +1 -0
- data/spec/support/cookies.rb +4 -4
- metadata +6 -4
- data/spec/controllers/flashes_controller_spec.rb +0 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f85367efa274a98517142e37d7f085d3430ac2bb
|
4
|
+
data.tar.gz: 40dc373ed481f3bceb2aabd704e333bde139be4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95e458a45dd3fd6610d951d29ff98e755dc810ed38f680804648852701deaf986639e945a43f5f63d0f080461050063628764ca4c07d65617f539977dcfe1b94
|
7
|
+
data.tar.gz: 29d9b4ac5c96112fa1778f1481ee33faa03b4dde6d5fe92bb81c2e67391c613cbaaf690db55d250b223d989f392cd894e8daa7eaf7d55b3a2835f1142d008e68
|
data/Gemfile
CHANGED
@@ -6,11 +6,12 @@ gem 'appraisal', '~> 1.0'
|
|
6
6
|
gem 'aruba', '~> 0.5'
|
7
7
|
gem 'bourne', '~> 1.4'
|
8
8
|
gem 'bundler', '~> 1.3'
|
9
|
-
gem 'capybara', '~> 2.0
|
9
|
+
gem 'capybara', '~> 2.2.0'
|
10
10
|
gem 'cucumber-rails', '~> 1.3', require: false
|
11
11
|
gem 'database_cleaner', '~> 1.0'
|
12
12
|
gem 'factory_girl_rails', '~> 4.2'
|
13
|
-
gem 'rspec-rails'
|
13
|
+
gem 'rspec-rails'
|
14
14
|
gem 'shoulda-matchers', '~> 2.4'
|
15
15
|
gem 'sqlite3', '~> 1.3'
|
16
16
|
gem 'timecop', '~> 0.6'
|
17
|
+
gem 'rspec', '~> 2.14'
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
clearance (1.
|
4
|
+
clearance (1.5.0)
|
5
5
|
bcrypt
|
6
6
|
email_validator (~> 1.4)
|
7
7
|
rails (>= 3.1)
|
@@ -9,151 +9,155 @@ PATH
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
actionmailer (4.
|
13
|
-
actionpack (= 4.
|
12
|
+
actionmailer (4.1.5)
|
13
|
+
actionpack (= 4.1.5)
|
14
|
+
actionview (= 4.1.5)
|
14
15
|
mail (~> 2.5.4)
|
15
|
-
actionpack (4.
|
16
|
-
|
17
|
-
|
18
|
-
erubis (~> 2.7.0)
|
16
|
+
actionpack (4.1.5)
|
17
|
+
actionview (= 4.1.5)
|
18
|
+
activesupport (= 4.1.5)
|
19
19
|
rack (~> 1.5.2)
|
20
20
|
rack-test (~> 0.6.2)
|
21
|
-
|
22
|
-
activesupport (= 4.
|
23
|
-
builder (~> 3.1
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
21
|
+
actionview (4.1.5)
|
22
|
+
activesupport (= 4.1.5)
|
23
|
+
builder (~> 3.1)
|
24
|
+
erubis (~> 2.7.0)
|
25
|
+
activemodel (4.1.5)
|
26
|
+
activesupport (= 4.1.5)
|
27
|
+
builder (~> 3.1)
|
28
|
+
activerecord (4.1.5)
|
29
|
+
activemodel (= 4.1.5)
|
30
|
+
activesupport (= 4.1.5)
|
31
|
+
arel (~> 5.0.0)
|
32
|
+
activesupport (4.1.5)
|
33
|
+
i18n (~> 0.6, >= 0.6.9)
|
34
|
+
json (~> 1.7, >= 1.7.7)
|
35
|
+
minitest (~> 5.1)
|
34
36
|
thread_safe (~> 0.1)
|
35
|
-
tzinfo (~>
|
37
|
+
tzinfo (~> 1.1)
|
36
38
|
appraisal (1.0.0)
|
37
39
|
bundler
|
38
40
|
rake
|
39
41
|
thor (>= 0.14.0)
|
40
|
-
arel (
|
41
|
-
aruba (0.
|
42
|
+
arel (5.0.1.20140414130214)
|
43
|
+
aruba (0.6.1)
|
42
44
|
childprocess (>= 0.3.6)
|
43
45
|
cucumber (>= 1.1.1)
|
44
46
|
rspec-expectations (>= 2.7.0)
|
45
|
-
atomic (1.1.14)
|
46
47
|
bcrypt (3.1.7)
|
47
48
|
bourne (1.5.0)
|
48
49
|
mocha (>= 0.13.2, < 0.15)
|
49
|
-
builder (3.
|
50
|
-
capybara (2.
|
50
|
+
builder (3.2.2)
|
51
|
+
capybara (2.2.1)
|
51
52
|
mime-types (>= 1.16)
|
52
53
|
nokogiri (>= 1.3.3)
|
53
54
|
rack (>= 1.0.0)
|
54
55
|
rack-test (>= 0.5.4)
|
55
|
-
|
56
|
-
|
57
|
-
childprocess (0.4.0)
|
56
|
+
xpath (~> 2.0)
|
57
|
+
childprocess (0.5.3)
|
58
58
|
ffi (~> 1.0, >= 1.0.11)
|
59
|
-
cucumber (1.3.
|
59
|
+
cucumber (1.3.16)
|
60
60
|
builder (>= 2.1.2)
|
61
61
|
diff-lcs (>= 1.1.3)
|
62
62
|
gherkin (~> 2.12)
|
63
63
|
multi_json (>= 1.7.5, < 2.0)
|
64
|
-
multi_test (>= 0.
|
65
|
-
cucumber-rails (1.4.
|
66
|
-
capybara (>= 1.1.2)
|
67
|
-
cucumber (>= 1.2
|
68
|
-
|
69
|
-
|
70
|
-
|
64
|
+
multi_test (>= 0.1.1)
|
65
|
+
cucumber-rails (1.4.1)
|
66
|
+
capybara (>= 1.1.2, < 3)
|
67
|
+
cucumber (>= 1.3.8, < 2)
|
68
|
+
mime-types (~> 1.16)
|
69
|
+
nokogiri (~> 1.5)
|
70
|
+
rails (>= 3, < 5)
|
71
|
+
database_cleaner (1.3.0)
|
71
72
|
diff-lcs (1.2.5)
|
72
73
|
email_validator (1.4.0)
|
73
74
|
activemodel
|
74
75
|
erubis (2.7.0)
|
75
|
-
factory_girl (4.
|
76
|
+
factory_girl (4.4.0)
|
76
77
|
activesupport (>= 3.0.0)
|
77
|
-
factory_girl_rails (4.
|
78
|
-
factory_girl (~> 4.
|
78
|
+
factory_girl_rails (4.4.1)
|
79
|
+
factory_girl (~> 4.4.0)
|
79
80
|
railties (>= 3.0.0)
|
80
81
|
ffi (1.9.3)
|
81
82
|
gherkin (2.12.2)
|
82
83
|
multi_json (~> 1.3)
|
83
84
|
hike (1.2.3)
|
84
|
-
i18n (0.6.
|
85
|
+
i18n (0.6.11)
|
86
|
+
json (1.8.1)
|
85
87
|
mail (2.5.4)
|
86
88
|
mime-types (~> 1.16)
|
87
89
|
treetop (~> 1.4.8)
|
88
|
-
metaclass (0.0.
|
90
|
+
metaclass (0.0.4)
|
89
91
|
mime-types (1.25.1)
|
90
|
-
mini_portile (0.
|
91
|
-
minitest (4.
|
92
|
+
mini_portile (0.6.0)
|
93
|
+
minitest (5.4.0)
|
92
94
|
mocha (0.14.0)
|
93
95
|
metaclass (~> 0.0.1)
|
94
|
-
multi_json (1.
|
95
|
-
multi_test (0.
|
96
|
-
nokogiri (1.6.1)
|
97
|
-
mini_portile (
|
98
|
-
polyglot (0.3.
|
96
|
+
multi_json (1.10.1)
|
97
|
+
multi_test (0.1.1)
|
98
|
+
nokogiri (1.6.3.1)
|
99
|
+
mini_portile (= 0.6.0)
|
100
|
+
polyglot (0.3.5)
|
99
101
|
rack (1.5.2)
|
100
102
|
rack-test (0.6.2)
|
101
103
|
rack (>= 1.0)
|
102
|
-
rails (4.
|
103
|
-
actionmailer (= 4.
|
104
|
-
actionpack (= 4.
|
105
|
-
|
106
|
-
|
104
|
+
rails (4.1.5)
|
105
|
+
actionmailer (= 4.1.5)
|
106
|
+
actionpack (= 4.1.5)
|
107
|
+
actionview (= 4.1.5)
|
108
|
+
activemodel (= 4.1.5)
|
109
|
+
activerecord (= 4.1.5)
|
110
|
+
activesupport (= 4.1.5)
|
107
111
|
bundler (>= 1.3.0, < 2.0)
|
108
|
-
railties (= 4.
|
109
|
-
sprockets-rails (~> 2.0
|
110
|
-
railties (4.
|
111
|
-
actionpack (= 4.
|
112
|
-
activesupport (= 4.
|
112
|
+
railties (= 4.1.5)
|
113
|
+
sprockets-rails (~> 2.0)
|
114
|
+
railties (4.1.5)
|
115
|
+
actionpack (= 4.1.5)
|
116
|
+
activesupport (= 4.1.5)
|
113
117
|
rake (>= 0.8.7)
|
114
118
|
thor (>= 0.18.1, < 2.0)
|
115
|
-
rake (10.
|
116
|
-
rspec
|
117
|
-
|
119
|
+
rake (10.3.2)
|
120
|
+
rspec (2.99.0)
|
121
|
+
rspec-core (~> 2.99.0)
|
122
|
+
rspec-expectations (~> 2.99.0)
|
123
|
+
rspec-mocks (~> 2.99.0)
|
124
|
+
rspec-collection_matchers (1.0.0)
|
125
|
+
rspec-expectations (>= 2.99.0.beta1)
|
126
|
+
rspec-core (2.99.2)
|
127
|
+
rspec-expectations (2.99.2)
|
118
128
|
diff-lcs (>= 1.1.3, < 2.0)
|
119
|
-
rspec-mocks (2.
|
120
|
-
rspec-rails (2.
|
129
|
+
rspec-mocks (2.99.2)
|
130
|
+
rspec-rails (2.99.0)
|
121
131
|
actionpack (>= 3.0)
|
122
132
|
activemodel (>= 3.0)
|
123
133
|
activesupport (>= 3.0)
|
124
134
|
railties (>= 3.0)
|
125
|
-
rspec-
|
126
|
-
rspec-
|
127
|
-
rspec-
|
128
|
-
|
129
|
-
|
130
|
-
childprocess (>= 0.2.5)
|
131
|
-
multi_json (~> 1.0)
|
132
|
-
rubyzip (~> 1.0)
|
133
|
-
websocket (~> 1.0.4)
|
134
|
-
shoulda-matchers (2.5.0)
|
135
|
+
rspec-collection_matchers
|
136
|
+
rspec-core (~> 2.99.0)
|
137
|
+
rspec-expectations (~> 2.99.0)
|
138
|
+
rspec-mocks (~> 2.99.0)
|
139
|
+
shoulda-matchers (2.6.2)
|
135
140
|
activesupport (>= 3.0.0)
|
136
|
-
sprockets (2.
|
141
|
+
sprockets (2.12.1)
|
137
142
|
hike (~> 1.2)
|
138
143
|
multi_json (~> 1.0)
|
139
144
|
rack (~> 1.0)
|
140
145
|
tilt (~> 1.1, != 1.3.0)
|
141
|
-
sprockets-rails (2.
|
146
|
+
sprockets-rails (2.1.3)
|
142
147
|
actionpack (>= 3.0)
|
143
148
|
activesupport (>= 3.0)
|
144
149
|
sprockets (~> 2.8)
|
145
|
-
sqlite3 (1.3.
|
146
|
-
thor (0.
|
147
|
-
thread_safe (0.
|
148
|
-
atomic
|
150
|
+
sqlite3 (1.3.9)
|
151
|
+
thor (0.19.1)
|
152
|
+
thread_safe (0.3.4)
|
149
153
|
tilt (1.4.1)
|
150
154
|
timecop (0.7.1)
|
151
155
|
treetop (1.4.15)
|
152
156
|
polyglot
|
153
157
|
polyglot (>= 0.3.1)
|
154
|
-
tzinfo (
|
155
|
-
|
156
|
-
xpath (
|
158
|
+
tzinfo (1.2.2)
|
159
|
+
thread_safe (~> 0.1)
|
160
|
+
xpath (2.0.0)
|
157
161
|
nokogiri (~> 1.3)
|
158
162
|
|
159
163
|
PLATFORMS
|
@@ -164,12 +168,13 @@ DEPENDENCIES
|
|
164
168
|
aruba (~> 0.5)
|
165
169
|
bourne (~> 1.4)
|
166
170
|
bundler (~> 1.3)
|
167
|
-
capybara (~> 2.0
|
171
|
+
capybara (~> 2.2.0)
|
168
172
|
clearance!
|
169
173
|
cucumber-rails (~> 1.3)
|
170
174
|
database_cleaner (~> 1.0)
|
171
175
|
factory_girl_rails (~> 4.2)
|
172
|
-
rspec
|
176
|
+
rspec (~> 2.14)
|
177
|
+
rspec-rails
|
173
178
|
shoulda-matchers (~> 2.4)
|
174
179
|
sqlite3 (~> 1.3)
|
175
180
|
timecop (~> 0.6)
|
data/NEWS.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
Thank you to all the [contributors](https://github.com/thoughtbot/clearance/graphs/contributors)!
|
2
2
|
|
3
|
+
New for 1.5.0 (October 17, 2014)
|
4
|
+
* Disable clearance routes by setting `config.routes = false`.
|
5
|
+
* Running `rails generate clearance:routes` will dump the default set of
|
6
|
+
routes to your application's routes file for modification.
|
7
|
+
|
3
8
|
New for 1.4.3 (October 3, 2014)
|
4
9
|
* Routing constraints act appropriately when session data is missing.
|
5
10
|
|
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
Clearance
|
2
2
|
=========
|
3
3
|
|
4
|
-
[![Build Status](https://secure.travis-ci.org/thoughtbot/clearance.
|
5
|
-
[![Code Climate](https://codeclimate.com/github/thoughtbot/clearance.
|
4
|
+
[![Build Status](https://secure.travis-ci.org/thoughtbot/clearance.svg)](http://travis-ci.org/thoughtbot/clearance?branch=master)
|
5
|
+
[![Code Climate](https://codeclimate.com/github/thoughtbot/clearance.svg)](https://codeclimate.com/github/thoughtbot/clearance)
|
6
6
|
|
7
7
|
Rails authentication with email & password.
|
8
8
|
|
@@ -60,6 +60,7 @@ Clearance.configure do |config|
|
|
60
60
|
config.cookie_domain = '.example.com'
|
61
61
|
config.cookie_expiration = lambda { |cookies| 1.year.from_now.utc }
|
62
62
|
config.cookie_path = '/'
|
63
|
+
config.routes = true
|
63
64
|
config.httponly = false
|
64
65
|
config.mailer_sender = 'reply@example.com'
|
65
66
|
config.password_strategy = Clearance::PasswordStrategies::BCrypt
|
@@ -151,13 +152,17 @@ end
|
|
151
152
|
Overriding routes
|
152
153
|
-----------------
|
153
154
|
|
154
|
-
See [config/routes.rb](/config/routes.rb) for the default
|
155
|
+
See [config/routes.rb](/config/routes.rb) for the default set of routes.
|
155
156
|
|
156
|
-
|
157
|
+
Route overrides became more difficult with [changes made in Rails
|
158
|
+
4][rails_routes]. For this reason, Clearance 1.5 introduces an option to disable
|
159
|
+
all clearance routes, giving the user full control over routing and URL design.
|
157
160
|
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
+
To disable the routes, set `config.routes = false`. You can optionally run
|
162
|
+
`rails generate clearance:routes` to dump a copy of the default routes into your
|
163
|
+
application for modification.
|
164
|
+
|
165
|
+
[rails_routes]: https://github.com/rails/rails/issues/11895
|
161
166
|
|
162
167
|
Overriding controllers
|
163
168
|
----------------------
|
@@ -173,7 +178,7 @@ class SessionsController < Clearance::SessionsController
|
|
173
178
|
class UsersController < Clearance::UsersController
|
174
179
|
```
|
175
180
|
|
176
|
-
Don't forget to override routes to your new controllers!
|
181
|
+
Don't forget to [override routes](#overriding-routes) to your new controllers!
|
177
182
|
|
178
183
|
Then, override public methods:
|
179
184
|
|
@@ -232,6 +237,19 @@ Override them like any other translation.
|
|
232
237
|
See [config/locales/clearance.en.yml](/config/locales/clearance.en.yml) for the
|
233
238
|
default behavior.
|
234
239
|
|
240
|
+
Overriding layouts
|
241
|
+
----------------
|
242
|
+
|
243
|
+
By default, Clearance uses your application's default layout. If you would like
|
244
|
+
to change the layout that Clearance uses when rendering its views, simply specify
|
245
|
+
the layout in an initializer.
|
246
|
+
|
247
|
+
```ruby
|
248
|
+
Clearance::PasswordsController.layout 'my_passwords_layout'
|
249
|
+
Clearance::SessionsController.layout 'my_sessions_layout'
|
250
|
+
Clearance::UsersController.layout 'my_admin_layout'
|
251
|
+
```
|
252
|
+
|
235
253
|
Overriding views
|
236
254
|
----------------
|
237
255
|
|
data/config/routes.rb
CHANGED
@@ -1,24 +1,26 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
if Clearance.configuration.routes_enabled?
|
2
|
+
Rails.application.routes.draw do
|
3
|
+
resources :passwords,
|
4
|
+
controller: 'clearance/passwords',
|
5
|
+
only: [:create, :new]
|
5
6
|
|
6
|
-
|
7
|
-
|
8
|
-
|
7
|
+
resource :session,
|
8
|
+
controller: 'clearance/sessions',
|
9
|
+
only: [:create]
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
11
|
+
resources :users,
|
12
|
+
controller: 'clearance/users',
|
13
|
+
only: Clearance.configuration.user_actions do
|
14
|
+
resource :password,
|
15
|
+
controller: 'clearance/passwords',
|
16
|
+
only: [:create, :edit, :update]
|
17
|
+
end
|
17
18
|
|
18
|
-
|
19
|
-
|
19
|
+
get '/sign_in' => 'clearance/sessions#new', as: 'sign_in'
|
20
|
+
delete '/sign_out' => 'clearance/sessions#destroy', as: 'sign_out'
|
20
21
|
|
21
|
-
|
22
|
-
|
22
|
+
if Clearance.configuration.allow_sign_up?
|
23
|
+
get '/sign_up' => 'clearance/users#new', as: 'sign_up'
|
24
|
+
end
|
23
25
|
end
|
24
26
|
end
|
data/db/schema.rb
CHANGED
@@ -9,14 +9,14 @@
|
|
9
9
|
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
10
10
|
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
11
11
|
#
|
12
|
-
# It's strongly recommended
|
12
|
+
# It's strongly recommended that you check this file into your version control system.
|
13
13
|
|
14
14
|
ActiveRecord::Schema.define(version: 20110111224543) do
|
15
15
|
|
16
16
|
create_table "users", force: true do |t|
|
17
|
-
t.datetime "created_at",
|
18
|
-
t.datetime "updated_at",
|
19
|
-
t.string "email",
|
17
|
+
t.datetime "created_at", null: false
|
18
|
+
t.datetime "updated_at", null: false
|
19
|
+
t.string "email", null: false
|
20
20
|
t.string "encrypted_password", limit: 128, null: false
|
21
21
|
t.string "confirmation_token", limit: 128
|
22
22
|
t.string "remember_token", limit: 128, null: false
|
@@ -0,0 +1,9 @@
|
|
1
|
+
Feature: copy routes to host application
|
2
|
+
|
3
|
+
Background:
|
4
|
+
Given I have a project with clearance
|
5
|
+
|
6
|
+
Scenario:
|
7
|
+
When I successfully run `bundle exec rails generate clearance:install`
|
8
|
+
And I successfully run `bundle exec rails generate clearance:routes`
|
9
|
+
Then the file "config/routes.rb" should contain "get '/sign_in' => 'clearance/sessions#new', as: 'sign_in'"
|