Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #1308 from rymai/conditional_sign_in_after_passwor…

…d_reset

Implement #1306.
  • Loading branch information...
commit 055117e07a95b52346845ea2322395da1bfe18fe 2 parents eba53f8 + ebbabae
@josevalim josevalim authored
View
3  app/controllers/devise/passwords_controller.rb
@@ -32,7 +32,8 @@ def update
self.resource = resource_class.reset_password_by_token(params[resource_name])
if resource.errors.empty?
- set_flash_message(:notice, :updated) if is_navigational_format?
+ flash_message = resource.active_for_authentication? ? :updated : :updated_not_active
+ set_flash_message(:notice, flash_message) if is_navigational_format?
sign_in(resource_name, resource)
respond_with resource, :location => redirect_location(resource_name, resource)
else
View
1  config/locales/en.yml
@@ -27,6 +27,7 @@ en:
passwords:
send_instructions: 'You will receive an email with instructions about how to reset your password in a few minutes.'
updated: 'Your password was changed successfully. You are now signed in.'
+ updated_not_active: 'Your password was changed successfully.'
send_paranoid_instructions: "If your e-mail exists on our database, you will receive a password recovery link on your e-mail"
confirmations:
send_instructions: 'You will receive an email with instructions about how to confirm your account in a few minutes.'
View
4 test/integration/recoverable_test.rb
@@ -147,7 +147,7 @@ def reset_password(options={}, &block)
reset_password :reset_password_token => user.reload.reset_password_token
assert_current_url '/'
- assert_contain 'Your password was changed successfully.'
+ assert_contain 'Your password was changed successfully. You are now signed in.'
assert user.reload.valid_password?('987654321')
end
@@ -179,6 +179,8 @@ def reset_password(options={}, &block)
request_forgot_password
reset_password :reset_password_token => user.reload.reset_password_token
+ assert_contain 'Your password was changed successfully.'
+ assert_not_contain 'You are now signed in.'
assert_equal new_user_session_path, @request.path
assert !warden.authenticated?(:user)
end
Please sign in to comment.
Something went wrong with that request. Please try again.