vita-clearance 0.6.3 → 0.6.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +3 -107
- data/app/controllers/clearance/confirmations_controller.rb +1 -1
- data/app/controllers/clearance/passwords_controller.rb +2 -3
- data/app/controllers/clearance/sessions_controller.rb +4 -4
- data/app/controllers/clearance/users_controller.rb +1 -2
- data/app/models/clearance_mailer.rb +2 -2
- metadata +2 -2
data/README.textile
CHANGED
@@ -1,109 +1,5 @@
|
|
1
|
-
h1. Clearance
|
1
|
+
h1. Vita's Clearance 0.6.3 fork
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
"We have clearance, Clarence.":http://www.youtube.com/v/mNRXJEE3Nz8
|
6
|
-
|
7
|
-
h2. Wiki
|
8
|
-
|
9
|
-
Most information regarding Clearance is on the "Github Wiki":http://wiki.github.com/thoughtbot/clearance.
|
10
|
-
|
11
|
-
h2. Engine
|
12
|
-
|
13
|
-
Clearance is a Rails engine. It works with versions of Rails greater than 2.3.
|
14
|
-
|
15
|
-
In config/environment.rb:
|
16
|
-
|
17
|
-
config.gem "thoughtbot-clearance",
|
18
|
-
:lib => 'clearance',
|
19
|
-
:source => 'http://gems.github.com',
|
20
|
-
:version => '0.6.2'
|
21
|
-
|
22
|
-
Vendor the gem:
|
23
|
-
|
24
|
-
rake gems:install
|
25
|
-
rake gems:unpack
|
26
|
-
|
27
|
-
Make sure the development database exists and run the generator:
|
28
|
-
|
29
|
-
script/generate clearance
|
30
|
-
|
31
|
-
A number of files will be created and instructions will be printed.
|
32
|
-
|
33
|
-
You may already have some of these files. Don't worry. You'll be asked if you want to overwrite them.
|
34
|
-
|
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 'cucumber',
|
62
|
-
:version => '= 0.3.0'
|
63
|
-
config.gem 'thoughtbot-factory_girl',
|
64
|
-
:lib => 'factory_girl',
|
65
|
-
:source => "http://gems.github.com",
|
66
|
-
:version => '1.2.1'
|
67
|
-
|
68
|
-
Install nokogiri but don't vendor it (due to its native extensions):
|
69
|
-
|
70
|
-
sudo gem install nokogiri
|
71
|
-
|
72
|
-
Vendor the gems:
|
73
|
-
|
74
|
-
rake gems:install RAILS_ENV=test
|
75
|
-
rake gems:unpack RAILS_ENV=test
|
76
|
-
|
77
|
-
Run the Cucumber generator (if you haven't already) and Clearance's feature generator:
|
78
|
-
|
79
|
-
script/generate cucumber
|
80
|
-
script/generate clearance_features
|
81
|
-
|
82
|
-
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:
|
83
|
-
|
84
|
-
def path_to(page_name)
|
85
|
-
case page_name
|
86
|
-
...
|
87
|
-
when /the sign up page/i
|
88
|
-
new_user_path
|
89
|
-
when /the sign in page/i
|
90
|
-
new_session_path
|
91
|
-
when /the password reset request page/i
|
92
|
-
new_password_path
|
93
|
-
...
|
94
|
-
end
|
95
|
-
|
96
|
-
h2. Authors
|
97
|
-
|
98
|
-
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!
|
99
|
-
|
100
|
-
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, & Shay Arnett.
|
101
|
-
|
102
|
-
h2. Questions?
|
103
|
-
|
104
|
-
* Ask the "mailing list":http://groups.google.com/group/thoughtbot-clearance
|
105
|
-
|
106
|
-
h2. Bugs?
|
107
|
-
|
108
|
-
* Open up a "Lighthouse ticket":https://thoughtbot.lighthouseapp.com/projects/18503-clearance
|
3
|
+
Added i18n support.
|
109
4
|
|
5
|
+
"Original Clearance":http://github.com/thoughtbot/clearance/tree/master
|
@@ -15,7 +15,7 @@ class Clearance::ConfirmationsController < ApplicationController
|
|
15
15
|
@user.confirm_email!
|
16
16
|
|
17
17
|
sign_user_in(@user)
|
18
|
-
flash[:success] = "Confirmed email and signed in."
|
18
|
+
flash[:success] = t(:confirmed, :scope => [:clearance, :controllers, :confirmations], :default => "Confirmed email and signed in.")
|
19
19
|
redirect_to url_after_create
|
20
20
|
end
|
21
21
|
|
@@ -13,11 +13,10 @@ class Clearance::PasswordsController < ApplicationController
|
|
13
13
|
if user = ::User.find_by_email(params[:password][:email])
|
14
14
|
user.forgot_password!
|
15
15
|
::ClearanceMailer.deliver_change_password user
|
16
|
-
flash[:notice] = "You will receive an email within the next few minutes. "
|
17
|
-
"It contains instructions for changing your password."
|
16
|
+
flash[:notice] = t(:deliver_change_password, :scope => [:clearance, :controllers, :passwords], :default => "You will receive an email within the next few minutes. It contains instructions for changing your password.")
|
18
17
|
redirect_to url_after_create
|
19
18
|
else
|
20
|
-
flash.now[:notice] = "Unknown email"
|
19
|
+
flash.now[:notice] = t(:unknown_email, :scope => [:clearance, :controllers, :passwords], :default => "Unknown email")
|
21
20
|
render :template => 'passwords/new'
|
22
21
|
end
|
23
22
|
end
|
@@ -12,17 +12,17 @@ class Clearance::SessionsController < ApplicationController
|
|
12
12
|
@user = ::User.authenticate(params[:session][:email],
|
13
13
|
params[:session][:password])
|
14
14
|
if @user.nil?
|
15
|
-
flash.now[:notice] = "Bad email or password."
|
15
|
+
flash.now[:notice] = t(:unauthorized, :scope => [:clearance, :controllers, :sessions], :default => "Bad email or password.")
|
16
16
|
render :template => 'sessions/new', :status => :unauthorized
|
17
17
|
else
|
18
18
|
if @user.email_confirmed?
|
19
19
|
remember(@user) if remember?
|
20
20
|
sign_user_in(@user)
|
21
|
-
flash[:notice] = "Signed in successfully."
|
21
|
+
flash[:notice] = t(:signed_in, :scope => [:clearance, :controllers, :sessions], :default => "Signed in successfully.")
|
22
22
|
redirect_back_or url_after_create
|
23
23
|
else
|
24
24
|
::ClearanceMailer.deliver_confirmation(@user)
|
25
|
-
deny_access("User has not confirmed email. Confirmation email will be resent.")
|
25
|
+
deny_access(t(:unconfirmed_email, :scope => [:clearance, :controllers, :sessions], :default => "User has not confirmed email. Confirmation email will be resent."))
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
@@ -30,7 +30,7 @@ class Clearance::SessionsController < ApplicationController
|
|
30
30
|
def destroy
|
31
31
|
forget(current_user)
|
32
32
|
reset_session
|
33
|
-
flash[:notice] = "You have been signed out."
|
33
|
+
flash[:notice] = t(:sign_out, :scope => [:clearance, :controllers, :sessions], :default => "You have been signed out.")
|
34
34
|
redirect_to url_after_destroy
|
35
35
|
end
|
36
36
|
|
@@ -13,8 +13,7 @@ class Clearance::UsersController < ApplicationController
|
|
13
13
|
@user = ::User.new params[:user]
|
14
14
|
if @user.save
|
15
15
|
::ClearanceMailer.deliver_confirmation @user
|
16
|
-
flash[:notice] = "You will receive an email within the next few minutes. "
|
17
|
-
"It contains instructions for confirming your account."
|
16
|
+
flash[:notice] = t(:deliver_confirmation, :scope => [:clearance, :controllers, :users], :default => "You will receive an email within the next few minutes. It contains instructions for confirming your account.")
|
18
17
|
redirect_to url_after_create
|
19
18
|
else
|
20
19
|
render :template => 'users/new'
|
@@ -5,14 +5,14 @@ class ClearanceMailer < ActionMailer::Base
|
|
5
5
|
def change_password(user)
|
6
6
|
from DO_NOT_REPLY
|
7
7
|
recipients user.email
|
8
|
-
subject "Change your password"
|
8
|
+
subject I18n.t(:change_password, :scope => [:clearance, :models, :clearance_mailer], :default => "Change your password")
|
9
9
|
body :user => user
|
10
10
|
end
|
11
11
|
|
12
12
|
def confirmation(user)
|
13
13
|
from DO_NOT_REPLY
|
14
14
|
recipients user.email
|
15
|
-
subject
|
15
|
+
subject I18n.t(:confirmation, :scope => [:clearance, :models, :clearance_mailer], :default => "Account confirmation")
|
16
16
|
body :user => user
|
17
17
|
end
|
18
18
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vita-clearance
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.3
|
4
|
+
version: 0.6.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Croak
|
@@ -28,7 +28,7 @@ date: 2009-04-22 21:00:00 -07:00
|
|
28
28
|
default_executable:
|
29
29
|
dependencies: []
|
30
30
|
|
31
|
-
description: Vita's fork
|
31
|
+
description: Vita's fork Clearance 0.6.3. Added i18n support.
|
32
32
|
email: support@thoughtbot.com
|
33
33
|
executables: []
|
34
34
|
|