thoughtbot-clearance 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.textile +5 -0
- data/README.textile +47 -29
- data/Rakefile +8 -8
- data/app/controllers/clearance/confirmations_controller.rb +3 -3
- data/app/controllers/clearance/passwords_controller.rb +4 -4
- data/app/controllers/clearance/sessions_controller.rb +1 -1
- data/app/controllers/clearance/users_controller.rb +2 -2
- metadata +7 -7
data/CHANGELOG.textile
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
h1. 0.6.1 (04/21/2009)
|
2
|
+
* Scope operators are necessary to keep Rails happy. Reverting the original
|
3
|
+
revert so they're back in the library now for constants referenced inside of
|
4
|
+
the gem. (Nick Quaranto)
|
5
|
+
|
1
6
|
h1. 0.6.0 (04/21/2009)
|
2
7
|
|
3
8
|
* Converted Clearance to a Rails engine. (Dan Croak & Joe Ferris)
|
data/README.textile
CHANGED
@@ -4,46 +4,25 @@ Rails authentication with email & password.
|
|
4
4
|
|
5
5
|
"We have clearance, Clarence.":http://www.youtube.com/v/mNRXJEE3Nz8
|
6
6
|
|
7
|
-
h2. Engine
|
8
|
-
|
9
|
-
Clearance is a Rails engine. It works with versions of Rails greater than 2.3.
|
10
|
-
|
11
7
|
h2. Wiki
|
12
8
|
|
13
9
|
Most information regarding Clearance is on the "Github Wiki":http://wiki.github.com/thoughtbot/clearance.
|
14
10
|
|
15
|
-
h2.
|
16
|
-
|
17
|
-
Clearance is based on the same conventions and tools as "Suspenders":http://github.com/thoughtbot/suspenders If you use it, you already have some configuration mentioned below.
|
11
|
+
h2. Engine
|
18
12
|
|
19
|
-
|
13
|
+
Clearance is a Rails engine. It works with versions of Rails greater than 2.3.
|
20
14
|
|
21
15
|
In config/environment.rb:
|
22
16
|
|
23
17
|
config.gem "thoughtbot-clearance",
|
24
18
|
:lib => 'clearance',
|
25
19
|
:source => 'http://gems.github.com',
|
26
|
-
:version => '0.6.
|
27
|
-
|
28
|
-
In config/environments/test.rb:
|
29
|
-
|
30
|
-
config.gem 'thoughtbot-shoulda',
|
31
|
-
:lib => 'shoulda',
|
32
|
-
:source => "http://gems.github.com",
|
33
|
-
:version => '2.10.1'
|
34
|
-
config.gem 'thoughtbot-factory_girl',
|
35
|
-
:lib => 'factory_girl',
|
36
|
-
:source => "http://gems.github.com",
|
37
|
-
:version => '1.2.1'
|
20
|
+
:version => '0.6.1'
|
38
21
|
|
39
|
-
|
22
|
+
Vendor the gem:
|
40
23
|
|
41
24
|
rake gems:install
|
42
25
|
rake gems:unpack
|
43
|
-
rake gems:install RAILS_ENV=test
|
44
|
-
rake gems:unpack RAILS_ENV=test
|
45
|
-
|
46
|
-
h2. The generator
|
47
26
|
|
48
27
|
Make sure the development database exists and run the generator:
|
49
28
|
|
@@ -53,13 +32,52 @@ A number of files will be created and instructions will be printed.
|
|
53
32
|
|
54
33
|
You may already have some of these files. Don't worry. You'll be asked if you want to overwrite them.
|
55
34
|
|
56
|
-
h2.
|
35
|
+
h2. Environment
|
36
|
+
|
37
|
+
Define a HOST constant in your environment files.
|
38
|
+
In config/environments/test.rb and config/environments/development.rb it can be:
|
39
|
+
|
40
|
+
HOST = "localhost"
|
41
|
+
|
42
|
+
In production.rb it must be the actual host your application is deployed to.
|
43
|
+
The constant is used by mailers to generate URLs in emails.
|
44
|
+
|
45
|
+
In config/environment.rb:
|
46
|
+
|
47
|
+
DO_NOT_REPLY = "donotreply@example.com"
|
48
|
+
|
49
|
+
Define root_url to *something* in your config/routes.rb:
|
50
|
+
|
51
|
+
map.root :controller => 'home'
|
52
|
+
|
53
|
+
h2. Cucumber Features
|
54
|
+
|
55
|
+
As your app evolves, you want to know that authentication still works. Clearance's opinion is that you should test its integration with your app using "Cucumber":http://cukes.info/.
|
56
|
+
|
57
|
+
In config/environments/test.rb:
|
58
|
+
|
59
|
+
config.gem 'webrat',
|
60
|
+
:version => '= 0.4.4'
|
61
|
+
config.gem 'nokogiri',
|
62
|
+
:version => '= 1.2.3'
|
63
|
+
config.gem 'cucumber',
|
64
|
+
:version => '= 0.3.0'
|
65
|
+
config.gem 'thoughtbot-factory_girl',
|
66
|
+
:lib => 'factory_girl',
|
67
|
+
:source => "http://gems.github.com",
|
68
|
+
:version => '1.2.1'
|
69
|
+
|
70
|
+
Vendor the gems:
|
71
|
+
|
72
|
+
rake gems:install RAILS_ENV=test
|
73
|
+
rake gems:unpack RAILS_ENV=test
|
57
74
|
|
58
|
-
|
75
|
+
Run the Cucumber generator (if you haven't already) and Clearance's feature generator:
|
59
76
|
|
77
|
+
script/generate cucumber
|
60
78
|
script/generate clearance_features
|
61
79
|
|
62
|
-
All of the files generated should be new with the exception of the features/support/paths.rb file.
|
80
|
+
All of the files generated should be new with the exception of the features/support/paths.rb file. If you have not modified your paths.rb then you will be okay to replace it with this one. If you need to keep your paths.rb file then add these locations in your paths.rb manually:
|
63
81
|
|
64
82
|
def path_to(page_name)
|
65
83
|
case page_name
|
@@ -77,7 +95,7 @@ h2. Authors
|
|
77
95
|
|
78
96
|
Clearance was extracted out of "Hoptoad":http://hoptoadapp.com. We merged the authentication code from two of thoughtbot's client's Rails apps. The following people have made significant contributions, suggestions, and generally improved the library. Thank you!
|
79
97
|
|
80
|
-
Dan Croak, Mike Burns, Jason Morrison, Joe Ferris, Eugene Bolshakov, Josh Nichols, Mike Breen, Marcel Görner, Bence Nagy, Ben Mabey, Eloy Duran, Tim Pope, Mihai Anca, & Mark Cornick.
|
98
|
+
Dan Croak, Mike Burns, Jason Morrison, Joe Ferris, Eugene Bolshakov, Nick Quaranto, Josh Nichols, Mike Breen, Marcel Görner, Bence Nagy, Ben Mabey, Eloy Duran, Tim Pope, Mihai Anca, & Mark Cornick.
|
81
99
|
|
82
100
|
h2. Questions?
|
83
101
|
|
data/Rakefile
CHANGED
@@ -51,16 +51,16 @@ task :default => ['test:all', 'test:features']
|
|
51
51
|
|
52
52
|
gem_spec = Gem::Specification.new do |gem_spec|
|
53
53
|
gem_spec.name = "clearance"
|
54
|
-
gem_spec.version = "0.6.
|
55
|
-
gem_spec.summary = "Rails authentication
|
54
|
+
gem_spec.version = "0.6.1"
|
55
|
+
gem_spec.summary = "Rails authentication with email & password."
|
56
56
|
gem_spec.email = "support@thoughtbot.com"
|
57
57
|
gem_spec.homepage = "http://github.com/thoughtbot/clearance"
|
58
|
-
gem_spec.description = "
|
59
|
-
gem_spec.authors = ["
|
60
|
-
"
|
61
|
-
"
|
62
|
-
"
|
63
|
-
"
|
58
|
+
gem_spec.description = "Rails authentication with email & password."
|
59
|
+
gem_spec.authors = ["Dan Croak", "Mike Burns", "Jason Morrison",
|
60
|
+
"Joe Ferris", "Eugene Bolshakov", "Nick Quaranto",
|
61
|
+
"Josh Nichols", "Mike Breen", "Marcel Görner",
|
62
|
+
"Bence Nagy", "Ben Mabey", "Eloy Duran",
|
63
|
+
"Tim Pope", "Mihai Anca", "Mark Cornick"]
|
64
64
|
gem_spec.files = FileList["[A-Z]*", "{app,config,generators,lib,shoulda_macros,rails}/**/*"]
|
65
65
|
end
|
66
66
|
|
@@ -11,7 +11,7 @@ class Clearance::ConfirmationsController < ApplicationController
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def create
|
14
|
-
@user = User.find_by_id_and_token(params[:user_id], params[:token])
|
14
|
+
@user = ::User.find_by_id_and_token(params[:user_id], params[:token])
|
15
15
|
@user.confirm_email!
|
16
16
|
|
17
17
|
sign_user_in(@user)
|
@@ -22,7 +22,7 @@ class Clearance::ConfirmationsController < ApplicationController
|
|
22
22
|
private
|
23
23
|
|
24
24
|
def forbid_confirmed_user
|
25
|
-
user = User.find_by_id(params[:user_id])
|
25
|
+
user = ::User.find_by_id(params[:user_id])
|
26
26
|
if user && user.email_confirmed?
|
27
27
|
raise ActionController::Forbidden, "confirmed user"
|
28
28
|
end
|
@@ -35,7 +35,7 @@ class Clearance::ConfirmationsController < ApplicationController
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def forbid_non_existent_user
|
38
|
-
unless User.find_by_id_and_token(params[:user_id], params[:token])
|
38
|
+
unless ::User.find_by_id_and_token(params[:user_id], params[:token])
|
39
39
|
raise ActionController::Forbidden, "non-existent user"
|
40
40
|
end
|
41
41
|
end
|
@@ -10,7 +10,7 @@ class Clearance::PasswordsController < ApplicationController
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def create
|
13
|
-
if user = User.find_by_email(params[:password][:email])
|
13
|
+
if user = ::User.find_by_email(params[:password][:email])
|
14
14
|
user.forgot_password!
|
15
15
|
ClearanceMailer.deliver_change_password user
|
16
16
|
flash[:notice] = "You will receive an email within the next few minutes. " <<
|
@@ -23,12 +23,12 @@ class Clearance::PasswordsController < ApplicationController
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def edit
|
26
|
-
@user = User.find_by_id_and_token(params[:user_id], params[:token])
|
26
|
+
@user = ::User.find_by_id_and_token(params[:user_id], params[:token])
|
27
27
|
render :template => 'passwords/edit'
|
28
28
|
end
|
29
29
|
|
30
30
|
def update
|
31
|
-
@user = User.find_by_id_and_token(params[:user_id], params[:token])
|
31
|
+
@user = ::User.find_by_id_and_token(params[:user_id], params[:token])
|
32
32
|
|
33
33
|
if @user.update_password(params[:user][:password],
|
34
34
|
params[:user][:password_confirmation])
|
@@ -49,7 +49,7 @@ class Clearance::PasswordsController < ApplicationController
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def forbid_non_existent_user
|
52
|
-
unless User.find_by_id_and_token(params[:user_id], params[:token])
|
52
|
+
unless ::User.find_by_id_and_token(params[:user_id], params[:token])
|
53
53
|
raise ActionController::Forbidden, "non-existent user"
|
54
54
|
end
|
55
55
|
end
|
@@ -9,7 +9,7 @@ class Clearance::SessionsController < ApplicationController
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def create
|
12
|
-
@user = User.authenticate(params[:session][:email],
|
12
|
+
@user = ::User.authenticate(params[:session][:email],
|
13
13
|
params[:session][:password])
|
14
14
|
if @user.nil?
|
15
15
|
flash.now[:notice] = "Bad email or password."
|
@@ -5,12 +5,12 @@ class Clearance::UsersController < ApplicationController
|
|
5
5
|
filter_parameter_logging :password
|
6
6
|
|
7
7
|
def new
|
8
|
-
@user = User.new(params[:user])
|
8
|
+
@user = ::User.new(params[:user])
|
9
9
|
render :template => 'users/new'
|
10
10
|
end
|
11
11
|
|
12
12
|
def create
|
13
|
-
@user = User.new params[:user]
|
13
|
+
@user = ::User.new params[:user]
|
14
14
|
if @user.save
|
15
15
|
ClearanceMailer.deliver_confirmation @user
|
16
16
|
flash[:notice] = "You will receive an email within the next few minutes. " <<
|
metadata
CHANGED
@@ -1,22 +1,22 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thoughtbot-clearance
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- thoughtbot, inc.
|
8
7
|
- Dan Croak
|
9
8
|
- Mike Burns
|
10
9
|
- Jason Morrison
|
10
|
+
- Joe Ferris
|
11
11
|
- Eugene Bolshakov
|
12
|
+
- Nick Quaranto
|
12
13
|
- Josh Nichols
|
13
14
|
- Mike Breen
|
14
|
-
- Joe Ferris
|
15
|
-
- Bence Nagy
|
16
15
|
- "Marcel G\xC3\xB6rner"
|
16
|
+
- Bence Nagy
|
17
17
|
- Ben Mabey
|
18
|
-
- Tim Pope
|
19
18
|
- Eloy Duran
|
19
|
+
- Tim Pope
|
20
20
|
- Mihai Anca
|
21
21
|
- Mark Cornick
|
22
22
|
autorequire:
|
@@ -27,7 +27,7 @@ date: 2009-04-20 21:00:00 -07:00
|
|
27
27
|
default_executable:
|
28
28
|
dependencies: []
|
29
29
|
|
30
|
-
description:
|
30
|
+
description: Rails authentication with email & password.
|
31
31
|
email: support@thoughtbot.com
|
32
32
|
executables: []
|
33
33
|
|
@@ -123,6 +123,6 @@ rubyforge_project:
|
|
123
123
|
rubygems_version: 1.2.0
|
124
124
|
signing_key:
|
125
125
|
specification_version: 2
|
126
|
-
summary: Rails authentication
|
126
|
+
summary: Rails authentication with email & password.
|
127
127
|
test_files: []
|
128
128
|
|