From e93873c3d4170af1164622e1080012959e58aa9c Mon Sep 17 00:00:00 2001 From: yystopf Date: Thu, 2 Sep 2021 14:48:33 +0800 Subject: [PATCH] fix --- app/controllers/users_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index a0184a348..470c61437 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -74,7 +74,7 @@ class UsersController < ApplicationController end def update - return render_not_found unless @user = User.find_by_id(params[:id]) || User.find_by(login: params[:id]) + return render_not_found unless @user = User.find_by(login: params[:id]) || User.find_by_id(params[:id]) return render_forbidden unless User.current.logged? && (current_user&.admin? || current_user.id == @user.id) Util.write_file(@image, avatar_path(@user)) if user_params[:image].present? @user.attributes = user_params.except(:image)