mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-03 03:40:49 +08:00
add: org valid
This commit is contained in:
8
app/forms/organizations/create_form.rb
Normal file
8
app/forms/organizations/create_form.rb
Normal file
@@ -0,0 +1,8 @@
|
||||
class Organizations::CreateForm < BaseForm
|
||||
NAME_REGEX = /^(?!_)(?!.*?_$)[a-zA-Z0-9_-]+$/ #只含有数字、字母、下划线不能以下划线开头和结尾
|
||||
attr_accessor :name, :description, :website, :location, :repo_admin_change_team_access, :visibility, :max_repo_creation, :nickname
|
||||
|
||||
validates :name, :nickname, :visibility, presence: true
|
||||
validates :name, format: { with: NAME_REGEX, multiline: true, message: "只能含有数字、字母、下划线且不能以下划线开头和结尾" }
|
||||
|
||||
end
|
||||
8
app/forms/organizations/create_team_form.rb
Normal file
8
app/forms/organizations/create_team_form.rb
Normal file
@@ -0,0 +1,8 @@
|
||||
class Organizations::CreateTeamForm < BaseForm
|
||||
NAME_REGEX = /^(?!_)(?!.*?_$)[a-zA-Z0-9_-]+$/ #只含有数字、字母、下划线不能以下划线开头和结尾
|
||||
attr_accessor :name, :nickname, :description, :authorize, :includes_all_project, :can_create_org_project, :unit_types
|
||||
|
||||
validates :name, :nickname, :authorize, :includes_all_project, presence: true
|
||||
validates :name, format: { with: NAME_REGEX, multiline: true, message: "只能含有数字、字母、下划线且不能以下划线开头和结尾" }
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user