Merge pull request #1313 from jamescook/fix_bug_with_update_with_password

DatabaseAuthenticatable#clean_up_passwords should set accessors to nil
This commit is contained in:
José Valim
2011-09-02 10:48:47 -07:00
2 changed files with 4 additions and 4 deletions

View File

@@ -45,7 +45,7 @@ module Devise
# Set password and password confirmation to nil
def clean_up_passwords
self.password = self.password_confirmation = ""
self.password = self.password_confirmation = nil
end
# Update record attributes when :current_password matches, otherwise returns

View File

@@ -401,14 +401,14 @@ class AuthenticationOthersTest < ActionController::IntegrationTest
test 'sign in stub in xml format' do
get new_user_session_path(:format => 'xml')
assert_equal "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<user>\n <email></email>\n <password></password>\n</user>\n", response.body
assert_equal "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<user>\n <email></email>\n <password nil=\"true\"></password>\n</user>\n", response.body
end
test 'sign in stub in json format' do
get new_user_session_path(:format => 'json')
assert_match '{"user":{', response.body
assert_match '"email":""', response.body
assert_match '"password":""', response.body
assert_match '"password":null', response.body
end
test 'sign in stub in json with non attribute key' do
@@ -416,7 +416,7 @@ class AuthenticationOthersTest < ActionController::IntegrationTest
get new_user_session_path(:format => 'json')
assert_match '{"user":{', response.body
assert_match '"other_key":null', response.body
assert_match '"password":""', response.body
assert_match '"password":null', response.body
end
end