clearance 1.8.0 → 1.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/.travis.yml +24 -6
  4. data/.yardopts +6 -0
  5. data/Appraisals +12 -4
  6. data/CONTRIBUTING.md +4 -1
  7. data/Gemfile +2 -2
  8. data/Gemfile.lock +87 -85
  9. data/NEWS.md +672 -311
  10. data/README.md +185 -330
  11. data/app/controllers/clearance/passwords_controller.rb +25 -19
  12. data/app/controllers/clearance/sessions_controller.rb +17 -4
  13. data/app/controllers/clearance/users_controller.rb +10 -4
  14. data/app/mailers/clearance_mailer.rb +2 -3
  15. data/app/views/clearance_mailer/change_password.html.erb +6 -3
  16. data/app/views/clearance_mailer/change_password.text.erb +5 -0
  17. data/app/views/layouts/application.html.erb +2 -2
  18. data/app/views/passwords/create.html.erb +1 -1
  19. data/app/views/passwords/edit.html.erb +2 -2
  20. data/app/views/passwords/new.html.erb +2 -2
  21. data/app/views/sessions/_form.html.erb +2 -2
  22. data/app/views/sessions/new.html.erb +1 -1
  23. data/app/views/users/new.html.erb +2 -2
  24. data/bin/setup +6 -2
  25. data/config/locales/clearance.en.yml +6 -0
  26. data/db/migrate/20110111224543_create_clearance_users.rb +1 -1
  27. data/gemfiles/{rails3.2.gemfile → rails32.gemfile} +1 -1
  28. data/gemfiles/{rails4.0.gemfile → rails40.gemfile} +2 -2
  29. data/gemfiles/{rails4.1.gemfile → rails41.gemfile} +2 -2
  30. data/gemfiles/{rails4.2.gemfile → rails42.gemfile} +2 -2
  31. data/gemfiles/rails50.gemfile +19 -0
  32. data/lib/clearance/authentication.rb +52 -1
  33. data/lib/clearance/authorization.rb +47 -4
  34. data/lib/clearance/back_door.rb +1 -0
  35. data/lib/clearance/configuration.rb +127 -15
  36. data/lib/clearance/constraints/signed_in.rb +21 -0
  37. data/lib/clearance/constraints/signed_out.rb +12 -0
  38. data/lib/clearance/constraints.rb +12 -0
  39. data/lib/clearance/controller.rb +13 -0
  40. data/lib/clearance/default_sign_in_guard.rb +17 -0
  41. data/lib/clearance/engine.rb +24 -4
  42. data/lib/clearance/password_strategies/bcrypt.rb +9 -2
  43. data/lib/clearance/password_strategies/bcrypt_migration_from_sha1.rb +19 -0
  44. data/lib/clearance/password_strategies/blowfish.rb +17 -0
  45. data/lib/clearance/password_strategies/sha1.rb +17 -0
  46. data/lib/clearance/password_strategies.rb +13 -0
  47. data/lib/clearance/rack_session.rb +13 -0
  48. data/lib/clearance/rspec.rb +15 -4
  49. data/lib/clearance/session.rb +46 -1
  50. data/lib/clearance/session_status.rb +7 -0
  51. data/lib/clearance/sign_in_guard.rb +65 -0
  52. data/lib/clearance/test_unit.rb +3 -3
  53. data/lib/clearance/testing/controller_helpers.rb +44 -0
  54. data/lib/clearance/testing/deny_access_matcher.rb +35 -1
  55. data/lib/clearance/testing/helpers.rb +9 -25
  56. data/lib/clearance/testing/view_helpers.rb +32 -0
  57. data/lib/clearance/token.rb +7 -0
  58. data/lib/clearance/user.rb +159 -0
  59. data/lib/clearance/version.rb +1 -1
  60. data/lib/clearance.rb +2 -0
  61. data/lib/generators/clearance/install/install_generator.rb +13 -3
  62. data/lib/generators/clearance/install/templates/db/migrate/add_clearance_to_users.rb +3 -3
  63. data/lib/generators/clearance/install/templates/db/migrate/create_users.rb +2 -2
  64. data/lib/generators/clearance/routes/routes_generator.rb +23 -0
  65. data/lib/generators/clearance/routes/templates/routes.rb +7 -7
  66. data/lib/generators/clearance/specs/templates/features/clearance/user_signs_out_spec.rb.tt +1 -1
  67. data/lib/generators/clearance/specs/templates/features/clearance/visitor_resets_password_spec.rb.tt +12 -2
  68. data/lib/generators/clearance/specs/templates/features/clearance/visitor_signs_in_spec.rb.tt +1 -1
  69. data/lib/generators/clearance/specs/templates/features/clearance/visitor_signs_up_spec.rb.tt +1 -1
  70. data/lib/generators/clearance/specs/templates/features/clearance/visitor_updates_password_spec.rb.tt +1 -1
  71. data/spec/acceptance/clearance_installation_spec.rb +4 -1
  72. data/spec/app_templates/config/initializers/clearance.rb +2 -0
  73. data/spec/app_templates/testapp/app/controllers/home_controller.rb +5 -1
  74. data/spec/app_templates/testapp/config/initializers/action_mailer.rb +1 -3
  75. data/spec/clearance/controller_spec.rb +11 -0
  76. data/spec/clearance/rack_session_spec.rb +5 -5
  77. data/spec/clearance/testing/{helpers_spec.rb → controller_helpers_spec.rb} +12 -12
  78. data/spec/clearance/testing/view_helpers_spec.rb +37 -0
  79. data/spec/configuration_spec.rb +24 -0
  80. data/spec/controllers/apis_controller_spec.rb +6 -2
  81. data/spec/controllers/forgeries_controller_spec.rb +6 -1
  82. data/spec/controllers/passwords_controller_spec.rb +1 -11
  83. data/spec/controllers/permissions_controller_spec.rb +13 -3
  84. data/spec/controllers/sessions_controller_spec.rb +4 -4
  85. data/spec/dummy/app/controllers/application_controller.rb +5 -1
  86. data/spec/dummy/application.rb +4 -0
  87. data/spec/generators/clearance/install/install_generator_spec.rb +15 -3
  88. data/spec/generators/clearance/routes/routes_generator_spec.rb +5 -1
  89. data/spec/generators/clearance/views/views_generator_spec.rb +11 -10
  90. data/spec/helpers/helper_helpers_spec.rb +10 -0
  91. data/spec/mailers/clearance_mailer_spec.rb +13 -19
  92. data/spec/password_strategies/bcrypt_migration_from_sha1_spec.rb +6 -0
  93. data/spec/password_strategies/blowfish_spec.rb +6 -0
  94. data/spec/password_strategies/sha1_spec.rb +6 -0
  95. data/spec/spec_helper.rb +7 -0
  96. data/spec/support/generator_spec_helpers.rb +4 -0
  97. data/spec/support/http_method_shim.rb +23 -0
  98. data/spec/user_spec.rb +9 -0
  99. data/spec/views/view_helpers_spec.rb +10 -0
  100. metadata +19 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: df978f0510867a2d80c064924da2b102af823b5e
4
- data.tar.gz: be638b6207733d3a873c344f40dbbe540616805a
3
+ metadata.gz: 0472155cf20becdae95b0449996f13422cf8fd9f
4
+ data.tar.gz: 593e5208e89806394b03e9c0bac1c69f6836434b
5
5
  SHA512:
6
- metadata.gz: 4d3edea1ae4ce2ff2e47e6a9c747349a58978642c72b46862c303b6c0510a888cfd58668e881dfdf974369ea05c7b316a74795643c89a26059210f2f20ae8911
7
- data.tar.gz: c31439f8e17dacb54727dd968ff6e840129ceb1e0f3fa6fb9bc99c3f4bf71a2d4bff43d98d9d22e37dba36a38d4d4bebb8e743d6a7a827cf0025e5ddde6e0b1a
6
+ metadata.gz: c855e609161a0adc70754a033596de44ffc49ded096b0f1e61bb541c670e1d75e82f518e73f5a0ed53d00d25b4763e12d2f9b494a23802c3428154304665097d
7
+ data.tar.gz: b243f157204f0256c3405e62c8e24219c5101e7852c3818d21e057c0405c36d02aa59dbfe4a3d7f27260eb802b2d1f9d5ff306135fbce1f78d6dcefb39d52cbb
data/.gitignore CHANGED
@@ -9,3 +9,5 @@ gemfiles/*.lock
9
9
  log/*.log
10
10
  pkg
11
11
  tmp/
12
+ doc/
13
+ .yardoc/
data/.travis.yml CHANGED
@@ -6,14 +6,32 @@ language:
6
6
  rvm:
7
7
  - 1.9.3
8
8
  - 2.0.0
9
- - 2.1.5
10
- - 2.2.0
9
+ - 2.1.8
10
+ - 2.2.4
11
+ - 2.3.0
11
12
 
12
- install:
13
- - "travis_retry bin/setup"
13
+ gemfile:
14
+ - gemfiles/rails32.gemfile
15
+ - gemfiles/rails40.gemfile
16
+ - gemfiles/rails41.gemfile
17
+ - gemfiles/rails42.gemfile
18
+ - gemfiles/rails50.gemfile
19
+
20
+ matrix:
21
+ exclude:
22
+ - rvm: 1.9.3
23
+ gemfile: gemfiles/rails50.gemfile
24
+ - rvm: 2.0.0
25
+ gemfile: gemfiles/rails50.gemfile
26
+ - rvm: 2.1.8
27
+ gemfile: gemfiles/rails50.gemfile
28
+ - rvm: 2.2.4
29
+ gemfile: gemfiles/rails32.gemfile
30
+ - rvm: 2.3.0
31
+ gemfile: gemfiles/rails32.gemfile
14
32
 
15
- script:
16
- - "bundle exec appraisal rake"
33
+ install:
34
+ - "bin/setup"
17
35
 
18
36
  branches:
19
37
  only:
data/.yardopts ADDED
@@ -0,0 +1,6 @@
1
+ --protected
2
+ --private
3
+ --hide-api private
4
+ --exclude templates
5
+ --markup markdown
6
+ --markup-provider redcarpet
data/Appraisals CHANGED
@@ -1,18 +1,26 @@
1
1
  if RUBY_VERSION < "2.2.0"
2
- appraise 'rails3.2' do
2
+ appraise 'rails32' do
3
3
  gem 'rails', '~> 3.2.21'
4
4
  end
5
5
  end
6
6
 
7
- appraise 'rails4.0' do
7
+ appraise 'rails40' do
8
8
  gem 'rails', '~> 4.0.13'
9
9
  gem 'test-unit'
10
10
  end
11
11
 
12
- appraise 'rails4.1' do
12
+ appraise 'rails41' do
13
13
  gem 'rails', '~> 4.1.9'
14
14
  end
15
15
 
16
- appraise 'rails4.2' do
16
+ appraise 'rails42' do
17
17
  gem 'rails', '~> 4.2.0'
18
18
  end
19
+
20
+ if RUBY_VERSION >= "2.2.0"
21
+ appraise "rails50" do
22
+ gem "rails", "~> 5.0.0.beta3"
23
+ gem "rails-controller-testing"
24
+ gem "rspec-rails", "~> 3.5.0.beta1"
25
+ end
26
+ end
data/CONTRIBUTING.md CHANGED
@@ -1,4 +1,7 @@
1
- We love pull requests. Here's a quick guide:
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 CHANGED
@@ -5,11 +5,11 @@ gemspec
5
5
  gem 'appraisal', '~> 1.0'
6
6
  gem 'ammeter'
7
7
  gem 'bundler', '~> 1.3'
8
- gem 'capybara', '>= 2.3'
8
+ gem 'capybara', '>= 2.6.2'
9
9
  gem 'database_cleaner', '~> 1.0'
10
10
  gem 'factory_girl_rails', '~> 4.2'
11
11
  gem 'rspec-rails', '~> 3.1'
12
- gem 'shoulda-matchers', '~> 2.4'
12
+ gem 'shoulda-matchers', '~> 2.8'
13
13
  gem 'sqlite3', '~> 1.3'
14
14
  gem 'timecop', '~> 0.6'
15
15
  gem 'pry', require: false
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- clearance (1.8.0)
4
+ clearance (1.13.0)
5
5
  bcrypt
6
6
  email_validator (~> 1.4)
7
7
  rails (>= 3.1)
@@ -9,62 +9,65 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- actionmailer (4.2.0)
13
- actionpack (= 4.2.0)
14
- actionview (= 4.2.0)
15
- activejob (= 4.2.0)
12
+ actionmailer (4.2.5)
13
+ actionpack (= 4.2.5)
14
+ actionview (= 4.2.5)
15
+ activejob (= 4.2.5)
16
16
  mail (~> 2.5, >= 2.5.4)
17
17
  rails-dom-testing (~> 1.0, >= 1.0.5)
18
- actionpack (4.2.0)
19
- actionview (= 4.2.0)
20
- activesupport (= 4.2.0)
21
- rack (~> 1.6.0)
18
+ actionpack (4.2.5)
19
+ actionview (= 4.2.5)
20
+ activesupport (= 4.2.5)
21
+ rack (~> 1.6)
22
22
  rack-test (~> 0.6.2)
23
23
  rails-dom-testing (~> 1.0, >= 1.0.5)
24
- rails-html-sanitizer (~> 1.0, >= 1.0.1)
25
- actionview (4.2.0)
26
- activesupport (= 4.2.0)
24
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
25
+ actionview (4.2.5)
26
+ activesupport (= 4.2.5)
27
27
  builder (~> 3.1)
28
28
  erubis (~> 2.7.0)
29
29
  rails-dom-testing (~> 1.0, >= 1.0.5)
30
- rails-html-sanitizer (~> 1.0, >= 1.0.1)
31
- activejob (4.2.0)
32
- activesupport (= 4.2.0)
30
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
31
+ activejob (4.2.5)
32
+ activesupport (= 4.2.5)
33
33
  globalid (>= 0.3.0)
34
- activemodel (4.2.0)
35
- activesupport (= 4.2.0)
34
+ activemodel (4.2.5)
35
+ activesupport (= 4.2.5)
36
36
  builder (~> 3.1)
37
- activerecord (4.2.0)
38
- activemodel (= 4.2.0)
39
- activesupport (= 4.2.0)
37
+ activerecord (4.2.5)
38
+ activemodel (= 4.2.5)
39
+ activesupport (= 4.2.5)
40
40
  arel (~> 6.0)
41
- activesupport (4.2.0)
41
+ activesupport (4.2.5)
42
42
  i18n (~> 0.7)
43
43
  json (~> 1.7, >= 1.7.7)
44
44
  minitest (~> 5.1)
45
45
  thread_safe (~> 0.3, >= 0.3.4)
46
46
  tzinfo (~> 1.1)
47
- ammeter (1.1.2)
47
+ addressable (2.4.0)
48
+ ammeter (1.1.3)
48
49
  activesupport (>= 3.0)
49
50
  railties (>= 3.0)
50
51
  rspec-rails (>= 2.2)
51
- appraisal (1.0.2)
52
+ appraisal (1.0.3)
52
53
  bundler
53
54
  rake
54
55
  thor (>= 0.14.0)
55
- arel (6.0.0)
56
- bcrypt (3.1.9)
56
+ arel (6.0.3)
57
+ bcrypt (3.1.10)
57
58
  builder (3.2.2)
58
- capybara (2.4.4)
59
+ capybara (2.6.2)
60
+ addressable
59
61
  mime-types (>= 1.16)
60
62
  nokogiri (>= 1.3.3)
61
63
  rack (>= 1.0.0)
62
64
  rack-test (>= 0.5.4)
63
65
  xpath (~> 2.0)
64
66
  coderay (1.1.0)
65
- database_cleaner (1.3.0)
67
+ concurrent-ruby (1.0.1)
68
+ database_cleaner (1.5.1)
66
69
  diff-lcs (1.2.5)
67
- email_validator (1.5.0)
70
+ email_validator (1.6.0)
68
71
  activemodel
69
72
  erubis (2.7.0)
70
73
  factory_girl (4.5.0)
@@ -72,87 +75,83 @@ GEM
72
75
  factory_girl_rails (4.5.0)
73
76
  factory_girl (~> 4.5.0)
74
77
  railties (>= 3.0.0)
75
- globalid (0.3.0)
78
+ globalid (0.3.6)
76
79
  activesupport (>= 4.1.0)
77
- hike (1.2.3)
78
80
  i18n (0.7.0)
79
- json (1.8.1)
80
- loofah (2.0.1)
81
+ json (1.8.3)
82
+ loofah (2.0.3)
81
83
  nokogiri (>= 1.5.9)
82
84
  mail (2.6.3)
83
85
  mime-types (>= 1.16, < 3)
84
86
  method_source (0.8.2)
85
- mime-types (2.4.3)
86
- mini_portile (0.6.2)
87
- minitest (5.5.0)
88
- multi_json (1.10.1)
89
- nokogiri (1.6.5)
90
- mini_portile (~> 0.6.0)
91
- pry (0.10.1)
87
+ mime-types (2.99)
88
+ mini_portile2 (2.0.0)
89
+ minitest (5.8.3)
90
+ nokogiri (1.6.7.1)
91
+ mini_portile2 (~> 2.0.0.rc2)
92
+ pry (0.10.3)
92
93
  coderay (~> 1.1.0)
93
94
  method_source (~> 0.8.1)
94
95
  slop (~> 3.4)
95
- rack (1.6.0)
96
+ rack (1.6.4)
96
97
  rack-test (0.6.3)
97
98
  rack (>= 1.0)
98
- rails (4.2.0)
99
- actionmailer (= 4.2.0)
100
- actionpack (= 4.2.0)
101
- actionview (= 4.2.0)
102
- activejob (= 4.2.0)
103
- activemodel (= 4.2.0)
104
- activerecord (= 4.2.0)
105
- activesupport (= 4.2.0)
99
+ rails (4.2.5)
100
+ actionmailer (= 4.2.5)
101
+ actionpack (= 4.2.5)
102
+ actionview (= 4.2.5)
103
+ activejob (= 4.2.5)
104
+ activemodel (= 4.2.5)
105
+ activerecord (= 4.2.5)
106
+ activesupport (= 4.2.5)
106
107
  bundler (>= 1.3.0, < 2.0)
107
- railties (= 4.2.0)
108
+ railties (= 4.2.5)
108
109
  sprockets-rails
109
110
  rails-deprecated_sanitizer (1.0.3)
110
111
  activesupport (>= 4.2.0.alpha)
111
- rails-dom-testing (1.0.5)
112
+ rails-dom-testing (1.0.7)
112
113
  activesupport (>= 4.2.0.beta, < 5.0)
113
114
  nokogiri (~> 1.6.0)
114
115
  rails-deprecated_sanitizer (>= 1.0.1)
115
- rails-html-sanitizer (1.0.1)
116
+ rails-html-sanitizer (1.0.2)
116
117
  loofah (~> 2.0)
117
- railties (4.2.0)
118
- actionpack (= 4.2.0)
119
- activesupport (= 4.2.0)
118
+ railties (4.2.5)
119
+ actionpack (= 4.2.5)
120
+ activesupport (= 4.2.5)
120
121
  rake (>= 0.8.7)
121
122
  thor (>= 0.18.1, < 2.0)
122
123
  rake (10.4.2)
123
- rspec-core (3.1.7)
124
- rspec-support (~> 3.1.0)
125
- rspec-expectations (3.1.2)
124
+ rspec-core (3.4.1)
125
+ rspec-support (~> 3.4.0)
126
+ rspec-expectations (3.4.0)
126
127
  diff-lcs (>= 1.2.0, < 2.0)
127
- rspec-support (~> 3.1.0)
128
- rspec-mocks (3.1.3)
129
- rspec-support (~> 3.1.0)
130
- rspec-rails (3.1.0)
131
- actionpack (>= 3.0)
132
- activesupport (>= 3.0)
133
- railties (>= 3.0)
134
- rspec-core (~> 3.1.0)
135
- rspec-expectations (~> 3.1.0)
136
- rspec-mocks (~> 3.1.0)
137
- rspec-support (~> 3.1.0)
138
- rspec-support (3.1.2)
139
- shoulda-matchers (2.7.0)
128
+ rspec-support (~> 3.4.0)
129
+ rspec-mocks (3.4.0)
130
+ diff-lcs (>= 1.2.0, < 2.0)
131
+ rspec-support (~> 3.4.0)
132
+ rspec-rails (3.4.0)
133
+ actionpack (>= 3.0, < 4.3)
134
+ activesupport (>= 3.0, < 4.3)
135
+ railties (>= 3.0, < 4.3)
136
+ rspec-core (~> 3.4.0)
137
+ rspec-expectations (~> 3.4.0)
138
+ rspec-mocks (~> 3.4.0)
139
+ rspec-support (~> 3.4.0)
140
+ rspec-support (3.4.1)
141
+ shoulda-matchers (2.8.0)
140
142
  activesupport (>= 3.0.0)
141
143
  slop (3.6.0)
142
- sprockets (2.12.3)
143
- hike (~> 1.2)
144
- multi_json (~> 1.0)
145
- rack (~> 1.0)
146
- tilt (~> 1.1, != 1.3.0)
147
- sprockets-rails (2.2.2)
148
- actionpack (>= 3.0)
149
- activesupport (>= 3.0)
150
- sprockets (>= 2.8, < 4.0)
151
- sqlite3 (1.3.10)
144
+ sprockets (3.5.2)
145
+ concurrent-ruby (~> 1.0)
146
+ rack (> 1, < 3)
147
+ sprockets-rails (3.0.4)
148
+ actionpack (>= 4.0)
149
+ activesupport (>= 4.0)
150
+ sprockets (>= 3.0.0)
151
+ sqlite3 (1.3.11)
152
152
  thor (0.19.1)
153
- thread_safe (0.3.4)
154
- tilt (1.4.1)
155
- timecop (0.7.1)
153
+ thread_safe (0.3.5)
154
+ timecop (0.8.0)
156
155
  tzinfo (1.2.2)
157
156
  thread_safe (~> 0.1)
158
157
  xpath (2.0.0)
@@ -165,12 +164,15 @@ DEPENDENCIES
165
164
  ammeter
166
165
  appraisal (~> 1.0)
167
166
  bundler (~> 1.3)
168
- capybara (>= 2.3)
167
+ capybara (>= 2.6.2)
169
168
  clearance!
170
169
  database_cleaner (~> 1.0)
171
170
  factory_girl_rails (~> 4.2)
172
171
  pry
173
172
  rspec-rails (~> 3.1)
174
- shoulda-matchers (~> 2.4)
173
+ shoulda-matchers (~> 2.8)
175
174
  sqlite3 (~> 1.3)
176
175
  timecop (~> 0.6)
176
+
177
+ BUNDLED WITH
178
+ 1.10.6