After a password reset, don't show "You are now signed in." if the user can't be signed-in anyway.

This commit is contained in:
Rémy Coutable 2011-09-01 00:24:10 +02:00
parent eba53f8f94
commit ebbabaea5b
3 changed files with 6 additions and 2 deletions

View File

@ -32,7 +32,8 @@ class Devise::PasswordsController < ApplicationController
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 File

@ -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 File

@ -147,7 +147,7 @@ class PasswordTest < ActionController::IntegrationTest
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 @@ class PasswordTest < ActionController::IntegrationTest
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