add: reversed keyword and api forbidden

This commit is contained in:
2021-08-31 10:18:00 +08:00
parent d1246b8e30
commit fe7dfcea52
6 changed files with 36 additions and 0 deletions

View File

@@ -25,6 +25,7 @@ class Organizations::OrganizationsController < Organizations::BaseController
def create
ActiveRecord::Base.transaction do
return render_forbidden('该组织标识为系统保留关键字.') if ReversedKeyword.is_reversed(organization_params[:name]).present?
Organizations::CreateForm.new(organization_params).validate!
@organization = Organizations::CreateService.call(current_user, organization_params)
Util.write_file(@image, avatar_path(@organization)) if params[:image].present?