DEV: Remove unused user update params (#23046)

This commit is contained in:
Blake Erickson
2023-08-09 16:55:49 -06:00
committed by GitHub
parent 2a7eb3d5b5
commit d314580c09
2 changed files with 20 additions and 3 deletions

View File

@@ -192,10 +192,10 @@ class UsersController < ApplicationController
def update
user = fetch_user_from_params
guardian.ensure_can_edit!(user)
attributes = user_params
# We can't update the username via this route. Use the username route
attributes.delete(:username)
# Exclude some attributes that are only for user creation because they have
# dedicated update routes.
attributes = user_params.except(:username, :email, :password)
if params[:user_fields].present?
attributes[:custom_fields] ||= {}