Commit de582ab3 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Fix user params when edit from admin area

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent aa25c0ff
...@@ -59,15 +59,17 @@ class Admin::UsersController < Admin::ApplicationController ...@@ -59,15 +59,17 @@ class Admin::UsersController < Admin::ApplicationController
end end
def update def update
user_params_with_pass = user_params.dup
if params[:user][:password].present? if params[:user][:password].present?
user_params.merge( user_params_with_pass.merge!(
password: params[:user][:password], password: params[:user][:password],
password_confirmation: params[:user][:password_confirmation], password_confirmation: params[:user][:password_confirmation],
) )
end end
respond_to do |format| respond_to do |format|
if user.update_attributes(user_params) if user.update_attributes(user_params_with_pass)
user.confirm! user.confirm!
format.html { redirect_to [:admin, user], notice: 'User was successfully updated.' } format.html { redirect_to [:admin, user], notice: 'User was successfully updated.' }
format.json { head :ok } format.json { head :ok }
......
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