Commit 253ae9fe 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 cc193d70
...@@ -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 }
...@@ -114,7 +116,7 @@ class Admin::UsersController < Admin::ApplicationController ...@@ -114,7 +116,7 @@ class Admin::UsersController < Admin::ApplicationController
:email, :remember_me, :bio, :name, :username, :email, :remember_me, :bio, :name, :username,
:skype, :linkedin, :twitter, :website_url, :color_scheme_id, :theme_id, :force_random_password, :skype, :linkedin, :twitter, :website_url, :color_scheme_id, :theme_id, :force_random_password,
:extern_uid, :provider, :password_expires_at, :avatar, :hide_no_ssh_key, :extern_uid, :provider, :password_expires_at, :avatar, :hide_no_ssh_key,
:projects_limit, :can_create_group, :admin, :password, :password_confirmation :projects_limit, :can_create_group, :admin
) )
end end
end end
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