|
|
@ -164,7 +164,7 @@ class User < ApplicationRecord
|
|
|
|
# validates_format_of :mail, with: VALID_EMAIL_REGEX, multiline: true
|
|
|
|
# validates_format_of :mail, with: VALID_EMAIL_REGEX, multiline: true
|
|
|
|
# validates_format_of :phone, with: VALID_PHONE_REGEX, multiline: true
|
|
|
|
# validates_format_of :phone, with: VALID_PHONE_REGEX, multiline: true
|
|
|
|
validate :validate_password_length
|
|
|
|
validate :validate_password_length
|
|
|
|
validate :validate_ID_number
|
|
|
|
#validate :validate_ID_number
|
|
|
|
#validates_format_of :ID_number, with: VALID_NUMBER_REGEX, multiline: true, message: "身份证号格式不对"
|
|
|
|
#validates_format_of :ID_number, with: VALID_NUMBER_REGEX, multiline: true, message: "身份证号格式不对"
|
|
|
|
# validates :nickname, presence: true, length: { maximum: 10 }
|
|
|
|
# validates :nickname, presence: true, length: { maximum: 10 }
|
|
|
|
# validates :lastname, presence: true
|
|
|
|
# validates :lastname, presence: true
|
|
|
@ -620,12 +620,6 @@ class User < ApplicationRecord
|
|
|
|
raise("密码长度不能低于#{MIX_PASSWORD_LIMIT}位")
|
|
|
|
raise("密码长度不能低于#{MIX_PASSWORD_LIMIT}位")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def validate_ID_number
|
|
|
|
|
|
|
|
if id_number.present? && id_number =~ VALID_NUMBER_REGEX
|
|
|
|
|
|
|
|
raise("身份证格式不对")
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|