upto 3.16

This commit is contained in:
Aaro Koivukangas
2023-08-14 17:57:21 +03:00
parent e5f040e583
commit 86e46cb954
2 changed files with 7 additions and 9 deletions
+1 -5
View File
@@ -39,13 +39,9 @@ class UsersController < ApplicationController
# PATCH/PUT /users/1 or /users/1.json
def update
if not @user == current_user
redirect_to user_path(@user), notice: "User not authorized to edit this user"
return
end
respond_to do |format|
if @user.update(user_params)
if user_params[:username].nil? && @user == current_user && @user.update(user_params)
format.html { redirect_to user_url(@user), notice: "User was successfully updated." }
format.json { render :show, status: :ok, location: @user }
else