Fix password update

This commit is contained in:
Dmitriy Zaporozhets
2013-09-24 22:12:48 +03:00
parent ffd0a985ee
commit 09cb2ba815
+3 -3
View File
@@ -33,8 +33,8 @@ class ProfilesController < ApplicationController
end
def update_password
params[:user].select! do |key, value|
%w(current_password password password_confirmation).include?(key.to_s)
password_attributes = params[:user].select do |key, value|
%w(password password_confirmation).include?(key.to_s)
end
unless @user.valid_password?(params[:user][:current_password])
@@ -42,7 +42,7 @@ class ProfilesController < ApplicationController
return
end
if @user.update_attributes(params[:user])
if @user.update_attributes(password_attributes)
flash[:notice] = "Password was successfully updated. Please login with it"
redirect_to new_user_session_path
else