Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

DatabaseAuthenticatable#clean_up_passwords should set accessors to ni…

…l, not empty string.
  • Loading branch information...
commit edcca8cd3fa900caeb2e535716b5cc6d1f17f473 1 parent c95ca15
James Cook authored
View
2  lib/devise/models/database_authenticatable.rb
@@ -45,7 +45,7 @@ def valid_password?(password)
# 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
6 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 "<?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
Please sign in to comment.
Something went wrong with that request. Please try again.