DatabaseAuthenticatable#clean_up_passwords should set accessors to nil, not empty string.

This commit is contained in:
James Cook
2011-09-02 13:14:15 -04:00
parent c95ca15b49
commit edcca8cd3f
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