Commit 09cb2ba8 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Fix password update

parent ffd0a985
...@@ -33,8 +33,8 @@ class ProfilesController < ApplicationController ...@@ -33,8 +33,8 @@ class ProfilesController < ApplicationController
end end
def update_password def update_password
params[:user].select! do |key, value| password_attributes = params[:user].select do |key, value|
%w(current_password password password_confirmation).include?(key.to_s) %w(password password_confirmation).include?(key.to_s)
end end
unless @user.valid_password?(params[:user][:current_password]) unless @user.valid_password?(params[:user][:current_password])
...@@ -42,7 +42,7 @@ class ProfilesController < ApplicationController ...@@ -42,7 +42,7 @@ class ProfilesController < ApplicationController
return return
end end
if @user.update_attributes(params[:user]) if @user.update_attributes(password_attributes)
flash[:notice] = "Password was successfully updated. Please login with it" flash[:notice] = "Password was successfully updated. Please login with it"
redirect_to new_user_session_path redirect_to new_user_session_path
else else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment