vita-clearance 0.6.3.1 → 0.6.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. data/CHANGELOG.textile +44 -0
  2. data/README.textile +75 -3
  3. data/Rakefile +11 -8
  4. data/app/controllers/clearance/confirmations_controller.rb +12 -7
  5. data/app/controllers/clearance/passwords_controller.rb +25 -8
  6. data/app/controllers/clearance/sessions_controller.rb +24 -19
  7. data/app/controllers/clearance/users_controller.rb +9 -3
  8. data/app/models/clearance_mailer.rb +6 -2
  9. data/app/views/clearance_mailer/change_password.html.erb +4 -4
  10. data/app/views/passwords/edit.html.erb +6 -5
  11. data/app/views/passwords/new.html.erb +5 -4
  12. data/app/views/sessions/new.html.erb +6 -5
  13. data/app/views/users/_form.html.erb +1 -1
  14. data/app/views/users/new.html.erb +3 -2
  15. data/config/clearance_routes.rb +15 -4
  16. data/generators/clearance/lib/insert_commands.rb +0 -70
  17. data/generators/clearance/templates/migrations/create_users.rb +4 -3
  18. data/generators/clearance_features/templates/features/password_reset.feature +7 -5
  19. data/generators/clearance_features/templates/features/sign_in.feature +7 -6
  20. data/generators/clearance_features/templates/features/sign_out.feature +8 -7
  21. data/generators/clearance_features/templates/features/sign_up.feature +5 -7
  22. data/generators/clearance_features/templates/features/step_definitions/clearance_steps.rb +8 -8
  23. data/lib/clearance.rb +1 -10
  24. data/lib/clearance/authentication.rb +28 -8
  25. data/lib/clearance/extensions/errors.rb +4 -2
  26. data/lib/clearance/extensions/rescue.rb +3 -1
  27. data/lib/clearance/extensions/routes.rb +14 -0
  28. data/lib/clearance/user.rb +39 -10
  29. data/shoulda_macros/clearance.rb +26 -12
  30. metadata +7 -6
data/CHANGELOG.textile CHANGED
@@ -1,3 +1,47 @@
1
+ h2. 0.6.9 (07/22/2009)
2
+
3
+ * Added i18n support for views. (Vit Krchov)
4
+
5
+ h2. 0.6.9 (07/04/2009)
6
+
7
+ * Added timestamps to create users migration. (Dan Croak)
8
+ * Ready for Ruby 1.9. (Jason Morrison, Nick Quaranto)
9
+
10
+ h2. 0.6.8 (06/24/2009)
11
+
12
+ * Added defined? checks for various Rails constants such as ActionController
13
+ for easier unit testing of Clearance extensions... particularly ActiveRecord
14
+ extensions... particularly strong_password. (Dan Croak)
15
+
16
+ h2. 0.6.7 (06/13/2009)
17
+
18
+ * [#30] Added sign_up, sign_in, sign_out named routes. (Dan Croak)
19
+ * [#22] Minimizing Reek smell: Duplication in redirect_back_or. (Dan Croak)
20
+ * Deprecated sign_user_in. Told developers to use sign_in instead. (Dan
21
+ Croak)
22
+ * [#16] flash_success_after_create, flash_notice_after_create, flash_failure_after_create, flash_sucess_after_update, flash_success_after_destroy, etc. (Dan Croak)
23
+ * [#17] bug. added #create to forbidden before_filters on confirmations controller. (Dan Croak)
24
+ * [#24] should_be_signed_in_as shouldn't look in the session. (Dan Croak)
25
+ * README improvements. (Dan Croak)
26
+ * Move routes loading to separate file. (Joshua Clayton)
27
+
28
+ h2. 0.6.6 (05/18/2009)
29
+
30
+ * [#14] replaced class_eval in Clearance::User with modules. This was needed
31
+ in a thoughtbot client app so we could write our own validations. (Dan Croak)
32
+
33
+ h2. 0.6.5 (05/17/2009)
34
+
35
+ * [#6] Make Clearance i18n aware. (Timur Vafin, Marcel Goerner, Eugene Bolshakov, Dan Croak)
36
+
37
+ h2. 0.6.4 (05/12/2009)
38
+
39
+ * Moved issue tracking to Github from Lighthouse. (Dan Croak)
40
+ * [#7] asking higher-level questions of controllers in webrat steps, such as signed_in? instead of what's in the session. same for accessors. (Dan Croak)
41
+ * [#11] replacing sign_in_as & sign_out shoulda macros with a stubbing (requires no dependency) approach. this will avoid dealing with the internals of current_user, such as session & cookies. added sign_in macro which signs in an email confirmed user from clearance's factories. (Dan Croak)
42
+ * [#13] move private methods on sessions controller into Clearance::Authentication module (Dan Croak)
43
+ * [#9] audited flash keys. (Dan Croak)
44
+
1
45
  h2. 0.6.3 (04/23/2009)
2
46
 
3
47
  * Scoping ClearanceMailer properly within controllers so it works in production environments. (Nick Quaranto)
data/README.textile CHANGED
@@ -1,5 +1,77 @@
1
- h1. Vita's Clearance 0.6.3 fork
1
+ h1. Vita's Clearance fork
2
2
 
3
- Added i18n support.
3
+ This is fork of "Clearance":http://github.com/thoughtbot/clearance/tree/master. Added i18n support for views.
4
4
 
5
- "Original Clearance":http://github.com/thoughtbot/clearance/tree/master
5
+ h2. Example locals for clearance
6
+
7
+ <pre>
8
+ {
9
+ :'cz' => {
10
+ :activerecord => {
11
+ :models => {
12
+ :user => 'Uživatel'
13
+ },
14
+ :attributes => {
15
+ :user => {
16
+ :password => 'Heslo',
17
+ :password_confirmation => 'Potvrzení hesla'
18
+ }
19
+ }
20
+ }
21
+ :clearance => {
22
+ :views => {
23
+ :mailer => {
24
+ :change_password => {
25
+ :header => "Pod Vaším e-mailem byla zaregistrována žádost o změnu přístupového hesla pro Váš účet. Zasíláme Vám odkaz, na kterém mužete heslo změnit.",
26
+ :footer => "Pokud tato žádost není od Vás, tak můžete e-mail ignorovat, heslo nebude změněno."
27
+ }
28
+ },
29
+ :passwords => {
30
+ :change_password => 'Změna hesla',
31
+ :change_password_information => 'Vaše staré heslo bude smazáno. Zvolte si nové.',
32
+ :new_password_information => 'Zadejte e-mailovou adresu, na kterou Vám pošleme e-mail s odkazem na změnu hesla.'
33
+ },
34
+ :sessions => {
35
+ :sign_in => 'Přihlášení',
36
+ :sign_up => 'Zaregistrovat',
37
+ :forgot_password => 'Zapomenuté heslo?',
38
+ :remember_me => 'Zapamatovat si mě'
39
+ },
40
+ :users => {
41
+ :sign_up => 'Registrace'
42
+ },
43
+ :buttons => {
44
+ :save_this_password => 'Ulož heslo',
45
+ :reset_password => 'Resetovat heslo',
46
+ :sign_up => 'Zaregistrovat se',
47
+ :please_wait => 'Počkejte prosím ...'
48
+ }
49
+ },
50
+ :models => {
51
+ :clearance_mailer => {
52
+ :confirmation => "Ověření e-mailové adresy.",
53
+ :change_password => "Změna hesla"
54
+ }
55
+ },
56
+ :controllers => {
57
+ :confirmations => {
58
+ :confirmed_email => "Email ověřen. Byl jste úspěšně přihlášen."
59
+ },
60
+ :passwords => {
61
+ :deliver_change_password => "Během následujících minut Vám bude doručen e-mail s instrukcema pro změnu hesla.",
62
+ :unknown_email => "Neznámý e-mail."
63
+ },
64
+ :sessions => {
65
+ :bad_email_or_password => "Chybný e-mail nebo heslo.",
66
+ :signed_in => "Úspěšně přihlášen.",
67
+ :unconfirmed_email => "Nemáte ověřenout e-mailovou adresu. Při registraci Vám byl zaslán e-mail s instrukcema pro ověření.",
68
+ :signed_out => "Úspěšně odhlášen."
69
+ },
70
+ :users => {
71
+ :deliver_confirmation => "Během následujících minut Vám bude doručen e-mail s instrukcema pro ověření účtu."
72
+ }
73
+ }
74
+ }
75
+ }
76
+ }
77
+ </pre>
data/Rakefile CHANGED
@@ -1,19 +1,21 @@
1
+ # encoding: utf-8
2
+
1
3
  require 'rake'
2
4
  require 'rake/testtask'
3
5
  require 'cucumber/rake/task'
4
6
 
5
7
  namespace :test do
6
- Rake::TestTask.new(:all => ['generator:cleanup',
7
- 'generator:generate']) do |task|
8
- task.libs << 'lib'
8
+ Rake::TestTask.new(:all => ["generator:cleanup",
9
+ "generator:generate"]) do |task|
10
+ task.libs << "lib"
9
11
  task.libs << "test"
10
- task.pattern = 'test/**/*_test.rb'
12
+ task.pattern = "test/**/*_test.rb"
11
13
  task.verbose = false
12
14
  end
13
15
 
14
16
  Cucumber::Rake::Task.new(:features) do |t|
15
- t.cucumber_opts = "--format progress"
16
- t.feature_pattern = 'test/rails_root/features/*.feature'
17
+ t.cucumber_opts = "--format progress"
18
+ t.feature_pattern = "test/rails_root/features/*.feature"
17
19
  end
18
20
  end
19
21
 
@@ -51,8 +53,8 @@ task :default => ['test:all', 'test:features']
51
53
 
52
54
  gem_spec = Gem::Specification.new do |gem_spec|
53
55
  gem_spec.name = "clearance"
54
- gem_spec.version = "0.6.3"
55
- gem_spec.summary = "Rails authentication with email & password."
56
+ gem_spec.version = "0.6.9"
57
+ gem_spec.summary = "Rails authentication with email & password. Fork with i18n support for views."
56
58
  gem_spec.email = "support@thoughtbot.com"
57
59
  gem_spec.homepage = "http://github.com/thoughtbot/clearance"
58
60
  gem_spec.description = "Rails authentication with email & password."
@@ -71,3 +73,4 @@ task :gemspec do
71
73
  f.write gem_spec.to_yaml
72
74
  end
73
75
  end
76
+
@@ -1,9 +1,9 @@
1
1
  class Clearance::ConfirmationsController < ApplicationController
2
2
  unloadable
3
3
 
4
- before_filter :forbid_confirmed_user, :only => :new
5
- before_filter :forbid_missing_token, :only => :new
6
- before_filter :forbid_non_existent_user, :only => :new
4
+ before_filter :forbid_confirmed_user, :only => [:new, :create]
5
+ before_filter :forbid_missing_token, :only => [:new, :create]
6
+ before_filter :forbid_non_existent_user, :only => [:new, :create]
7
7
  filter_parameter_logging :token
8
8
 
9
9
  def new
@@ -14,9 +14,9 @@ class Clearance::ConfirmationsController < ApplicationController
14
14
  @user = ::User.find_by_id_and_token(params[:user_id], params[:token])
15
15
  @user.confirm_email!
16
16
 
17
- sign_user_in(@user)
18
- flash[:success] = t(:confirmed, :scope => [:clearance, :controllers, :confirmations], :default => "Confirmed email and signed in.")
19
- redirect_to url_after_create
17
+ sign_in(@user)
18
+ flash_success_after_create
19
+ redirect_to(url_after_create)
20
20
  end
21
21
 
22
22
  private
@@ -40,8 +40,13 @@ class Clearance::ConfirmationsController < ApplicationController
40
40
  end
41
41
  end
42
42
 
43
+ def flash_success_after_create
44
+ flash[:success] = translate(:confirmed_email,
45
+ :scope => [:clearance, :controllers, :confirmations],
46
+ :default => "Confirmed email and signed in.")
47
+ end
48
+
43
49
  def url_after_create
44
50
  root_url
45
51
  end
46
-
47
52
  end
@@ -13,10 +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] = 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.")
17
- redirect_to url_after_create
16
+ flash_notice_after_create
17
+ redirect_to(url_after_create)
18
18
  else
19
- flash.now[:notice] = t(:unknown_email, :scope => [:clearance, :controllers, :passwords], :default => "Unknown email")
19
+ flash_failure_after_create
20
20
  render :template => 'passwords/new'
21
21
  end
22
22
  end
@@ -29,11 +29,12 @@ class Clearance::PasswordsController < ApplicationController
29
29
  def update
30
30
  @user = ::User.find_by_id_and_token(params[:user_id], params[:token])
31
31
 
32
- if @user.update_password(params[:user][:password],
32
+ if @user.update_password(params[:user][:password],
33
33
  params[:user][:password_confirmation])
34
- @user.confirm_email! unless @user.email_confirmed?
35
- sign_user_in(@user)
36
- redirect_to url_after_update
34
+ @user.confirm_email!
35
+ sign_in(@user)
36
+ flash_success_after_update
37
+ redirect_to(url_after_update)
37
38
  else
38
39
  render :template => 'passwords/edit'
39
40
  end
@@ -53,12 +54,28 @@ class Clearance::PasswordsController < ApplicationController
53
54
  end
54
55
  end
55
56
 
57
+ def flash_notice_after_create
58
+ flash[:notice] = translate(:deliver_change_password,
59
+ :scope => [:clearance, :controllers, :passwords],
60
+ :default => "You will receive an email within the next few minutes. " <<
61
+ "It contains instructions for changing your password.")
62
+ end
63
+
64
+ def flash_failure_after_create
65
+ flash.now[:failure] = translate(:unknown_email,
66
+ :scope => [:clearance, :controllers, :passwords],
67
+ :default => "Unknown email.")
68
+ end
69
+
56
70
  def url_after_create
57
71
  new_session_url
58
72
  end
59
73
 
74
+ def flash_success_after_update
75
+ flash[:success] = translate(:signed_in, :default => "Signed in.")
76
+ end
77
+
60
78
  def url_after_update
61
79
  root_url
62
80
  end
63
-
64
81
  end
@@ -10,53 +10,58 @@ class Clearance::SessionsController < ApplicationController
10
10
 
11
11
  def create
12
12
  @user = ::User.authenticate(params[:session][:email],
13
- params[:session][:password])
13
+ params[:session][:password])
14
14
  if @user.nil?
15
- flash.now[:notice] = t(:unauthorized, :scope => [:clearance, :controllers, :sessions], :default => "Bad email or password.")
15
+ flash_failure_after_create
16
16
  render :template => 'sessions/new', :status => :unauthorized
17
17
  else
18
18
  if @user.email_confirmed?
19
+ sign_in(@user)
19
20
  remember(@user) if remember?
20
- sign_user_in(@user)
21
- flash[:notice] = t(:signed_in, :scope => [:clearance, :controllers, :sessions], :default => "Signed in successfully.")
22
- redirect_back_or url_after_create
21
+ flash_success_after_create
22
+ redirect_back_or(url_after_create)
23
23
  else
24
24
  ::ClearanceMailer.deliver_confirmation(@user)
25
- deny_access(t(:unconfirmed_email, :scope => [:clearance, :controllers, :sessions], :default => "User has not confirmed email. Confirmation email will be resent."))
25
+ flash_notice_after_create
26
+ redirect_to(new_session_url)
26
27
  end
27
28
  end
28
29
  end
29
30
 
30
31
  def destroy
31
32
  forget(current_user)
32
- reset_session
33
- flash[:notice] = t(:sign_out, :scope => [:clearance, :controllers, :sessions], :default => "You have been signed out.")
34
- redirect_to url_after_destroy
33
+ flash_success_after_destroy
34
+ redirect_to(url_after_destroy)
35
35
  end
36
36
 
37
37
  private
38
38
 
39
- def remember?
40
- params[:session] && params[:session][:remember_me] == "1"
39
+ def flash_failure_after_create
40
+ flash.now[:failure] = translate(:bad_email_or_password,
41
+ :scope => [:clearance, :controllers, :sessions],
42
+ :default => "Bad email or password.")
41
43
  end
42
44
 
43
- def remember(user)
44
- user.remember_me!
45
- cookies[:remember_token] = { :value => user.token,
46
- :expires => user.token_expires_at }
45
+ def flash_success_after_create
46
+ flash[:success] = translate(:signed_in, :default => "Signed in.")
47
47
  end
48
48
 
49
- def forget(user)
50
- user.forget_me! if user
51
- cookies.delete :remember_token
49
+ def flash_notice_after_create
50
+ flash[:notice] = translate(:unconfirmed_email,
51
+ :scope => [:clearance, :controllers, :sessions],
52
+ :default => "User has not confirmed email. " <<
53
+ "Confirmation email will be resent.")
52
54
  end
53
55
 
54
56
  def url_after_create
55
57
  root_url
56
58
  end
57
59
 
60
+ def flash_success_after_destroy
61
+ flash[:success] = translate(:signed_out, :default => "Signed out.")
62
+ end
63
+
58
64
  def url_after_destroy
59
65
  new_session_url
60
66
  end
61
-
62
67
  end
@@ -13,8 +13,8 @@ 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] = 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.")
17
- redirect_to url_after_create
16
+ flash_notice_after_create
17
+ redirect_to(url_after_create)
18
18
  else
19
19
  render :template => 'users/new'
20
20
  end
@@ -22,8 +22,14 @@ class Clearance::UsersController < ApplicationController
22
22
 
23
23
  private
24
24
 
25
+ def flash_notice_after_create
26
+ flash[:notice] = translate(:deliver_confirmation,
27
+ :scope => [:clearance, :controllers, :users],
28
+ :default => "You will receive an email within the next few minutes. " <<
29
+ "It contains instructions for confirming your account.")
30
+ end
31
+
25
32
  def url_after_create
26
33
  new_session_url
27
34
  end
28
-
29
35
  end
@@ -5,14 +5,18 @@ class ClearanceMailer < ActionMailer::Base
5
5
  def change_password(user)
6
6
  from DO_NOT_REPLY
7
7
  recipients user.email
8
- subject I18n.t(:change_password, :scope => [:clearance, :models, :clearance_mailer], :default => "Change your password")
8
+ subject I18n.t(:change_password,
9
+ :scope => [:clearance, :models, :clearance_mailer],
10
+ :default => "Change your password")
9
11
  body :user => user
10
12
  end
11
13
 
12
14
  def confirmation(user)
13
15
  from DO_NOT_REPLY
14
16
  recipients user.email
15
- subject I18n.t(:confirmation, :scope => [:clearance, :models, :clearance_mailer], :default => "Account confirmation")
17
+ subject I18n.t(:confirmation,
18
+ :scope => [:clearance, :models, :clearance_mailer],
19
+ :default => "Account confirmation")
16
20
  body :user => user
17
21
  end
18
22
 
@@ -1,7 +1,7 @@
1
- Someone, hopefully you, has requested that we send you a link to change your password.
2
-
3
- Here's the link:
1
+ <%=t :header, :scope => [:clearance, :views, :mailer, :change_password],
2
+ :default => 'Someone, hopefully you, has requested that we send you a link to change your password.' %>
4
3
 
5
4
  <%= edit_user_password_url(@user, :token => @user.token, :escape => false) %>
6
5
 
7
- If you didn't request this, ignore this email. Don't worry. Your password hasn't been changed.
6
+ <%=t :footer, :scope => [:clearance, :views, :mailer, :change_password],
7
+ :default => "If you didn't request this, ignore this email. Don't worry. Your password hasn't been changed." %>
@@ -1,7 +1,7 @@
1
- <h2>Change your password</h2>
1
+ <h2><%= t :change_password, :scope => [:clearance, :views, :passwords], :default => 'Change your password' %></h2>
2
2
 
3
3
  <p>
4
- Your password has been reset. Choose a new password below.
4
+ <%= t :change_password_information, :scope => [:clearance, :views, :passwords], :default => 'Your password has been reset. Choose a new password below.' %>
5
5
  </p>
6
6
 
7
7
  <%= error_messages_for :user %>
@@ -10,14 +10,15 @@
10
10
  :url => user_password_path(@user, :token => @user.token),
11
11
  :html => { :method => :put }) do |form| %>
12
12
  <div class="password_field">
13
- <%= form.label :password, "Choose password" %>
13
+ <%= form.label :password %>
14
14
  <%= form.password_field :password %>
15
15
  </div>
16
16
  <div class="password_field">
17
- <%= form.label :password_confirmation, "Confirm password" %>
17
+ <%= form.label :password_confirmation %>
18
18
  <%= form.password_field :password_confirmation %>
19
19
  </div>
20
20
  <div class="submit_field">
21
- <%= form.submit "Save this password", :disable_with => "Please wait..." %>
21
+ <%= form.submit t(:save_this_password, :scope => [:clearance, :views, :buttons], :default => "Save this password"),
22
+ :disable_with => t(:please_wait, :scope => [:clearance, :views, :buttons], :default => "Please wait...") %>
22
23
  </div>
23
24
  <% end %>
@@ -1,15 +1,16 @@
1
- <h2>Change your password</h2>
1
+ <h2><%= t :change_password, :scope => [:clearance, :views, :passwords], :default => 'Change your password' %></h2>
2
2
 
3
3
  <p>
4
- We will email you a link to change your password.
4
+ <%= t :new_password_information, :scope => [:clearance, :views, :passwords], :defualt => 'We will email you a link to change your password.' %>
5
5
  </p>
6
6
 
7
7
  <% form_for :password, :url => passwords_path do |form| %>
8
8
  <div class="text_field">
9
- <%= form.label :email, "Email address" %>
9
+ <%= form.label :email %>
10
10
  <%= form.text_field :email %>
11
11
  </div>
12
12
  <div class="submit_field">
13
- <%= form.submit "Reset password", :disable_with => "Please wait..." %>
13
+ <%= form.submit t(:reset_password, :scope => [:clearance, :views, :buttons], :defaul => 'Reset password'),
14
+ :disable_with => t(:please_wait, :scope => [:clearance, :views, :buttons], :default => "Please wait...") %>
14
15
  </div>
15
16
  <% end %>
@@ -1,4 +1,4 @@
1
- <h2>Sign in</h2>
1
+ <h2><%= t :sign_in, :scope => [:clearance, :views, :sessions], :default => 'Sign in' %></h2>
2
2
 
3
3
  <% form_for :session, :url => session_path do |form| %>
4
4
  <div class="text_field">
@@ -11,18 +11,19 @@
11
11
  </div>
12
12
  <div class="text_field">
13
13
  <%= form.check_box :remember_me %>
14
- <%= form.label :remember_me %>
14
+ <%= form.label :remember_me, t(:remember_me, :scope => [:clearance, :views, :sessions], :default => 'Remember me') %>
15
15
  </div>
16
16
  <div class="submit_field">
17
- <%= form.submit "Sign in", :disable_with => "Please wait..." %>
17
+ <%= form.submit t(:sing_in, :scope => [:clearance, :views, :buttons], :default => 'Sign in'),
18
+ :disable_with => t(:please_wait, :scope => [:clearance, :views, :buttons], :default => "Please wait...") %>
18
19
  </div>
19
20
  <% end %>
20
21
 
21
22
  <ul>
22
23
  <li>
23
- <%= link_to "Sign up", new_user_path %>
24
+ <%= link_to t(:sign_up, :scope => [:clearance, :views, :sessions], :default => 'Sign up'), new_user_path %>
24
25
  </li>
25
26
  <li>
26
- <%= link_to "Forgot password?", new_password_path %>
27
+ <%= link_to t(:forgot_password, :scope => [:clearance, :views, :sessions], :default => 'Forgot password?'), new_password_path %>
27
28
  </li>
28
29
  </ul>
@@ -8,6 +8,6 @@
8
8
  <%= form.password_field :password %>
9
9
  </div>
10
10
  <div class="password_field">
11
- <%= form.label :password_confirmation, "Confirm password" %>
11
+ <%= form.label :password_confirmation %>
12
12
  <%= form.password_field :password_confirmation %>
13
13
  </div>
@@ -1,6 +1,7 @@
1
- <h2>Sign up</h2>
1
+ <h2><%= t :sign_up, :scope => [:clearance, :views, :users], :default => 'Sign up' %></h2>
2
2
 
3
3
  <% form_for @user do |form| %>
4
4
  <%= render :partial => '/users/form', :object => form %>
5
- <%= form.submit 'Sign up', :disable_with => 'Please wait...' %>
5
+ <%= form.submit t(:sign_up, :scope => [:clearance, :views, :buttons], :default => 'Sign up'),
6
+ :disable_with => t(:please_wait, :scope => [:clearance, :views, :buttons], :default => "Please wait...") %>
6
7
  <% end %>
@@ -1,19 +1,30 @@
1
1
  ActionController::Routing::Routes.draw do |map|
2
2
  map.resources :passwords,
3
3
  :controller => 'clearance/passwords',
4
- :only => [:new, :create]
4
+ :only => [:new, :create]
5
5
 
6
6
  map.resource :session,
7
7
  :controller => 'clearance/sessions',
8
- :only => [:new, :create, :destroy]
8
+ :only => [:new, :create, :destroy]
9
9
 
10
10
  map.resources :users, :controller => 'clearance/users' do |users|
11
11
  users.resource :password,
12
12
  :controller => 'clearance/passwords',
13
- :only => [:create, :edit, :update]
13
+ :only => [:create, :edit, :update]
14
14
 
15
15
  users.resource :confirmation,
16
16
  :controller => 'clearance/confirmations',
17
- :only => [:new, :create]
17
+ :only => [:new, :create]
18
18
  end
19
+
20
+ map.sign_up 'sign_up',
21
+ :controller => 'clearance/users',
22
+ :action => 'new'
23
+ map.sign_in 'sign_in',
24
+ :controller => 'clearance/sessions',
25
+ :action => 'new'
26
+ map.sign_out 'sign_out',
27
+ :controller => 'clearance/sessions',
28
+ :action => 'destroy',
29
+ :method => :delete
19
30
  end
@@ -7,40 +7,6 @@ Rails::Generator::Commands::Base.class_eval do
7
7
  end
8
8
 
9
9
  Rails::Generator::Commands::Create.class_eval do
10
-
11
- def route_resources(resource_list)
12
- sentinel = 'ActionController::Routing::Routes.draw do |map|'
13
-
14
- logger.route "map.resources #{resource_list}"
15
- unless options[:pretend] || file_contains?('config/routes.rb', resource_list)
16
- gsub_file 'config/routes.rb', /(#{Regexp.escape(sentinel)})/mi do |match|
17
- "#{match}\n map.resources #{resource_list}"
18
- end
19
- end
20
- end
21
-
22
- def route_resource(resource_list)
23
- sentinel = 'ActionController::Routing::Routes.draw do |map|'
24
-
25
- logger.route "map.resource #{resource_list}"
26
- unless options[:pretend] || file_contains?('config/routes.rb', resource_list)
27
- gsub_file 'config/routes.rb', /(#{Regexp.escape(sentinel)})/mi do |match|
28
- "#{match}\n map.resource #{resource_list}"
29
- end
30
- end
31
- end
32
-
33
- def route_name(name, path, route_options = {})
34
- sentinel = 'ActionController::Routing::Routes.draw do |map|'
35
-
36
- logger.route "map.#{name} '#{path}', :controller => '#{route_options[:controller]}', :action => '#{route_options[:action]}'"
37
- unless options[:pretend]
38
- gsub_file_once 'config/routes.rb', /(#{Regexp.escape(sentinel)})/mi do |match|
39
- "#{match}\n map.#{name} '#{path}', :controller => '#{route_options[:controller]}', :action => '#{route_options[:action]}'"
40
- end
41
- end
42
- end
43
-
44
10
  def insert_into(file, line)
45
11
  logger.insert "#{line} into #{file}"
46
12
  unless options[:pretend] || file_contains?(file, line)
@@ -52,30 +18,6 @@ Rails::Generator::Commands::Create.class_eval do
52
18
  end
53
19
 
54
20
  Rails::Generator::Commands::Destroy.class_eval do
55
- def route_resource(resource_list)
56
- look_for = " map.resource #{resource_list}\n".gsub(/[\[\]]/, '\\\\\0')
57
- logger.route "map.resource #{resource_list} #{look_for}"
58
- unless options[:pretend]
59
- gsub_file 'config/routes.rb', /(#{look_for})/mi, ''
60
- end
61
- end
62
-
63
- def route_resources(resource_list)
64
- look_for = " map.resources #{resource_list}\n".gsub(/[\[\]]/, '\\\\\0')
65
- logger.route "map.resources #{resource_list} #{look_for}"
66
- unless options[:pretend]
67
- gsub_file 'config/routes.rb', /(#{look_for})/mi, ''
68
- end
69
- end
70
-
71
- def route_name(name, path, route_options = {})
72
- look_for = "\n map.#{name} '#{path}', :controller => '#{route_options[:controller]}', :action => '#{route_options[:action]}'"
73
- logger.route "map.#{name} '#{path}', :controller => '#{route_options[:controller]}', :action => '#{route_options[:action]}'"
74
- unless options[:pretend]
75
- gsub_file 'config/routes.rb', /(#{look_for})/mi, ''
76
- end
77
- end
78
-
79
21
  def insert_into(file, line)
80
22
  logger.remove "#{line} from #{file}"
81
23
  unless options[:pretend]
@@ -85,18 +27,6 @@ Rails::Generator::Commands::Destroy.class_eval do
85
27
  end
86
28
 
87
29
  Rails::Generator::Commands::List.class_eval do
88
- def route_resource(resources_list)
89
- logger.route "map.resource #{resource_list}"
90
- end
91
-
92
- def route_resources(resources_list)
93
- logger.route "map.resource #{resource_list}"
94
- end
95
-
96
- def route_name(name, path, options = {})
97
- logger.route "map.#{name} '#{path}', :controller => '{options[:controller]}', :action => '#{options[:action]}'"
98
- end
99
-
100
30
  def insert_into(file, line)
101
31
  logger.insert "#{line} into #{file}"
102
32
  end
@@ -7,14 +7,15 @@ class ClearanceCreateUsers < ActiveRecord::Migration
7
7
  t.string :token, :limit => 128
8
8
  t.datetime :token_expires_at
9
9
  t.boolean :email_confirmed, :default => false, :null => false
10
+ t.timestamps
10
11
  end
11
12
 
12
13
  add_index :users, [:id, :token]
13
14
  add_index :users, :email
14
- add_index :users, :token
15
+ add_index :users, :token
15
16
  end
16
-
17
+
17
18
  def self.down
18
- drop_table :users
19
+ drop_table :users
19
20
  end
20
21
  end
@@ -2,24 +2,24 @@ Feature: Password reset
2
2
  In order to sign in even if user forgot their password
3
3
  A user
4
4
  Should be able to reset it
5
-
5
+
6
6
  Scenario: User is not signed up
7
7
  Given no user exists with an email of "email@person.com"
8
8
  When I request password reset link to be sent to "email@person.com"
9
9
  Then I should see "Unknown email"
10
-
10
+
11
11
  Scenario: User is signed up and requests password reset
12
12
  Given I signed up with "email@person.com/password"
13
13
  When I request password reset link to be sent to "email@person.com"
14
14
  Then I should see "instructions for changing your password"
15
15
  And a password reset message should be sent to "email@person.com"
16
-
16
+
17
17
  Scenario: User is signed up updated his password and types wrong confirmation
18
18
  Given I signed up with "email@person.com/password"
19
19
  When I follow the password reset link sent to "email@person.com"
20
20
  And I update my password with "newpassword/wrongconfirmation"
21
21
  Then I should see error messages
22
- And I should not be signed in
22
+ And I should be signed out
23
23
 
24
24
  Scenario: User is signed up and updates his password
25
25
  Given I signed up with "email@person.com/password"
@@ -27,5 +27,7 @@ Feature: Password reset
27
27
  And I update my password with "newpassword/newpassword"
28
28
  Then I should be signed in
29
29
  When I sign out
30
+ Then I should be signed out
30
31
  And I sign in as "email@person.com/newpassword"
31
- Then I should be signed in
32
+ Then I should be signed in
33
+
@@ -8,34 +8,35 @@ Feature: Sign in
8
8
  When I go to the sign in page
9
9
  And I sign in as "email@person.com/password"
10
10
  Then I should see "Bad email or password"
11
- And I should not be signed in
11
+ And I should be signed out
12
12
 
13
13
  Scenario: User is not confirmed
14
14
  Given I signed up with "email@person.com/password"
15
15
  When I go to the sign in page
16
16
  And I sign in as "email@person.com/password"
17
17
  Then I should see "User has not confirmed email"
18
- And I should not be signed in
18
+ And I should be signed out
19
19
 
20
20
  Scenario: User enters wrong password
21
21
  Given I am signed up and confirmed as "email@person.com/password"
22
22
  When I go to the sign in page
23
23
  And I sign in as "email@person.com/wrongpassword"
24
24
  Then I should see "Bad email or password"
25
- And I should not be signed in
25
+ And I should be signed out
26
26
 
27
27
  Scenario: User signs in successfully
28
28
  Given I am signed up and confirmed as "email@person.com/password"
29
29
  When I go to the sign in page
30
30
  And I sign in as "email@person.com/password"
31
- Then I should see "Signed in successfully"
31
+ Then I should see "Signed in"
32
32
  And I should be signed in
33
33
 
34
34
  Scenario: User signs in and checks "remember me"
35
35
  Given I am signed up and confirmed as "email@person.com/password"
36
36
  When I go to the sign in page
37
37
  And I sign in with "remember me" as "email@person.com/password"
38
- Then I should see "Signed in successfully"
39
- And I should be signed in
38
+ Then I should see "Signed in"
39
+ And I should be signed in
40
40
  When I return next time
41
41
  Then I should be signed in
42
+
@@ -2,21 +2,22 @@ Feature: Sign out
2
2
  To protect my account from unauthorized access
3
3
  A signed in user
4
4
  Should be able to sign out
5
-
5
+
6
6
  Scenario: User signs out
7
7
  Given I am signed up and confirmed as "email@person.com/password"
8
8
  When I sign in as "email@person.com/password"
9
9
  Then I should be signed in
10
10
  And I sign out
11
- Then I should see "You have been signed out"
12
- And I should not be signed in
13
-
11
+ Then I should see "Signed out"
12
+ And I should be signed out
13
+
14
14
  Scenario: User who was remembered signs out
15
15
  Given I am signed up and confirmed as "email@person.com/password"
16
16
  When I sign in with "remember me" as "email@person.com/password"
17
17
  Then I should be signed in
18
18
  And I sign out
19
- Then I should see "You have been signed out"
20
- And I should not be signed in
19
+ Then I should see "Signed out"
20
+ And I should be signed out
21
21
  When I return next time
22
- Then I should not be signed in
22
+ Then I should be signed out
23
+
@@ -2,7 +2,7 @@ Feature: Sign up
2
2
  In order to get access to protected sections of the site
3
3
  A user
4
4
  Should be able to sign up
5
-
5
+
6
6
  Scenario: User signs up with invalid data
7
7
  When I go to the sign up page
8
8
  And I fill in "Email" with "invalidemail"
@@ -10,7 +10,7 @@ Feature: Sign up
10
10
  And I fill in "Confirm password" with ""
11
11
  And I press "Sign Up"
12
12
  Then I should see error messages
13
-
13
+
14
14
  Scenario: User signs up with valid data
15
15
  When I go to the sign up page
16
16
  And I fill in "Email" with "email@person.com"
@@ -19,12 +19,10 @@ Feature: Sign up
19
19
  And I press "Sign Up"
20
20
  Then I should see "instructions for confirming"
21
21
  And a confirmation message should be sent to "email@person.com"
22
-
22
+
23
23
  Scenario: User confirms his account
24
24
  Given I signed up with "email@person.com/password"
25
25
  When I follow the confirmation link sent to "email@person.com"
26
26
  Then I should see "Confirmed email and signed in"
27
- And I should be signed in
28
-
29
-
30
-
27
+ And I should be signed in
28
+
@@ -11,15 +11,15 @@ Given /^no user exists with an email of "(.*)"$/ do |email|
11
11
  end
12
12
 
13
13
  Given /^I signed up with "(.*)\/(.*)"$/ do |email, password|
14
- user = Factory :user,
15
- :email => email,
14
+ user = Factory :user,
15
+ :email => email,
16
16
  :password => password,
17
17
  :password_confirmation => password
18
18
  end
19
19
 
20
20
  Given /^I am signed up and confirmed as "(.*)\/(.*)"$/ do |email, password|
21
21
  user = Factory :email_confirmed_user,
22
- :email => email,
22
+ :email => email,
23
23
  :password => password,
24
24
  :password_confirmation => password
25
25
  end
@@ -27,15 +27,16 @@ end
27
27
  # Session
28
28
 
29
29
  Then /^I should be signed in$/ do
30
- assert_not_nil request.session[:user_id]
30
+ assert controller.signed_in?
31
31
  end
32
32
 
33
- Then /^I should not be signed in$/ do
34
- assert_nil request.session[:user_id]
33
+ Then /^I should be signed out$/ do
34
+ assert ! controller.signed_in?
35
35
  end
36
36
 
37
37
  When /^session is cleared$/ do
38
- request.session[:user_id] = nil
38
+ request.reset_session
39
+ controller.instance_variable_set(:@_current_user, nil)
39
40
  end
40
41
 
41
42
  # Emails
@@ -77,7 +78,6 @@ Then /^I should be forbidden$/ do
77
78
  assert_response :forbidden
78
79
  end
79
80
 
80
-
81
81
  # Actions
82
82
 
83
83
  When /^I sign in( with "remember me")? as "(.*)\/(.*)"$/ do |remember, email, password|
data/lib/clearance.rb CHANGED
@@ -1,15 +1,6 @@
1
1
  require 'clearance/extensions/errors'
2
2
  require 'clearance/extensions/rescue'
3
+ require 'clearance/extensions/routes'
3
4
 
4
5
  require 'clearance/authentication'
5
6
  require 'clearance/user'
6
-
7
- class ActionController::Routing::RouteSet
8
- def load_routes_with_clearance!
9
- clearance_routes = File.join(File.dirname(__FILE__), *%w[.. config clearance_routes.rb])
10
- add_configuration_file(clearance_routes) unless configuration_files.include? clearance_routes
11
- load_routes_without_clearance!
12
- end
13
-
14
- alias_method_chain :load_routes!, :clearance
15
- end
@@ -42,6 +42,7 @@ module Clearance
42
42
  end
43
43
 
44
44
  def sign_user_in(user)
45
+ warn "[DEPRECATION] sign_user_in: unnecessary. use sign_in(user) instead."
45
46
  sign_in(user)
46
47
  end
47
48
 
@@ -51,18 +52,37 @@ module Clearance
51
52
  end
52
53
  end
53
54
 
55
+ def remember?
56
+ params[:session] && params[:session][:remember_me] == "1"
57
+ end
58
+
59
+ def remember(user)
60
+ user.remember_me!
61
+ cookies[:remember_token] = { :value => user.token,
62
+ :expires => user.token_expires_at }
63
+ end
64
+
65
+ def forget(user)
66
+ user.forget_me! if user
67
+ cookies.delete(:remember_token)
68
+ reset_session
69
+ end
70
+
54
71
  def redirect_back_or(default)
55
- session[:return_to] ||= params[:return_to]
56
- if session[:return_to]
57
- redirect_to(session[:return_to])
58
- else
59
- redirect_to(default)
60
- end
72
+ redirect_to(return_to || default)
73
+ clear_return_to
74
+ end
75
+
76
+ def return_to
77
+ session[:return_to] || params[:return_to]
78
+ end
79
+
80
+ def clear_return_to
61
81
  session[:return_to] = nil
62
82
  end
63
83
 
64
84
  def redirect_to_root
65
- redirect_to root_url
85
+ redirect_to(root_url)
66
86
  end
67
87
 
68
88
  def store_location
@@ -72,7 +92,7 @@ module Clearance
72
92
  def deny_access(flash_message = nil, opts = {})
73
93
  store_location
74
94
  flash[:failure] = flash_message if flash_message
75
- redirect_to new_session_url
95
+ redirect_to(new_session_url)
76
96
  end
77
97
  end
78
98
 
@@ -1,4 +1,6 @@
1
- module ActionController
2
- class Forbidden < StandardError
1
+ if defined?(ActionController)
2
+ module ActionController
3
+ class Forbidden < StandardError
4
+ end
3
5
  end
4
6
  end
@@ -1 +1,3 @@
1
- ActionController::Base.rescue_responses.update('ActionController::Forbidden' => :forbidden)
1
+ if defined?(ActionController::Base)
2
+ ActionController::Base.rescue_responses.update('ActionController::Forbidden' => :forbidden)
3
+ end
@@ -0,0 +1,14 @@
1
+ if defined?(ActionController::Routing::RouteSet)
2
+ class ActionController::Routing::RouteSet
3
+ def load_routes_with_clearance!
4
+ lib_path = File.dirname(__FILE__)
5
+ clearance_routes = File.join(lib_path, *%w[.. .. .. config clearance_routes.rb])
6
+ unless configuration_files.include?(clearance_routes)
7
+ add_configuration_file(clearance_routes)
8
+ end
9
+ load_routes_without_clearance!
10
+ end
11
+
12
+ alias_method_chain :load_routes!, :clearance
13
+ end
14
+ end
@@ -4,20 +4,49 @@ module Clearance
4
4
  module User
5
5
 
6
6
  def self.included(model)
7
- model.extend ClassMethods
7
+ model.extend(ClassMethods)
8
+
8
9
  model.send(:include, InstanceMethods)
10
+ model.send(:include, AttrAccessible)
11
+ model.send(:include, AttrAccessor)
12
+ model.send(:include, Validations)
13
+ model.send(:include, Callbacks)
14
+ end
15
+
16
+ module AttrAccessible
17
+ def self.included(model)
18
+ model.class_eval do
19
+ attr_accessible :email, :password, :password_confirmation
20
+ end
21
+ end
22
+ end
23
+
24
+ module AttrAccessor
25
+ def self.included(model)
26
+ model.class_eval do
27
+ attr_accessor :password, :password_confirmation
28
+ end
29
+ end
30
+ end
9
31
 
10
- model.class_eval do
11
- attr_accessible :email, :password, :password_confirmation
12
- attr_accessor :password, :password_confirmation
32
+ module Validations
33
+ def self.included(model)
34
+ model.class_eval do
35
+ validates_presence_of :email
36
+ validates_uniqueness_of :email, :case_sensitive => false
37
+ validates_format_of :email, :with => %r{.+@.+\..+}
13
38
 
14
- validates_presence_of :email
15
- validates_presence_of :password, :if => :password_required?
16
- validates_confirmation_of :password, :if => :password_required?
17
- validates_uniqueness_of :email, :case_sensitive => false
18
- validates_format_of :email, :with => %r{.+@.+\..+}
39
+ validates_presence_of :password, :if => :password_required?
40
+ validates_confirmation_of :password, :if => :password_required?
41
+ end
42
+ end
43
+ end
19
44
 
20
- before_save :initialize_salt, :encrypt_password, :initialize_token
45
+ module Callbacks
46
+ def self.included(model)
47
+ model.class_eval do
48
+ before_save :initialize_salt, :encrypt_password, :initialize_token
49
+ end
21
50
  end
22
51
  end
23
52
 
@@ -8,12 +8,14 @@ module Clearance
8
8
  user = block.bind(self).call
9
9
  assert_not_nil user,
10
10
  "please pass a User. try: should_be_signed_in_as { @user }"
11
- assert_equal user.id, session[:user_id],
12
- "session[:user_id] is not set to User's id"
11
+ assert_equal user, @controller.send(:current_user),
12
+ "#{user.inspect} is not the current_user, " <<
13
+ "which is #{@controller.send(:current_user).inspect}"
13
14
  end
14
15
  end
15
16
 
16
17
  def should_be_signed_in_and_email_confirmed_as(&block)
18
+ warn "[DEPRECATION] should_be_signed_in_and_email_confirmed_as: questionable usefulness"
17
19
  should_be_signed_in_as &block
18
20
 
19
21
  should "have confirmed email" do
@@ -31,10 +33,8 @@ module Clearance
31
33
  end
32
34
  end
33
35
 
34
- # Examples:
35
- # should_deny_access_on :get, :index, :flash => /not authorized/i
36
- # should_deny_access_on :get, :show, :id => '1'
37
36
  def should_deny_access_on(http_method, action, opts = {})
37
+ warn "[DEPRECATION] should_deny_access_on: use a setup & should_deny_access(:flash => ?)"
38
38
  flash_message = opts.delete(:flash)
39
39
  context "on #{http_method} to #{action}" do
40
40
  setup do
@@ -68,6 +68,7 @@ module Clearance
68
68
  # CONTEXTS
69
69
 
70
70
  def signed_in_user_context(&blk)
71
+ warn "[DEPRECATION] signed_in_user_context: creates a Mystery Guest, causes Obscure Test"
71
72
  context "A signed in user" do
72
73
  setup do
73
74
  @user = Factory(:user)
@@ -79,6 +80,7 @@ module Clearance
79
80
  end
80
81
 
81
82
  def public_context(&blk)
83
+ warn "[DEPRECATION] public_context: common case is no-op. call sign_out otherwise"
82
84
  context "The public" do
83
85
  setup { sign_out }
84
86
  merge_block(&blk)
@@ -88,6 +90,7 @@ module Clearance
88
90
  # CREATING USERS
89
91
 
90
92
  def should_create_user_successfully
93
+ warn "[DEPRECATION] should_create_user_successfully: not meant to be public, no longer used internally"
91
94
  should_assign_to :user
92
95
  should_change 'User.count', :by => 1
93
96
 
@@ -132,6 +135,7 @@ module Clearance
132
135
  # VALIDATIONS
133
136
 
134
137
  def should_validate_confirmation_of(attribute, opts = {})
138
+ warn "[DEPRECATION] should_validate_confirmation_of: not meant to be public, no longer used internally"
135
139
  raise ArgumentError if opts[:factory].nil?
136
140
 
137
141
  context "on save" do
@@ -141,6 +145,7 @@ module Clearance
141
145
  end
142
146
 
143
147
  def should_validate_confirmation_is_not_blank(factory, attribute, opts = {})
148
+ warn "[DEPRECATION] should_validate_confirmation_is_not_blank: not meant to be public, no longer used internally"
144
149
  should "validate #{attribute}_confirmation is not blank" do
145
150
  model = Factory.build(factory, blank_confirmation_options(attribute))
146
151
  model.save
@@ -150,6 +155,7 @@ module Clearance
150
155
  end
151
156
 
152
157
  def should_validate_confirmation_is_not_bad(factory, attribute, opts = {})
158
+ warn "[DEPRECATION] should_validate_confirmation_is_not_bad: not meant to be public, no longer used internally"
153
159
  should "validate #{attribute}_confirmation is different than #{attribute}" do
154
160
  model = Factory.build(factory, bad_confirmation_options(attribute))
155
161
  model.save
@@ -161,6 +167,7 @@ module Clearance
161
167
  # FORMS
162
168
 
163
169
  def should_display_a_password_update_form
170
+ warn "[DEPRECATION] should_display_a_password_update_form: not meant to be public, no longer used internally"
164
171
  should "have a form for the user's token, password, and password confirm" do
165
172
  update_path = ERB::Util.h(
166
173
  user_password_path(@user, :token => @user.token)
@@ -175,6 +182,7 @@ module Clearance
175
182
  end
176
183
 
177
184
  def should_display_a_sign_up_form
185
+ warn "[DEPRECATION] should_display_a_sign_up_form: not meant to be public, no longer used internally"
178
186
  should "display a form to sign up" do
179
187
  assert_select "form[action=#{users_path}][method=post]",
180
188
  true, "There must be a form to sign up" do
@@ -191,6 +199,7 @@ module Clearance
191
199
  end
192
200
 
193
201
  def should_display_a_sign_in_form
202
+ warn "[DEPRECATION] should_display_a_sign_in_form: not meant to be public, no longer used internally"
194
203
  should 'display a "sign in" form' do
195
204
  assert_select "form[action=#{session_path}][method=post]",
196
205
  true, "There must be a form to sign in" do
@@ -211,30 +220,35 @@ end
211
220
  module Clearance
212
221
  module Shoulda
213
222
  module Helpers
214
- def sign_in_as(user = nil)
215
- unless user
216
- user = Factory(:user)
217
- user.confirm_email!
218
- end
219
- @request.session[:user_id] = user.id
223
+ def sign_in_as(user)
224
+ @controller.class_eval { attr_accessor :current_user }
225
+ @controller.current_user = user
220
226
  return user
221
227
  end
222
228
 
229
+ def sign_in
230
+ sign_in_as Factory(:email_confirmed_user)
231
+ end
232
+
223
233
  def sign_out
224
- @request.session[:user_id] = nil
234
+ @controller.class_eval { attr_accessor :current_user }
235
+ @controller.current_user = nil
225
236
  end
226
237
 
227
238
  def blank_confirmation_options(attribute)
239
+ warn "[DEPRECATION] blank_confirmation_options: not meant to be public, no longer used internally"
228
240
  opts = { attribute => attribute.to_s }
229
241
  opts.merge("#{attribute}_confirmation".to_sym => "")
230
242
  end
231
243
 
232
244
  def bad_confirmation_options(attribute)
245
+ warn "[DEPRECATION] bad_confirmation_options: not meant to be public, no longer used internally"
233
246
  opts = { attribute => attribute.to_s }
234
247
  opts.merge("#{attribute}_confirmation".to_sym => "not_#{attribute}")
235
248
  end
236
249
 
237
250
  def assert_confirmation_error(model, attribute, message = "confirmation error")
251
+ warn "[DEPRECATION] assert_confirmation_error: not meant to be public, no longer used internally"
238
252
  assert model.errors.on(attribute).include?("doesn't match confirmation"),
239
253
  message
240
254
  end
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.1
4
+ version: 0.6.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Croak
@@ -24,11 +24,11 @@ autorequire:
24
24
  bindir: bin
25
25
  cert_chain: []
26
26
 
27
- date: 2009-04-22 21:00:00 -07:00
27
+ date: 2009-07-21 21:00:00 -07:00
28
28
  default_executable:
29
29
  dependencies: []
30
30
 
31
- description: Vita's fork Clearance 0.6.3. Added i18n support.
31
+ description: Rails authentication with email & password.
32
32
  email: support@thoughtbot.com
33
33
  executables: []
34
34
 
@@ -95,11 +95,12 @@ files:
95
95
  - lib/clearance/extensions
96
96
  - lib/clearance/extensions/errors.rb
97
97
  - lib/clearance/extensions/rescue.rb
98
+ - lib/clearance/extensions/routes.rb
98
99
  - lib/clearance/user.rb
99
100
  - lib/clearance.rb
100
101
  - shoulda_macros/clearance.rb
101
102
  - rails/init.rb
102
- has_rdoc: false
103
+ has_rdoc: true
103
104
  homepage: http://github.com/thoughtbot/clearance
104
105
  post_install_message:
105
106
  rdoc_options: []
@@ -123,7 +124,7 @@ requirements: []
123
124
  rubyforge_project:
124
125
  rubygems_version: 1.2.0
125
126
  signing_key:
126
- specification_version: 2
127
- summary: Rails authentication with email & password.
127
+ specification_version: 3
128
+ summary: Rails authentication with email & password. Fork with i18n support for views.
128
129
  test_files: []
129
130