clearance 1.6.0 → 1.6.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/.gitignore +1 -1
- data/.travis.yml +6 -8
- data/Gemfile +2 -2
- data/Gemfile.lock +20 -19
- data/NEWS.md +3 -0
- data/Rakefile +13 -14
- data/app/mailers/clearance_mailer.rb +9 -4
- data/app/views/clearance_mailer/change_password.html.erb +3 -3
- data/app/views/layouts/application.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/_form.html.erb +1 -1
- data/app/views/users/new.html.erb +1 -1
- data/bin/setup +1 -2
- data/config/locales/clearance.en.yml +4 -4
- data/features/step_definitions/configuration_steps.rb +2 -2
- data/features/support/env.rb +15 -23
- data/gemfiles/rails3.2.gemfile +20 -0
- data/gemfiles/rails4.0.gemfile +20 -0
- data/gemfiles/rails4.1.gemfile +20 -0
- data/gemfiles/rails4.2.gemfile +20 -0
- data/lib/clearance/configuration.rb +1 -1
- data/lib/clearance/session.rb +5 -1
- data/lib/clearance/testing/deny_access_matcher.rb +1 -3
- data/lib/clearance/version.rb +1 -1
- data/lib/generators/clearance/install/install_generator.rb +5 -15
- data/spec/clearance/session_spec.rb +1 -1
- data/{lib/clearance/testing → spec/dummy}/app/controllers/application_controller.rb +0 -0
- data/spec/dummy/application.rb +47 -0
- data/{lib/clearance/testing → spec/dummy}/config/database.yml +0 -0
- data/{lib/clearance/testing → spec/dummy}/config/routes.rb +0 -0
- data/spec/generators/clearance/install/install_generator_spec.rb +118 -0
- data/spec/generators/clearance/routes/routes_generator_spec.rb +17 -0
- data/spec/generators/clearance/specs/specs_generator_spec.rb +26 -0
- data/spec/generators/clearance/views/views_generator_spec.rb +35 -0
- data/spec/mailers/clearance_mailer_spec.rb +48 -19
- data/spec/models/bcrypt_migration_from_sha1_spec.rb +81 -51
- data/spec/models/password_strategies_spec.rb +2 -0
- data/spec/spec_helper.rb +12 -18
- data/spec/support/app_templates/app/controllers/application_controller.rb +2 -0
- data/spec/support/app_templates/app/models/user.rb +5 -0
- data/spec/support/app_templates/config/routes.rb +3 -0
- data/spec/support/cookies.rb +1 -1
- data/spec/support/generator_spec_helpers.rb +40 -0
- metadata +31 -13
- data/.rspec +0 -2
- data/features/add_migrations_to_project.feature +0 -36
- data/features/copy_routes_to_host_application.feature +0 -9
- data/lib/clearance/testing/application.rb +0 -49
- data/lib/clearance/testing/assertion_error.rb +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7d1008b7898db9ab0ed2eb372b1c9ec92c54c98a
|
4
|
+
data.tar.gz: 86b11a51fa7ba23911a500547d8ad065c7d9590a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c62112e27660a5258ad4a2078c5fe993bbf3171e048437ef56572706443b7f24c5ac14ca39cfa80855fd80ea204b8a973630d2fda1ef4b923160223f60f4ef51
|
7
|
+
data.tar.gz: c5a9870f0523c669d49e350cc980a6e29b0a9b9b9a3e2cd08f4439f7607478743068f875b55d348e32ebd8dca478ebce3003b4d4cc502c16d5705cb39147c5cf
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -1,18 +1,15 @@
|
|
1
|
+
cache: bundler
|
2
|
+
|
1
3
|
language:
|
2
4
|
- ruby
|
3
5
|
|
4
6
|
rvm:
|
5
7
|
- 1.9.3
|
6
8
|
- 2.0.0
|
7
|
-
- 2.1.
|
9
|
+
- 2.1.5
|
8
10
|
|
9
11
|
install:
|
10
|
-
- "travis_retry
|
11
|
-
- "bundle exec appraisal generate"
|
12
|
-
- "travis_retry bundle exec appraisal install"
|
13
|
-
|
14
|
-
before_script:
|
15
|
-
- "bundle exec rake db:migrate"
|
12
|
+
- "travis_retry bin/setup"
|
16
13
|
|
17
14
|
script:
|
18
15
|
- "bundle exec appraisal rake"
|
@@ -20,4 +17,5 @@ script:
|
|
20
17
|
branches:
|
21
18
|
only:
|
22
19
|
- master
|
23
|
-
|
20
|
+
|
21
|
+
sudo: false
|
data/Gemfile
CHANGED
@@ -3,15 +3,15 @@ source 'https://rubygems.org'
|
|
3
3
|
gemspec
|
4
4
|
|
5
5
|
gem 'appraisal', '~> 1.0'
|
6
|
+
gem 'ammeter'
|
6
7
|
gem 'aruba', '~> 0.5'
|
7
8
|
gem 'bundler', '~> 1.3'
|
8
9
|
gem 'capybara', '~> 2.2.0'
|
9
10
|
gem 'cucumber-rails', '~> 1.3', require: false
|
10
11
|
gem 'database_cleaner', '~> 1.0'
|
11
12
|
gem 'factory_girl_rails', '~> 4.2'
|
12
|
-
gem 'rspec-rails'
|
13
|
+
gem 'rspec-rails', '~> 3.1'
|
13
14
|
gem 'shoulda-matchers', '~> 2.4'
|
14
15
|
gem 'sqlite3', '~> 1.3'
|
15
16
|
gem 'timecop', '~> 0.6'
|
16
|
-
gem 'rspec', '~> 2.14'
|
17
17
|
gem 'pry', require: false
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
clearance (1.6.
|
4
|
+
clearance (1.6.1)
|
5
5
|
bcrypt
|
6
6
|
email_validator (~> 1.4)
|
7
7
|
rails (>= 3.1)
|
@@ -44,6 +44,10 @@ GEM
|
|
44
44
|
minitest (~> 5.1)
|
45
45
|
thread_safe (~> 0.3, >= 0.3.4)
|
46
46
|
tzinfo (~> 1.1)
|
47
|
+
ammeter (1.1.2)
|
48
|
+
activesupport (>= 3.0)
|
49
|
+
railties (>= 3.0)
|
50
|
+
rspec-rails (>= 2.2)
|
47
51
|
appraisal (1.0.2)
|
48
52
|
bundler
|
49
53
|
rake
|
@@ -138,25 +142,22 @@ GEM
|
|
138
142
|
rake (>= 0.8.7)
|
139
143
|
thor (>= 0.18.1, < 2.0)
|
140
144
|
rake (10.4.2)
|
141
|
-
rspec (
|
142
|
-
rspec-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
rspec-
|
149
|
-
diff-lcs (>= 1.1.3, < 2.0)
|
150
|
-
rspec-mocks (2.99.2)
|
151
|
-
rspec-rails (2.99.0)
|
145
|
+
rspec-core (3.1.7)
|
146
|
+
rspec-support (~> 3.1.0)
|
147
|
+
rspec-expectations (3.1.2)
|
148
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
149
|
+
rspec-support (~> 3.1.0)
|
150
|
+
rspec-mocks (3.1.3)
|
151
|
+
rspec-support (~> 3.1.0)
|
152
|
+
rspec-rails (3.1.0)
|
152
153
|
actionpack (>= 3.0)
|
153
|
-
activemodel (>= 3.0)
|
154
154
|
activesupport (>= 3.0)
|
155
155
|
railties (>= 3.0)
|
156
|
-
rspec-
|
157
|
-
rspec-
|
158
|
-
rspec-
|
159
|
-
rspec-
|
156
|
+
rspec-core (~> 3.1.0)
|
157
|
+
rspec-expectations (~> 3.1.0)
|
158
|
+
rspec-mocks (~> 3.1.0)
|
159
|
+
rspec-support (~> 3.1.0)
|
160
|
+
rspec-support (3.1.2)
|
160
161
|
shoulda-matchers (2.7.0)
|
161
162
|
activesupport (>= 3.0.0)
|
162
163
|
slop (3.6.0)
|
@@ -183,6 +184,7 @@ PLATFORMS
|
|
183
184
|
ruby
|
184
185
|
|
185
186
|
DEPENDENCIES
|
187
|
+
ammeter
|
186
188
|
appraisal (~> 1.0)
|
187
189
|
aruba (~> 0.5)
|
188
190
|
bundler (~> 1.3)
|
@@ -192,8 +194,7 @@ DEPENDENCIES
|
|
192
194
|
database_cleaner (~> 1.0)
|
193
195
|
factory_girl_rails (~> 4.2)
|
194
196
|
pry
|
195
|
-
rspec (~>
|
196
|
-
rspec-rails
|
197
|
+
rspec-rails (~> 3.1)
|
197
198
|
shoulda-matchers (~> 2.4)
|
198
199
|
sqlite3 (~> 1.3)
|
199
200
|
timecop (~> 0.6)
|
data/NEWS.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
Thank you to all the [contributors](https://github.com/thoughtbot/clearance/graphs/contributors)!
|
2
2
|
|
3
|
+
New for 1.6.1 (January 6, 2015)
|
4
|
+
* Secure cookies are no longer overwritten when the user visits a non-HTTPS URL.
|
5
|
+
|
3
6
|
New for 1.6.0 (December 20, 2014)
|
4
7
|
* When using Rails 4.2, password reset emails are sent with the
|
5
8
|
ActiveJob-compatible `#deliver_later` method.
|
data/Rakefile
CHANGED
@@ -1,24 +1,23 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
2
|
+
require "rubygems"
|
3
|
+
require "bundler/setup"
|
4
|
+
require "bundler/gem_tasks"
|
5
5
|
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
9
|
-
require 'clearance/testing/application'
|
6
|
+
require "rake"
|
7
|
+
require "cucumber/rake/task"
|
8
|
+
require "rspec/core/rake_task"
|
10
9
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
task :all => [:spec, :cucumber]
|
10
|
+
namespace :dummy do
|
11
|
+
require_relative "spec/dummy/application"
|
12
|
+
Dummy::Application.load_tasks
|
13
|
+
end
|
16
14
|
|
17
|
-
|
15
|
+
desc "Default"
|
16
|
+
task default: [:spec, :cucumber]
|
18
17
|
|
19
18
|
Cucumber::Rake::Task.new(:cucumber) do |t|
|
20
19
|
t.fork = false
|
21
|
-
t.cucumber_opts = [
|
20
|
+
t.cucumber_opts = ["--format", (ENV["CUCUMBER_FORMAT"] || "progress")]
|
22
21
|
end
|
23
22
|
|
24
23
|
RSpec::Core::RakeTask.new(:spec)
|
@@ -1,9 +1,14 @@
|
|
1
1
|
class ClearanceMailer < ActionMailer::Base
|
2
2
|
def change_password(user)
|
3
3
|
@user = user
|
4
|
-
mail
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
mail(
|
5
|
+
from: Clearance.configuration.mailer_sender,
|
6
|
+
to: @user.email,
|
7
|
+
subject: I18n.t(
|
8
|
+
:change_password,
|
9
|
+
scope: [:clearance, :models, :clearance_mailer],
|
10
|
+
default: "Change your password"
|
11
|
+
)
|
12
|
+
)
|
8
13
|
end
|
9
14
|
end
|
@@ -4,8 +4,8 @@
|
|
4
4
|
<p><%= t '.description' %></p>
|
5
5
|
|
6
6
|
<%= form_for :password_reset,
|
7
|
-
:
|
8
|
-
:
|
7
|
+
url: user_password_path(@user, token: @user.confirmation_token),
|
8
|
+
html: { method: :put } do |form| %>
|
9
9
|
<div class="password-field">
|
10
10
|
<%= form.label :password %>
|
11
11
|
<%= form.password_field :password %>
|
@@ -3,10 +3,10 @@
|
|
3
3
|
|
4
4
|
<p><%= t '.description' %></p>
|
5
5
|
|
6
|
-
<%= form_for :password, :
|
6
|
+
<%= form_for :password, url: passwords_path do |form| %>
|
7
7
|
<div class="text-field">
|
8
8
|
<%= form.label :email %>
|
9
|
-
<%= form.text_field :email, :
|
9
|
+
<%= form.text_field :email, type: 'email' %>
|
10
10
|
</div>
|
11
11
|
|
12
12
|
<div class="submit-field">
|
@@ -1,7 +1,7 @@
|
|
1
|
-
<%= form_for :session, :
|
1
|
+
<%= form_for :session, url: session_path do |form| %>
|
2
2
|
<div class="text-field">
|
3
3
|
<%= form.label :email %>
|
4
|
-
<%= form.text_field :email, :
|
4
|
+
<%= form.text_field :email, type: 'email' %>
|
5
5
|
</div>
|
6
6
|
|
7
7
|
<div class="password-field">
|
data/bin/setup
CHANGED
@@ -5,8 +5,7 @@ set -e
|
|
5
5
|
# Install required gems, including Appraisal, which helps us test against
|
6
6
|
# multiple Rails versions
|
7
7
|
bundle install
|
8
|
-
bundle exec appraisal clean
|
9
8
|
bundle exec appraisal install
|
10
9
|
|
11
10
|
# Set up database for the application that Clearance tests against
|
12
|
-
RAILS_ENV=test bundle exec rake db:reset
|
11
|
+
RAILS_ENV=test bundle exec rake dummy:db:reset
|
@@ -2,10 +2,10 @@
|
|
2
2
|
en:
|
3
3
|
clearance_mailer:
|
4
4
|
change_password:
|
5
|
-
closing: If you didn't request this, ignore this email. Your password
|
6
|
-
|
7
|
-
opening:
|
8
|
-
your password:
|
5
|
+
closing: If you didn't request this, ignore this email. Your password has
|
6
|
+
not been changed.
|
7
|
+
opening: "Someone, hopefully you, requested we send you a link to change
|
8
|
+
your password:"
|
9
9
|
flashes:
|
10
10
|
failure_after_create: Bad email or password.
|
11
11
|
failure_after_update: Password can't be blank.
|
@@ -17,7 +17,7 @@ When "I have a project with clearance" do
|
|
17
17
|
|
18
18
|
step 'I cd to "testapp"'
|
19
19
|
|
20
|
-
unless
|
20
|
+
unless Dummy.rails4?
|
21
21
|
step 'I remove the file "public/index.html"'
|
22
22
|
end
|
23
23
|
|
@@ -145,7 +145,7 @@ When /^I create a migration with clearance fields$/ do
|
|
145
145
|
end
|
146
146
|
|
147
147
|
def controller_test_dir
|
148
|
-
if
|
148
|
+
if Dummy.rails4?
|
149
149
|
'controllers'
|
150
150
|
else
|
151
151
|
'functional'
|
data/features/support/env.rb
CHANGED
@@ -1,32 +1,24 @@
|
|
1
|
-
ENV[
|
1
|
+
ENV["RAILS_ENV"] ||= "test"
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
require "bundler"
|
4
|
+
require "rails/all"
|
5
5
|
|
6
|
-
require
|
7
|
-
require
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
require
|
12
|
-
require
|
13
|
-
require
|
14
|
-
require
|
15
|
-
require 'cucumber/rails/capybara'
|
16
|
-
require 'cucumber/rails/database'
|
17
|
-
require 'cucumber/rails/hooks'
|
18
|
-
require 'cucumber/rails/world'
|
6
|
+
require "clearance"
|
7
|
+
require "aruba/cucumber"
|
8
|
+
require_relative "../../spec/dummy/application"
|
9
|
+
require "cucumber/rails/action_controller"
|
10
|
+
require "cucumber/rails/application"
|
11
|
+
require "cucumber/rails/capybara"
|
12
|
+
require "cucumber/rails/database"
|
13
|
+
require "cucumber/rails/hooks"
|
14
|
+
require "cucumber/rails/world"
|
19
15
|
|
20
16
|
ActionController::Base.allow_rescue = false
|
21
17
|
Capybara.default_selector = :css
|
22
|
-
Capybara.save_and_open_page_path =
|
23
|
-
|
18
|
+
Capybara.save_and_open_page_path = "tmp"
|
19
|
+
Dummy::Application.initialize!
|
24
20
|
|
25
|
-
|
26
|
-
DatabaseCleaner.strategy = :transaction
|
27
|
-
rescue NameError
|
28
|
-
raise 'You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it.'
|
29
|
-
end
|
21
|
+
DatabaseCleaner.strategy = :transaction
|
30
22
|
|
31
23
|
Around do |scenario, block|
|
32
24
|
Bundler.with_clean_env do
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "appraisal", "~> 1.0"
|
6
|
+
gem "ammeter"
|
7
|
+
gem "aruba", "~> 0.5"
|
8
|
+
gem "bundler", "~> 1.3"
|
9
|
+
gem "capybara", "~> 2.2.0"
|
10
|
+
gem "cucumber-rails", "~> 1.3", :require => false
|
11
|
+
gem "database_cleaner", "~> 1.0"
|
12
|
+
gem "factory_girl_rails", "~> 4.2"
|
13
|
+
gem "rspec-rails", "~> 3.1"
|
14
|
+
gem "shoulda-matchers", "~> 2.4"
|
15
|
+
gem "sqlite3", "~> 1.3"
|
16
|
+
gem "timecop", "~> 0.6"
|
17
|
+
gem "pry", :require => false
|
18
|
+
gem "rails", "~> 3.2.21"
|
19
|
+
|
20
|
+
gemspec :path => "../"
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "appraisal", "~> 1.0"
|
6
|
+
gem "ammeter"
|
7
|
+
gem "aruba", "~> 0.5"
|
8
|
+
gem "bundler", "~> 1.3"
|
9
|
+
gem "capybara", "~> 2.2.0"
|
10
|
+
gem "cucumber-rails", "~> 1.3", :require => false
|
11
|
+
gem "database_cleaner", "~> 1.0"
|
12
|
+
gem "factory_girl_rails", "~> 4.2"
|
13
|
+
gem "rspec-rails", "~> 3.1"
|
14
|
+
gem "shoulda-matchers", "~> 2.4"
|
15
|
+
gem "sqlite3", "~> 1.3"
|
16
|
+
gem "timecop", "~> 0.6"
|
17
|
+
gem "pry", :require => false
|
18
|
+
gem "rails", "~> 4.0.12"
|
19
|
+
|
20
|
+
gemspec :path => "../"
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "appraisal", "~> 1.0"
|
6
|
+
gem "ammeter"
|
7
|
+
gem "aruba", "~> 0.5"
|
8
|
+
gem "bundler", "~> 1.3"
|
9
|
+
gem "capybara", "~> 2.2.0"
|
10
|
+
gem "cucumber-rails", "~> 1.3", :require => false
|
11
|
+
gem "database_cleaner", "~> 1.0"
|
12
|
+
gem "factory_girl_rails", "~> 4.2"
|
13
|
+
gem "rspec-rails", "~> 3.1"
|
14
|
+
gem "shoulda-matchers", "~> 2.4"
|
15
|
+
gem "sqlite3", "~> 1.3"
|
16
|
+
gem "timecop", "~> 0.6"
|
17
|
+
gem "pry", :require => false
|
18
|
+
gem "rails", "~> 4.1.8"
|
19
|
+
|
20
|
+
gemspec :path => "../"
|