Commit 09cb2ba8151a60056f4d17fb448ed79c31f02bee
1 parent
ffd0a985
Exists in
master
and in
4 other branches
Fix password update
Showing
1 changed file
with
3 additions
and
3 deletions
Show diff stats
app/controllers/profiles_controller.rb
@@ -33,8 +33,8 @@ class ProfilesController < ApplicationController | @@ -33,8 +33,8 @@ class ProfilesController < ApplicationController | ||
33 | end | 33 | end |
34 | 34 | ||
35 | def update_password | 35 | def update_password |
36 | - params[:user].select! do |key, value| | ||
37 | - %w(current_password password password_confirmation).include?(key.to_s) | 36 | + password_attributes = params[:user].select do |key, value| |
37 | + %w(password password_confirmation).include?(key.to_s) | ||
38 | end | 38 | end |
39 | 39 | ||
40 | unless @user.valid_password?(params[:user][:current_password]) | 40 | unless @user.valid_password?(params[:user][:current_password]) |
@@ -42,7 +42,7 @@ class ProfilesController < ApplicationController | @@ -42,7 +42,7 @@ class ProfilesController < ApplicationController | ||
42 | return | 42 | return |
43 | end | 43 | end |
44 | 44 | ||
45 | - if @user.update_attributes(params[:user]) | 45 | + if @user.update_attributes(password_attributes) |
46 | flash[:notice] = "Password was successfully updated. Please login with it" | 46 | flash[:notice] = "Password was successfully updated. Please login with it" |
47 | redirect_to new_user_session_path | 47 | redirect_to new_user_session_path |
48 | else | 48 | else |