mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-21 20:25:45 +08:00
add: reversed keyword and api forbidden
This commit is contained in:
@@ -9,6 +9,7 @@ class AccountsController < ApplicationController
|
||||
# 其他平台同步注册的用户
|
||||
def remote_register
|
||||
username = params[:username]&.gsub(/\s+/, "")
|
||||
return render_forbidden('该用户名为系统保留关键字.') if ReversedKeyword.is_reversed(username).present?
|
||||
email = params[:email]&.gsub(/\s+/, "")
|
||||
password = params[:password]
|
||||
platform = (params[:platform] || 'forge')&.gsub(/\s+/, "")
|
||||
|
||||
@@ -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?
|
||||
|
||||
@@ -45,6 +45,7 @@ class ProjectsController < ApplicationController
|
||||
|
||||
def create
|
||||
ActiveRecord::Base.transaction do
|
||||
return render_forbidden('该项目标识为系统保留关键字.') if ReversedKeyword.is_reversed(project_params[:repository_name]).present?
|
||||
Projects::CreateForm.new(project_params).validate!
|
||||
@project = Projects::CreateService.new(current_user, project_params).call
|
||||
|
||||
@@ -55,6 +56,7 @@ class ProjectsController < ApplicationController
|
||||
end
|
||||
|
||||
def migrate
|
||||
return render_forbidden('该项目标识为系统保留关键字.') if ReversedKeyword.is_reversed(mirror_params[:repository_name]).present?
|
||||
Projects::MigrateForm.new(mirror_params).validate!
|
||||
|
||||
@project =
|
||||
|
||||
Reference in New Issue
Block a user