diff --git a/lib/devise/models/database_authenticatable.rb b/lib/devise/models/database_authenticatable.rb
index b88aa453..033f84e7 100644
--- a/lib/devise/models/database_authenticatable.rb
+++ b/lib/devise/models/database_authenticatable.rb
@@ -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
diff --git a/test/integration/authenticatable_test.rb b/test/integration/authenticatable_test.rb
index 8f5e73f9..8abc6d5f 100644
--- a/test/integration/authenticatable_test.rb
+++ b/test/integration/authenticatable_test.rb
@@ -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 "\n\n \n \n\n", response.body
+ assert_equal "\n\n \n \n\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