Browse Source

add nickname with reversed_keywords

pull/338/head
呱呱呱 3 years ago
parent
commit
80321c6ca2
1 changed files with 1 additions and 0 deletions
  1. +1
    -0
      app/controllers/users_controller.rb

+ 1
- 0
app/controllers/users_controller.rb View File

@@ -212,6 +212,7 @@ class UsersController < ApplicationController
def update
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)
return normal_status(-1, "昵称无法使用以下关键词:#{user_params[:nickname]},请重新命名") if ReversedKeyword.check_exists?(user_params[:nickname])
Util.write_file(@image, avatar_path(@user)) if user_params[:image].present?
@user.attributes = user_params.except(:image)
unless @user.save


Loading…
Cancel
Save