From f132e42a12945dc55e4bb7f1cd8dd67206580c03 Mon Sep 17 00:00:00 2001 From: Toks Date: Fri, 30 May 2014 02:57:23 -0400 Subject: [PATCH] Fix user renames and deletions related to #1941 --- app/controllers/users_controller.rb | 2 +- app/models/user.rb | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 75529c76f..a337573ae 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -50,7 +50,7 @@ class UsersController < ApplicationController @user = User.find(params[:id]) check_privilege(@user) sanitize_params! - @user.update_attributes(params[:user], :as => CurrentUser.role) + @user.update_attributes(params[:user].except(:name), :as => CurrentUser.role) cookies.delete(:favorite_tags) cookies.delete(:favorite_tags_with_categories) if @user.errors.any? diff --git a/app/models/user.rb b/app/models/user.rb index 592897018..3563495d9 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -19,7 +19,6 @@ class User < ActiveRecord::Base attr_accessor :password, :old_password attr_accessible :enable_privacy_mode, :enable_post_navigation, :new_post_navigation_layout, :password, :old_password, :password_confirmation, :password_hash, :email, :last_logged_in_at, :last_forum_read_at, :has_mail, :receive_email_notifications, :comment_threshold, :always_resize_images, :favorite_tags, :blacklisted_tags, :name, :ip_addr, :time_zone, :default_image_size, :enable_sequential_post_navigation, :per_page, :hide_deleted_posts, :style_usernames, :enable_auto_complete, :custom_style, :show_deleted_children, :as => [:moderator, :janitor, :contributor, :gold, :member, :anonymous, :default, :builder, :admin] attr_accessible :level, :as => :admin - attr_readonly :name validates_length_of :name, :within => 2..100, :on => :create validates_format_of :name, :with => /\A[^\s:]+\Z/, :on => :create, :message => "cannot have whitespace or colons" validates_format_of :name, :with => /\A[^_].*[^_]\Z/, :on => :create, :message => "cannot begin or end with an underscore"