| @@ -15,6 +15,7 @@ class Admins::IdentityVerificationsController < Admins::BaseController | |||||
| def update | def update | ||||
| if @identity_verification.update(update_params) | if @identity_verification.update(update_params) | ||||
| UserAction.create(action_id: @identity_verification.id, action_type: "UpdateIdentityVerifications", user_id: current_user.id, :ip => request.remote_ip, data_bank: @identity_verification.attributes.to_json) | |||||
| redirect_to admins_identity_verifications_path | redirect_to admins_identity_verifications_path | ||||
| flash[:success] = "更新成功" | flash[:success] = "更新成功" | ||||
| else | else | ||||
| @@ -29,8 +29,12 @@ class Admins::SitePagesController < Admins::BaseController | |||||
| end | end | ||||
| def update | def update | ||||
| @site_page.update(update_params) | |||||
| flash[:success] = '保存成功' | |||||
| if update_params[:state] == "false" && update_params[:state_description].blank? | |||||
| flash[:danger] = '关闭站点理由不能为空' | |||||
| else | |||||
| @site_page.update(update_params) | |||||
| flash[:success] = '保存成功' | |||||
| end | |||||
| render 'edit' | render 'edit' | ||||
| end | end | ||||
| @@ -1,12 +1,12 @@ | |||||
| class Organizations::CreateForm < BaseForm | class Organizations::CreateForm < BaseForm | ||||
| NAME_REGEX = /^(?!_)(?!.*?_$)[a-zA-Z0-9_-]+$/ #只含有数字、字母、下划线不能以下划线开头和结尾 | |||||
| NAME_REGEX = /^[a-zA-Z0-9]+([-_.][a-zA-Z0-9]+)*$/ #只含有数字、字母、下划线不能以下划线开头和结尾 | |||||
| attr_accessor :name, :description, :website, :location, :repo_admin_change_team_access, :visibility, :max_repo_creation, :nickname, :original_name | attr_accessor :name, :description, :website, :location, :repo_admin_change_team_access, :visibility, :max_repo_creation, :nickname, :original_name | ||||
| validates :name, :nickname, :visibility, presence: true | validates :name, :nickname, :visibility, presence: true | ||||
| validates :name, :nickname, length: { maximum: 100 } | validates :name, :nickname, length: { maximum: 100 } | ||||
| validates :location, length: { maximum: 50 } | validates :location, length: { maximum: 50 } | ||||
| validates :description, length: { maximum: 200 } | validates :description, length: { maximum: 200 } | ||||
| validates :name, format: { with: NAME_REGEX, multiline: true, message: "只能含有数字、字母、下划线且不能以下划线开头和结尾" } | |||||
| validates :name, format: { with: NAME_REGEX, multiline: true, message: "只能以数字或字母开头,仅支持横杠、下划线、点三种符号,不允许符号连续排列,长度4-50个字符" } | |||||
| validate do | validate do | ||||
| check_name(name) unless name.blank? || name == original_name | check_name(name) unless name.blank? || name == original_name | ||||
| @@ -64,7 +64,7 @@ | |||||
| class Organization < Owner | class Organization < Owner | ||||
| alias_attribute :name, :login | alias_attribute :name, :login | ||||
| NAME_REGEX = /^(?!_)(?!.*?_$)[a-zA-Z0-9_-]+$/ #只含有数字、字母、下划线不能以下划线开头和结尾 | |||||
| NAME_REGEX = /^[a-zA-Z0-9]+([-_.][a-zA-Z0-9]+)*$/ #只含有数字、字母、下划线不能以下划线开头和结尾 | |||||
| default_scope { where(type: "Organization") } | default_scope { where(type: "Organization") } | ||||
| @@ -79,7 +79,7 @@ class Organization < Owner | |||||
| validates :login, presence: true | validates :login, presence: true | ||||
| validates_uniqueness_of :login, :if => Proc.new { |user| user.login_changed? && user.login.present? }, case_sensitive: false | validates_uniqueness_of :login, :if => Proc.new { |user| user.login_changed? && user.login.present? }, case_sensitive: false | ||||
| validates :login, format: { with: NAME_REGEX, multiline: true, message: "只能含有数字、字母、下划线且不能以下划线开头和结尾" } | |||||
| validates :login, format: { with: NAME_REGEX, multiline: true, message: "只能以数字或字母开头,仅支持横杠、下划线、点三种符号,不允许符号连续排列,长度4-50个字符" } | |||||
| delegate :description, :website, :location, :repo_admin_change_team_access, :recommend, | delegate :description, :website, :location, :repo_admin_change_team_access, :recommend, | ||||
| :visibility, :max_repo_creation, :num_projects, :num_users, :num_teams, | :visibility, :max_repo_creation, :num_projects, :num_users, :num_teams, | ||||