Merge branch 'dev_cxt' into dev_aliyun

dev_forge
cxt 5 years ago
commit 13d205ca99

@ -3,7 +3,7 @@ class Users::ApplyAuthenticationForm
attr_accessor :name, :show_realname, :id_number, :gender, :upload_image, :attachment_ids
validates :name, presence: true
validates :name, presence: true, length: { minimum: 2, maximum: 10 }, format: { with: CustomRegexp::LASTNAME, message: "2-10位中英文、数字" }
validate :validate_ID_number
validate :validate_attachment_ids

@ -5,8 +5,8 @@ class Users::UpdateAccountForm
attr_accessor :nickname, :name, :show_realname, :gender, :location, :location_city,
:identity, :student_id, :technical_title, :school_id, :department_id
validates :nickname, presence: true, length: { maximum: 20 }
validates :name, presence: true, length: { maximum: 10 }
validates :nickname, presence: true, length: { minimum: 2, maximum: 20 }, format: { with: CustomRegexp::NICKNAME, message: "2-20位中英文、数字及下划线" }
validates :name, presence: true, length: { minimum: 2, maximum: 10 }, format: { with: CustomRegexp::LASTNAME, message: "2-10位中英文、数字" }
validates :gender, presence: true, numericality: { only_integer: true }, inclusion: { in: [0, 1] }
validates :location, presence: true
validates :location_city, presence: true

@ -1,4 +1,6 @@
module CustomRegexp
PHONE = /1\d{10}/
EMAIL = /^[a-zA-Z0-9]+([._\\]*[a-zA-Z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/
EMAIL = /\A[a-zA-Z0-9]+([._\\]*[a-zA-Z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+\z/
LASTNAME = /\A[a-zA-Z0-9\u4e00-\u9fa5]+\z/
NICKNAME = /\A[\u4e00-\u9fa5_a-zA-Z0-9]+\z/
end
Loading…
Cancel
Save