Allowed updating of attributes without a password if password_required? resolves to false

This commit is contained in:
Tod Detre
2013-08-20 16:36:35 -04:00
parent 605924a921
commit 6a22e88dfa

View File

@@ -40,7 +40,15 @@ class Devise::RegistrationsController < DeviseController
self.resource = resource_class.to_adapter.get!(send(:"current_#{resource_name}").to_key)
prev_unconfirmed_email = resource.unconfirmed_email if resource.respond_to?(:unconfirmed_email)
if resource.update_with_password(account_update_params)
#check to see if a password is required. If not, update_without_password
update_status = false
if resource.password_required?
update_status = resource.update_with_password(account_update_params)
else
update_status = resource.update_without_password(account_update_params)
end
if update_status
if is_navigational_format?
flash_key = update_needs_confirmation?(resource, prev_unconfirmed_email) ?
:update_needs_confirmation : :updated