app/volt/models/user.rb in volt-0.9.4.pre3 vs app/volt/models/user.rb in volt-0.9.4.pre5
- old
+ new
@@ -40,14 +40,16 @@
before_save :hash_password
def hash_password
password = get('password')
- # Clear the password
- set('password', nil)
+ if password.present?
+ # Clear the password
+ set('password', nil)
- # Set the hashed_password field instead
- set('hashed_password', BCrypt::Password.create(password))
+ # Set the hashed_password field instead
+ set('hashed_password', BCrypt::Password.create(password))
+ end
end
end
end
end