devise 3.3.0 → 3.5.10

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of devise might be problematic. Click here for more details.

Files changed (138) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +29 -20
  3. data/CHANGELOG.md +219 -102
  4. data/CODE_OF_CONDUCT.md +22 -0
  5. data/CONTRIBUTING.md +2 -0
  6. data/Gemfile +3 -2
  7. data/Gemfile.lock +101 -80
  8. data/MIT-LICENSE +1 -1
  9. data/README.md +87 -43
  10. data/Rakefile +2 -1
  11. data/app/controllers/devise/confirmations_controller.rb +5 -1
  12. data/app/controllers/devise/omniauth_callbacks_controller.rb +4 -0
  13. data/app/controllers/devise/passwords_controller.rb +14 -4
  14. data/app/controllers/devise/registrations_controller.rb +10 -11
  15. data/app/controllers/devise/sessions_controller.rb +7 -2
  16. data/app/controllers/devise/unlocks_controller.rb +3 -0
  17. data/app/controllers/devise_controller.rb +44 -21
  18. data/app/mailers/devise/mailer.rb +4 -0
  19. data/app/views/devise/confirmations/new.html.erb +7 -3
  20. data/app/views/devise/mailer/password_change.html.erb +3 -0
  21. data/app/views/devise/passwords/edit.html.erb +14 -5
  22. data/app/views/devise/passwords/new.html.erb +7 -3
  23. data/app/views/devise/registrations/edit.html.erb +19 -9
  24. data/app/views/devise/registrations/new.html.erb +18 -7
  25. data/app/views/devise/sessions/new.html.erb +15 -6
  26. data/app/views/devise/shared/{_links.erb → _links.html.erb} +1 -1
  27. data/app/views/devise/unlocks/new.html.erb +7 -3
  28. data/config/locales/en.yml +4 -2
  29. data/devise.gemspec +2 -2
  30. data/gemfiles/Gemfile.rails-3.2-stable.lock +54 -48
  31. data/gemfiles/Gemfile.rails-4.0-stable +1 -0
  32. data/gemfiles/Gemfile.rails-4.0-stable.lock +63 -59
  33. data/gemfiles/{Gemfile.rails-head → Gemfile.rails-4.1-stable} +3 -5
  34. data/gemfiles/Gemfile.rails-4.1-stable.lock +171 -0
  35. data/gemfiles/Gemfile.rails-4.2-stable +30 -0
  36. data/gemfiles/Gemfile.rails-4.2-stable.lock +193 -0
  37. data/lib/devise/controllers/helpers.rb +12 -6
  38. data/lib/devise/controllers/rememberable.rb +9 -2
  39. data/lib/devise/controllers/sign_in_out.rb +2 -8
  40. data/lib/devise/controllers/store_location.rb +3 -1
  41. data/lib/devise/controllers/url_helpers.rb +7 -9
  42. data/lib/devise/encryptor.rb +22 -0
  43. data/lib/devise/failure_app.rb +56 -14
  44. data/lib/devise/hooks/timeoutable.rb +5 -7
  45. data/lib/devise/mapping.rb +2 -1
  46. data/lib/devise/models/authenticatable.rb +28 -28
  47. data/lib/devise/models/confirmable.rb +51 -17
  48. data/lib/devise/models/database_authenticatable.rb +17 -11
  49. data/lib/devise/models/lockable.rb +7 -3
  50. data/lib/devise/models/recoverable.rb +23 -15
  51. data/lib/devise/models/rememberable.rb +56 -22
  52. data/lib/devise/models/timeoutable.rb +0 -6
  53. data/lib/devise/models/trackable.rb +1 -2
  54. data/lib/devise/models/validatable.rb +3 -3
  55. data/lib/devise/models.rb +1 -1
  56. data/lib/devise/rails/routes.rb +33 -27
  57. data/lib/devise/rails.rb +1 -1
  58. data/lib/devise/strategies/authenticatable.rb +8 -6
  59. data/lib/devise/strategies/database_authenticatable.rb +2 -1
  60. data/lib/devise/strategies/rememberable.rb +13 -3
  61. data/lib/devise/test_helpers.rb +2 -2
  62. data/lib/devise/version.rb +1 -1
  63. data/lib/devise.rb +39 -37
  64. data/lib/generators/active_record/devise_generator.rb +2 -1
  65. data/lib/generators/active_record/templates/migration.rb +1 -1
  66. data/lib/generators/active_record/templates/migration_existing.rb +1 -1
  67. data/lib/generators/devise/controllers_generator.rb +44 -0
  68. data/lib/generators/devise/views_generator.rb +14 -3
  69. data/lib/generators/templates/controllers/README +14 -0
  70. data/lib/generators/templates/controllers/confirmations_controller.rb +28 -0
  71. data/lib/generators/templates/controllers/omniauth_callbacks_controller.rb +28 -0
  72. data/lib/generators/templates/controllers/passwords_controller.rb +32 -0
  73. data/lib/generators/templates/controllers/registrations_controller.rb +60 -0
  74. data/lib/generators/templates/controllers/sessions_controller.rb +25 -0
  75. data/lib/generators/templates/controllers/unlocks_controller.rb +28 -0
  76. data/lib/generators/templates/devise.rb +19 -13
  77. data/lib/generators/templates/markerb/confirmation_instructions.markerb +1 -1
  78. data/lib/generators/templates/markerb/password_change.markerb +3 -0
  79. data/lib/generators/templates/markerb/reset_password_instructions.markerb +1 -1
  80. data/lib/generators/templates/markerb/unlock_instructions.markerb +1 -1
  81. data/lib/generators/templates/simple_form_for/passwords/edit.html.erb +1 -1
  82. data/lib/generators/templates/simple_form_for/registrations/new.html.erb +1 -1
  83. data/lib/generators/templates/simple_form_for/sessions/new.html.erb +2 -2
  84. data/test/controllers/custom_registrations_controller_test.rb +6 -1
  85. data/test/controllers/helper_methods_test.rb +21 -0
  86. data/test/controllers/helpers_test.rb +5 -0
  87. data/test/controllers/inherited_controller_i18n_messages_test.rb +51 -0
  88. data/test/controllers/internal_helpers_test.rb +10 -4
  89. data/test/controllers/load_hooks_controller_test.rb +19 -0
  90. data/test/controllers/passwords_controller_test.rb +1 -1
  91. data/test/controllers/sessions_controller_test.rb +3 -3
  92. data/test/controllers/url_helpers_test.rb +6 -0
  93. data/test/devise_test.rb +3 -3
  94. data/test/failure_app_test.rb +47 -0
  95. data/test/generators/controllers_generator_test.rb +48 -0
  96. data/test/generators/views_generator_test.rb +8 -1
  97. data/test/helpers/devise_helper_test.rb +9 -12
  98. data/test/integration/authenticatable_test.rb +1 -1
  99. data/test/integration/database_authenticatable_test.rb +11 -0
  100. data/test/integration/http_authenticatable_test.rb +1 -1
  101. data/test/integration/omniauthable_test.rb +12 -10
  102. data/test/integration/recoverable_test.rb +13 -0
  103. data/test/integration/rememberable_test.rb +50 -3
  104. data/test/integration/timeoutable_test.rb +13 -18
  105. data/test/mailers/confirmation_instructions_test.rb +1 -1
  106. data/test/mapping_test.rb +7 -0
  107. data/test/models/authenticatable_test.rb +10 -0
  108. data/test/models/confirmable_test.rb +99 -42
  109. data/test/models/database_authenticatable_test.rb +20 -0
  110. data/test/models/lockable_test.rb +45 -17
  111. data/test/models/recoverable_test.rb +62 -7
  112. data/test/models/rememberable_test.rb +68 -97
  113. data/test/models/validatable_test.rb +5 -5
  114. data/test/models_test.rb +15 -6
  115. data/test/rails_app/app/active_record/user_without_email.rb +8 -0
  116. data/test/rails_app/app/controllers/admins_controller.rb +0 -5
  117. data/test/rails_app/app/controllers/custom/registrations_controller.rb +10 -0
  118. data/test/rails_app/app/mailers/users/from_proc_mailer.rb +3 -0
  119. data/test/rails_app/app/mailers/users/mailer.rb +0 -9
  120. data/test/rails_app/app/mailers/users/reply_to_mailer.rb +4 -0
  121. data/test/rails_app/app/mongoid/user_without_email.rb +33 -0
  122. data/test/rails_app/config/application.rb +1 -1
  123. data/test/rails_app/config/environments/production.rb +6 -2
  124. data/test/rails_app/config/environments/test.rb +7 -2
  125. data/test/rails_app/config/initializers/devise.rb +12 -15
  126. data/test/rails_app/config/routes.rb +6 -3
  127. data/test/rails_app/db/migrate/20100401102949_create_tables.rb +2 -2
  128. data/test/rails_app/lib/shared_user.rb +1 -1
  129. data/test/rails_app/lib/shared_user_without_email.rb +26 -0
  130. data/test/rails_test.rb +9 -0
  131. data/test/support/helpers.rb +13 -6
  132. data/test/support/integration.rb +2 -2
  133. data/test/test_helper.rb +5 -0
  134. data/test/test_helpers_test.rb +22 -7
  135. data/test/test_models.rb +2 -2
  136. data/test/time_helpers.rb +137 -0
  137. metadata +58 -8
  138. data/gemfiles/Gemfile.rails-head.lock +0 -190
data/Rakefile CHANGED
@@ -1,5 +1,6 @@
1
1
  # encoding: UTF-8
2
- require "bundler/gem_tasks"
2
+
3
+ require 'bundler/gem_tasks'
3
4
  require 'rake/testtask'
4
5
  require 'rdoc/task'
5
6
 
@@ -33,7 +33,7 @@ class Devise::ConfirmationsController < DeviseController
33
33
 
34
34
  # The path used after resending confirmation instructions.
35
35
  def after_resending_confirmation_instructions_path_for(resource_name)
36
- new_session_path(resource_name) if is_navigational_format?
36
+ is_navigational_format? ? new_session_path(resource_name) : '/'
37
37
  end
38
38
 
39
39
  # The path used after confirmation.
@@ -44,4 +44,8 @@ class Devise::ConfirmationsController < DeviseController
44
44
  new_session_path(resource_name)
45
45
  end
46
46
  end
47
+
48
+ def translation_scope
49
+ 'devise.confirmations'
50
+ end
47
51
  end
@@ -27,4 +27,8 @@ class Devise::OmniauthCallbacksController < DeviseController
27
27
  def after_omniauth_failure_path_for(scope)
28
28
  new_session_path(scope)
29
29
  end
30
+
31
+ def translation_scope
32
+ 'devise.omniauth_callbacks'
33
+ end
30
34
  end
@@ -23,6 +23,7 @@ class Devise::PasswordsController < DeviseController
23
23
  # GET /resource/password/edit?reset_password_token=abcdef
24
24
  def edit
25
25
  self.resource = resource_class.new
26
+ set_minimum_password_length
26
27
  resource.reset_password_token = params[:reset_password_token]
27
28
  end
28
29
 
@@ -33,18 +34,23 @@ class Devise::PasswordsController < DeviseController
33
34
 
34
35
  if resource.errors.empty?
35
36
  resource.unlock_access! if unlockable?(resource)
36
- flash_message = resource.active_for_authentication? ? :updated : :updated_not_active
37
- set_flash_message(:notice, flash_message) if is_flashing_format?
38
- sign_in(resource_name, resource)
37
+ if Devise.sign_in_after_reset_password
38
+ flash_message = resource.active_for_authentication? ? :updated : :updated_not_active
39
+ set_flash_message(:notice, flash_message) if is_flashing_format?
40
+ sign_in(resource_name, resource)
41
+ else
42
+ set_flash_message(:notice, :updated_not_active) if is_flashing_format?
43
+ end
39
44
  respond_with resource, location: after_resetting_password_path_for(resource)
40
45
  else
46
+ set_minimum_password_length
41
47
  respond_with resource
42
48
  end
43
49
  end
44
50
 
45
51
  protected
46
52
  def after_resetting_password_path_for(resource)
47
- after_sign_in_path_for(resource)
53
+ Devise.sign_in_after_reset_password ? after_sign_in_path_for(resource) : new_session_path(resource_name)
48
54
  end
49
55
 
50
56
  # The path used after sending reset password instructions
@@ -67,4 +73,8 @@ class Devise::PasswordsController < DeviseController
67
73
  resource.respond_to?(:unlock_strategy_enabled?) &&
68
74
  resource.unlock_strategy_enabled?(:email)
69
75
  end
76
+
77
+ def translation_scope
78
+ 'devise.passwords'
79
+ end
70
80
  end
@@ -1,14 +1,12 @@
1
1
  class Devise::RegistrationsController < DeviseController
2
- prepend_before_filter :require_no_authentication, only: [ :new, :create, :cancel ]
2
+ prepend_before_filter :require_no_authentication, only: [:new, :create, :cancel]
3
3
  prepend_before_filter :authenticate_scope!, only: [:edit, :update, :destroy]
4
4
 
5
5
  # GET /resource/sign_up
6
6
  def new
7
7
  build_resource({})
8
- @validatable = devise_mapping.validatable?
9
- if @validatable
10
- @minimum_password_length = resource_class.password_length.min
11
- end
8
+ set_minimum_password_length
9
+ yield resource if block_given?
12
10
  respond_with self.resource
13
11
  end
14
12
 
@@ -16,9 +14,9 @@ class Devise::RegistrationsController < DeviseController
16
14
  def create
17
15
  build_resource(sign_up_params)
18
16
 
19
- resource_saved = resource.save
17
+ resource.save
20
18
  yield resource if block_given?
21
- if resource_saved
19
+ if resource.persisted?
22
20
  if resource.active_for_authentication?
23
21
  set_flash_message :notice, :signed_up if is_flashing_format?
24
22
  sign_up(resource_name, resource)
@@ -30,10 +28,7 @@ class Devise::RegistrationsController < DeviseController
30
28
  end
31
29
  else
32
30
  clean_up_passwords resource
33
- @validatable = devise_mapping.validatable?
34
- if @validatable
35
- @minimum_password_length = resource_class.password_length.min
36
- end
31
+ set_minimum_password_length
37
32
  respond_with resource
38
33
  end
39
34
  end
@@ -145,4 +140,8 @@ class Devise::RegistrationsController < DeviseController
145
140
  def account_update_params
146
141
  devise_parameter_sanitizer.sanitize(:account_update)
147
142
  end
143
+
144
+ def translation_scope
145
+ 'devise.registrations'
146
+ end
148
147
  end
@@ -1,13 +1,14 @@
1
1
  class Devise::SessionsController < DeviseController
2
- prepend_before_filter :require_no_authentication, only: [ :new, :create ]
2
+ prepend_before_filter :require_no_authentication, only: [:new, :create]
3
3
  prepend_before_filter :allow_params_authentication!, only: :create
4
4
  prepend_before_filter :verify_signed_out_user, only: :destroy
5
- prepend_before_filter only: [ :create, :destroy ] { request.env["devise.skip_timeout"] = true }
5
+ prepend_before_filter only: [:create, :destroy] { request.env["devise.skip_timeout"] = true }
6
6
 
7
7
  # GET /resource/sign_in
8
8
  def new
9
9
  self.resource = resource_class.new(sign_in_params)
10
10
  clean_up_passwords(resource)
11
+ yield resource if block_given?
11
12
  respond_with(resource, serialize_options(resource))
12
13
  end
13
14
 
@@ -45,6 +46,10 @@ class Devise::SessionsController < DeviseController
45
46
  { scope: resource_name, recall: "#{controller_path}#new" }
46
47
  end
47
48
 
49
+ def translation_scope
50
+ 'devise.sessions'
51
+ end
52
+
48
53
  private
49
54
 
50
55
  # Check if there is no signed in user before doing the sign out.
@@ -43,4 +43,7 @@ class Devise::UnlocksController < DeviseController
43
43
  new_session_path(resource) if is_navigational_format?
44
44
  end
45
45
 
46
+ def translation_scope
47
+ 'devise.unlocks'
48
+ end
46
49
  end
@@ -6,12 +6,28 @@ class DeviseController < Devise.parent_controller.constantize
6
6
 
7
7
  helpers = %w(resource scope_name resource_name signed_in_resource
8
8
  resource_class resource_params devise_mapping)
9
- hide_action(*helpers)
10
9
  helper_method(*helpers)
11
10
 
12
11
  prepend_before_filter :assert_is_devise_resource!
13
12
  respond_to :html if mimes_for_respond_to.empty?
14
13
 
14
+ # Override prefixes to consider the scoped view.
15
+ # Notice we need to check for the request due to a bug in
16
+ # Action Controller tests that forces _prefixes to be
17
+ # loaded before even having a request object.
18
+ #
19
+ # This method should be public as it is is in ActionPack
20
+ # itself. Changing its visibility may break other gems.
21
+ def _prefixes #:nodoc:
22
+ @_prefixes ||= if self.class.scoped_views? && request && devise_mapping
23
+ ["#{devise_mapping.scoped_path}/#{controller_name}"] + super
24
+ else
25
+ super
26
+ end
27
+ end
28
+
29
+ protected
30
+
15
31
  # Gets the actual resource stored in the instance variable
16
32
  def resource
17
33
  instance_variable_get(:"@#{resource_name}")
@@ -38,22 +54,6 @@ class DeviseController < Devise.parent_controller.constantize
38
54
  @devise_mapping ||= request.env["devise.mapping"]
39
55
  end
40
56
 
41
- # Override prefixes to consider the scoped view.
42
- # Notice we need to check for the request due to a bug in
43
- # Action Controller tests that forces _prefixes to be
44
- # loaded before even having a request object.
45
- def _prefixes #:nodoc:
46
- @_prefixes ||= if self.class.scoped_views? && request && devise_mapping
47
- ["#{devise_mapping.scoped_path}/#{controller_name}"] + super
48
- else
49
- super
50
- end
51
- end
52
-
53
- hide_action :_prefixes
54
-
55
- protected
56
-
57
57
  # Checks whether it's a devise mapped resource or not.
58
58
  def assert_is_devise_resource! #:nodoc:
59
59
  unknown_action! <<-MESSAGE unless devise_mapping
@@ -129,8 +129,11 @@ MESSAGE
129
129
  end
130
130
 
131
131
  # Sets the flash message with :key, using I18n. By default you are able
132
- # to setup your messages using specific resource scope, and if no one is
133
- # found we look to default scope.
132
+ # to setup your messages using specific resource scope, and if no message is
133
+ # found we look to the default scope. Set the "now" options key to a true
134
+ # value to populate the flash.now hash in lieu of the default flash hash (so
135
+ # the flash message will be available to the current action instead of the
136
+ # next action).
134
137
  # Example (i18n locale file):
135
138
  #
136
139
  # en:
@@ -144,7 +147,18 @@ MESSAGE
144
147
  # available.
145
148
  def set_flash_message(key, kind, options = {})
146
149
  message = find_message(kind, options)
147
- flash[key] = message if message.present?
150
+ if options[:now]
151
+ flash.now[key] = message if message.present?
152
+ else
153
+ flash[key] = message if message.present?
154
+ end
155
+ end
156
+
157
+ # Sets minimum password length to show to user
158
+ def set_minimum_password_length
159
+ if devise_mapping.validatable?
160
+ @minimum_password_length = resource_class.password_length.min
161
+ end
148
162
  end
149
163
 
150
164
  def devise_i18n_options(options)
@@ -153,13 +167,20 @@ MESSAGE
153
167
 
154
168
  # Get message for given
155
169
  def find_message(kind, options = {})
156
- options[:scope] = "devise.#{controller_name}"
170
+ options[:scope] ||= translation_scope
157
171
  options[:default] = Array(options[:default]).unshift(kind.to_sym)
158
172
  options[:resource_name] = resource_name
159
173
  options = devise_i18n_options(options)
160
174
  I18n.t("#{options[:resource_name]}.#{kind}", options)
161
175
  end
162
176
 
177
+ # Controllers inheriting DeviseController are advised to override this
178
+ # method so that other controllers inheriting from them would use
179
+ # existing translations.
180
+ def translation_scope
181
+ "devise.#{controller_name}"
182
+ end
183
+
163
184
  def clean_up_passwords(object)
164
185
  object.clean_up_passwords if object.respond_to?(:clean_up_passwords)
165
186
  end
@@ -173,4 +194,6 @@ MESSAGE
173
194
  def resource_params
174
195
  params.fetch(resource_name, {})
175
196
  end
197
+
198
+ ActiveSupport.run_load_hooks(:devise_controller, self)
176
199
  end
@@ -16,5 +16,9 @@ if defined?(ActionMailer)
16
16
  @token = token
17
17
  devise_mail(record, :unlock_instructions, opts)
18
18
  end
19
+
20
+ def password_change(record, opts={})
21
+ devise_mail(record, :password_change, opts)
22
+ end
19
23
  end
20
24
  end
@@ -3,10 +3,14 @@
3
3
  <%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %>
4
4
  <%= devise_error_messages! %>
5
5
 
6
- <div><%= f.label :email %><br />
7
- <%= f.email_field :email, autofocus: true %></div>
6
+ <div class="field">
7
+ <%= f.label :email %><br />
8
+ <%= f.email_field :email, autofocus: true, value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) %>
9
+ </div>
8
10
 
9
- <div><%= f.submit "Resend confirmation instructions" %></div>
11
+ <div class="actions">
12
+ <%= f.submit "Resend confirmation instructions" %>
13
+ </div>
10
14
  <% end %>
11
15
 
12
16
  <%= render "devise/shared/links" %>
@@ -0,0 +1,3 @@
1
+ <p>Hello <%= @resource.email %>!</p>
2
+
3
+ <p>We're contacting you to notify you that your password has been changed.</p>
@@ -4,13 +4,22 @@
4
4
  <%= devise_error_messages! %>
5
5
  <%= f.hidden_field :reset_password_token %>
6
6
 
7
- <div><%= f.label :password, "New password" %><br />
8
- <%= f.password_field :password, autofocus: true, autocomplete: "off" %></div>
7
+ <div class="field">
8
+ <%= f.label :password, "New password" %><br />
9
+ <% if @minimum_password_length %>
10
+ <em>(<%= @minimum_password_length %> characters minimum)</em><br />
11
+ <% end %>
12
+ <%= f.password_field :password, autofocus: true, autocomplete: "off" %>
13
+ </div>
9
14
 
10
- <div><%= f.label :password_confirmation, "Confirm new password" %><br />
11
- <%= f.password_field :password_confirmation, autocomplete: "off" %></div>
15
+ <div class="field">
16
+ <%= f.label :password_confirmation, "Confirm new password" %><br />
17
+ <%= f.password_field :password_confirmation, autocomplete: "off" %>
18
+ </div>
12
19
 
13
- <div><%= f.submit "Change my password" %></div>
20
+ <div class="actions">
21
+ <%= f.submit "Change my password" %>
22
+ </div>
14
23
  <% end %>
15
24
 
16
25
  <%= render "devise/shared/links" %>
@@ -3,10 +3,14 @@
3
3
  <%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %>
4
4
  <%= devise_error_messages! %>
5
5
 
6
- <div><%= f.label :email %><br />
7
- <%= f.email_field :email, autofocus: true %></div>
6
+ <div class="field">
7
+ <%= f.label :email %><br />
8
+ <%= f.email_field :email, autofocus: true %>
9
+ </div>
8
10
 
9
- <div><%= f.submit "Send me reset password instructions" %></div>
11
+ <div class="actions">
12
+ <%= f.submit "Send me reset password instructions" %>
13
+ </div>
10
14
  <% end %>
11
15
 
12
16
  <%= render "devise/shared/links" %>
@@ -3,23 +3,33 @@
3
3
  <%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
4
4
  <%= devise_error_messages! %>
5
5
 
6
- <div><%= f.label :email %><br />
7
- <%= f.email_field :email, autofocus: true %></div>
6
+ <div class="field">
7
+ <%= f.label :email %><br />
8
+ <%= f.email_field :email, autofocus: true %>
9
+ </div>
8
10
 
9
11
  <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
10
12
  <div>Currently waiting confirmation for: <%= resource.unconfirmed_email %></div>
11
13
  <% end %>
12
14
 
13
- <div><%= f.label :password %> <i>(leave blank if you don't want to change it)</i><br />
14
- <%= f.password_field :password, autocomplete: "off" %></div>
15
+ <div class="field">
16
+ <%= f.label :password %> <i>(leave blank if you don't want to change it)</i><br />
17
+ <%= f.password_field :password, autocomplete: "off" %>
18
+ </div>
15
19
 
16
- <div><%= f.label :password_confirmation %><br />
17
- <%= f.password_field :password_confirmation, autocomplete: "off" %></div>
20
+ <div class="field">
21
+ <%= f.label :password_confirmation %><br />
22
+ <%= f.password_field :password_confirmation, autocomplete: "off" %>
23
+ </div>
18
24
 
19
- <div><%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br />
20
- <%= f.password_field :current_password, autocomplete: "off" %></div>
25
+ <div class="field">
26
+ <%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br />
27
+ <%= f.password_field :current_password, autocomplete: "off" %>
28
+ </div>
21
29
 
22
- <div><%= f.submit "Update" %></div>
30
+ <div class="actions">
31
+ <%= f.submit "Update" %>
32
+ </div>
23
33
  <% end %>
24
34
 
25
35
  <h3>Cancel my account</h3>
@@ -3,16 +3,27 @@
3
3
  <%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
4
4
  <%= devise_error_messages! %>
5
5
 
6
- <div><%= f.label :email %><br />
7
- <%= f.email_field :email, autofocus: true %></div>
6
+ <div class="field">
7
+ <%= f.label :email %><br />
8
+ <%= f.email_field :email, autofocus: true %>
9
+ </div>
8
10
 
9
- <div><%= f.label :password %> <% if @validatable %><i>(<%= @minimum_password_length %> characters minimum)</i><% end %><br />
10
- <%= f.password_field :password, autocomplete: "off" %></div>
11
+ <div class="field">
12
+ <%= f.label :password %>
13
+ <% if @minimum_password_length %>
14
+ <em>(<%= @minimum_password_length %> characters minimum)</em>
15
+ <% end %><br />
16
+ <%= f.password_field :password, autocomplete: "off" %>
17
+ </div>
11
18
 
12
- <div><%= f.label :password_confirmation %><br />
13
- <%= f.password_field :password_confirmation, autocomplete: "off" %></div>
19
+ <div class="field">
20
+ <%= f.label :password_confirmation %><br />
21
+ <%= f.password_field :password_confirmation, autocomplete: "off" %>
22
+ </div>
14
23
 
15
- <div><%= f.submit "Sign up" %></div>
24
+ <div class="actions">
25
+ <%= f.submit "Sign up" %>
26
+ </div>
16
27
  <% end %>
17
28
 
18
29
  <%= render "devise/shared/links" %>
@@ -1,17 +1,26 @@
1
1
  <h2>Log in</h2>
2
2
 
3
3
  <%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
4
- <div><%= f.label :email %><br />
5
- <%= f.email_field :email, autofocus: true %></div>
4
+ <div class="field">
5
+ <%= f.label :email %><br />
6
+ <%= f.email_field :email, autofocus: true %>
7
+ </div>
6
8
 
7
- <div><%= f.label :password %><br />
8
- <%= f.password_field :password, autocomplete: "off" %></div>
9
+ <div class="field">
10
+ <%= f.label :password %><br />
11
+ <%= f.password_field :password, autocomplete: "off" %>
12
+ </div>
9
13
 
10
14
  <% if devise_mapping.rememberable? -%>
11
- <div><%= f.check_box :remember_me %> <%= f.label :remember_me %></div>
15
+ <div class="field">
16
+ <%= f.check_box :remember_me %>
17
+ <%= f.label :remember_me %>
18
+ </div>
12
19
  <% end -%>
13
20
 
14
- <div><%= f.submit "Log in" %></div>
21
+ <div class="actions">
22
+ <%= f.submit "Log in" %>
23
+ </div>
15
24
  <% end %>
16
25
 
17
26
  <%= render "devise/shared/links" %>
@@ -20,6 +20,6 @@
20
20
 
21
21
  <%- if devise_mapping.omniauthable? %>
22
22
  <%- resource_class.omniauth_providers.each do |provider| %>
23
- <%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) %><br />
23
+ <%= link_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider) %><br />
24
24
  <% end -%>
25
25
  <% end -%>
@@ -3,10 +3,14 @@
3
3
  <%= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %>
4
4
  <%= devise_error_messages! %>
5
5
 
6
- <div><%= f.label :email %><br />
7
- <%= f.email_field :email, autofocus: true %></div>
6
+ <div class="field">
7
+ <%= f.label :email %><br />
8
+ <%= f.email_field :email, autofocus: true %>
9
+ </div>
8
10
 
9
- <div><%= f.submit "Resend unlock instructions" %></div>
11
+ <div class="actions">
12
+ <%= f.submit "Resend unlock instructions" %>
13
+ </div>
10
14
  <% end %>
11
15
 
12
16
  <%= render "devise/shared/links" %>
@@ -9,10 +9,10 @@ en:
9
9
  failure:
10
10
  already_authenticated: "You are already signed in."
11
11
  inactive: "Your account is not activated yet."
12
- invalid: "Invalid email or password."
12
+ invalid: "Invalid %{authentication_keys} or password."
13
13
  locked: "Your account is locked."
14
14
  last_attempt: "You have one more attempt before your account is locked."
15
- not_found_in_database: "Invalid email address or password."
15
+ not_found_in_database: "Invalid %{authentication_keys} or password."
16
16
  timeout: "Your session expired. Please sign in again to continue."
17
17
  unauthenticated: "You need to sign in or sign up before continuing."
18
18
  unconfirmed: "You have to confirm your email address before continuing."
@@ -23,6 +23,8 @@ en:
23
23
  subject: "Reset password instructions"
24
24
  unlock_instructions:
25
25
  subject: "Unlock instructions"
26
+ password_change:
27
+ subject: "Password Changed"
26
28
  omniauth_callbacks:
27
29
  failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
28
30
  success: "Successfully authenticated from %{kind} account."
data/devise.gemspec CHANGED
@@ -13,15 +13,15 @@ Gem::Specification.new do |s|
13
13
  s.description = "Flexible authentication solution for Rails with Warden"
14
14
  s.authors = ['José Valim', 'Carlos Antônio']
15
15
 
16
- s.rubyforge_project = "devise"
17
-
18
16
  s.files = `git ls-files`.split("\n")
19
17
  s.test_files = `git ls-files -- test/*`.split("\n")
20
18
  s.require_paths = ["lib"]
19
+ s.required_ruby_version = '>= 1.9.3'
21
20
 
22
21
  s.add_dependency("warden", "~> 1.2.3")
23
22
  s.add_dependency("orm_adapter", "~> 0.1")
24
23
  s.add_dependency("bcrypt", "~> 3.0")
25
24
  s.add_dependency("thread_safe", "~> 0.1")
26
25
  s.add_dependency("railties", ">= 3.2.6", "< 5")
26
+ s.add_dependency("responders")
27
27
  end