validators 3.3.0 → 3.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/.github/FUNDING.yml +1 -0
 - data/.rubocop.yml +3 -18
 - data/README.md +29 -24
 - data/Rakefile +0 -1
 - data/bin/sync-reserved-subdomains +96 -0
 - data/data/reserved_subdomains.txt +4 -22
 - data/lib/validators/disposable_domains.rb +18 -0
 - data/lib/validators/disposable_emails.rb +7 -4
 - data/lib/validators/ip.rb +6 -6
 - data/lib/validators/locale/en.yml +5 -4
 - data/lib/validators/locale/pt-BR.yml +7 -3
 - data/lib/validators/tld.rb +7 -5
 - data/lib/validators/validates_cnpj_format_of.rb +1 -2
 - data/lib/validators/validates_cpf_format_of.rb +1 -2
 - data/lib/validators/validates_datetime.rb +3 -2
 - data/lib/validators/validates_email_format_of.rb +5 -5
 - data/lib/validators/validates_ssh_private_key.rb +1 -3
 - data/lib/validators/validates_ssh_public_key.rb +1 -3
 - data/lib/validators/version.rb +2 -2
 - data/lib/validators.rb +8 -1
 - data/test/test_helper.rb +1 -2
 - data/test/validators/disposable_email_test.rb +0 -2
 - data/test/validators/validates_cnpj_format_of_test.rb +3 -3
 - data/test/validators/validates_cpf_format_of_test.rb +3 -3
 - data/test/validators/validates_email_format_of_test.rb +23 -0
 - data/test/validators/validates_ssh_private_key/common_test.rb +3 -3
 - data/test/validators/validates_ssh_public_key_test.rb +3 -3
 - data/test/validators/validates_url_format_of/with_tld_validation_test.rb +18 -0
 - data/test/validators/validates_url_format_of/without_tld_validation_test.rb +18 -0
 - data/validators.gemspec +3 -1
 - metadata +25 -46
 - data/bin/sync-disposable-hostnames +0 -230
 - data/bin/sync-tld +0 -20
 - data/data/country_tlds.txt +0 -235
 - data/data/disposable_domains.txt +0 -110996
 - data/data/disposable_emails.txt +0 -38
 - data/data/tld.txt +0 -1508
 - data/lib/validators/disposable_hostnames.rb +0 -11
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: d0f693875b0571922e182c06e57d4710dc698506a3859d943973706a4565fa3a
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 36729706a9f37dec4243a16bd7e1a2e77007e07e03077413a78d04fba2607d53
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: ee2529d3bf6c418fff9f38c104c9f8d3df27121213472ef15b12ae19c37f4dbbeb527b821f1d48b4d803a06810efd1fbb7b3807f3cdec574c76ea1d547840def
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 278ff5305f827bf8f097426de34ab0543b57474dc731586b6c278e199b8c7c8ac1499c8d0c875dd54378ab292009a9a8e8bc44f8ea16ba75f317fcdaa9b682eb
         
     | 
    
        data/.github/FUNDING.yml
    ADDED
    
    | 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            github: [fnando]
         
     | 
    
        data/.rubocop.yml
    CHANGED
    
    | 
         @@ -3,20 +3,13 @@ inherit_gem: 
     | 
|
| 
       3 
3 
     | 
    
         
             
              rubocop-fnando: .rubocop.yml
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
            AllCops:
         
     | 
| 
       6 
     | 
    
         
            -
              TargetRubyVersion: 2. 
     | 
| 
      
 6 
     | 
    
         
            +
              TargetRubyVersion: 2.5
         
     | 
| 
      
 7 
     | 
    
         
            +
              Exclude:
         
     | 
| 
      
 8 
     | 
    
         
            +
                - vendor/**/*
         
     | 
| 
       7 
9 
     | 
    
         | 
| 
       8 
10 
     | 
    
         
             
            Style/AsciiComments:
         
     | 
| 
       9 
11 
     | 
    
         
             
              Enabled: false
         
     | 
| 
       10 
12 
     | 
    
         | 
| 
       11 
     | 
    
         
            -
            Metrics/AbcSize:
         
     | 
| 
       12 
     | 
    
         
            -
              Enabled: false
         
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
            Metrics/CyclomaticComplexity:
         
     | 
| 
       15 
     | 
    
         
            -
              Enabled: false
         
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
            Metrics/PerceivedComplexity:
         
     | 
| 
       18 
     | 
    
         
            -
              Enabled: false
         
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
13 
     | 
    
         
             
            Style/Alias:
         
     | 
| 
       21 
14 
     | 
    
         
             
              Enabled: false
         
     | 
| 
       22 
15 
     | 
    
         | 
| 
         @@ -26,13 +19,5 @@ Layout/LineLength: 
     | 
|
| 
       26 
19 
     | 
    
         
             
            Style/IfUnlessModifier:
         
     | 
| 
       27 
20 
     | 
    
         
             
              Enabled: false
         
     | 
| 
       28 
21 
     | 
    
         | 
| 
       29 
     | 
    
         
            -
            Metrics/MethodLength:
         
     | 
| 
       30 
     | 
    
         
            -
              Enabled: false
         
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
            Metrics/BlockLength:
         
     | 
| 
       33 
     | 
    
         
            -
              Exclude:
         
     | 
| 
       34 
     | 
    
         
            -
                - bin/**/*
         
     | 
| 
       35 
     | 
    
         
            -
                - "*.gemspec"
         
     | 
| 
       36 
     | 
    
         
            -
             
     | 
| 
       37 
22 
     | 
    
         
             
            Layout/EmptyLinesAroundAttributeAccessor:
         
     | 
| 
       38 
23 
     | 
    
         
             
              Enabled: false
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -2,7 +2,8 @@ 
     | 
|
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            [](https://travis-ci.org/fnando/validators)
         
     | 
| 
       4 
4 
     | 
    
         
             
            [](https://codeclimate.com/github/fnando/validators)
         
     | 
| 
       5 
     | 
    
         
            -
            [](https://rubygems.org/gems/validators)
         
     | 
| 
      
 6 
     | 
    
         
            +
            [](https://rubygems.org/gems/validators)
         
     | 
| 
       6 
7 
     | 
    
         | 
| 
       7 
8 
     | 
    
         
             
            Add some nice ActiveModel/ActiveRecord validators.
         
     | 
| 
       8 
9 
     | 
    
         | 
| 
         @@ -20,6 +21,11 @@ gem "validators" 
     | 
|
| 
       20 
21 
     | 
    
         | 
| 
       21 
22 
     | 
    
         
             
            ## Usage
         
     | 
| 
       22 
23 
     | 
    
         | 
| 
      
 24 
     | 
    
         
            +
            **Notice**: Some validators will require additional dependencies; whenever you
         
     | 
| 
      
 25 
     | 
    
         
            +
            get a message like
         
     | 
| 
      
 26 
     | 
    
         
            +
            `gem-name is not part of the bundle. Add it to your project's Gemfile.`, all you
         
     | 
| 
      
 27 
     | 
    
         
            +
            have to do is adding that gem to your own project's Gemfile.
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
       23 
29 
     | 
    
         
             
            ### validates_email_format_of
         
     | 
| 
       24 
30 
     | 
    
         | 
| 
       25 
31 
     | 
    
         
             
            ```ruby
         
     | 
| 
         @@ -32,7 +38,9 @@ class User < ActiveRecord::Base 
     | 
|
| 
       32 
38 
     | 
    
         
             
            end
         
     | 
| 
       33 
39 
     | 
    
         
             
            ```
         
     | 
| 
       34 
40 
     | 
    
         | 
| 
       35 
     | 
    
         
            -
            By default, it rejects disposable e-mails (e.g. mailinator). This loads a lot of 
     | 
| 
      
 41 
     | 
    
         
            +
            By default, it rejects disposable e-mails (e.g. mailinator). This loads a lot of
         
     | 
| 
      
 42 
     | 
    
         
            +
            data (~1.7MB), but you can disable this validation by setting
         
     | 
| 
      
 43 
     | 
    
         
            +
            `disposable: true`.
         
     | 
| 
       36 
44 
     | 
    
         | 
| 
       37 
45 
     | 
    
         
             
            ```ruby
         
     | 
| 
       38 
46 
     | 
    
         
             
            class User < ActiveRecord::Base
         
     | 
| 
         @@ -135,7 +143,6 @@ Rules: 
     | 
|
| 
       135 
143 
     | 
    
         
             
            - labels do not consist of numeric values only
         
     | 
| 
       136 
144 
     | 
    
         
             
            - TLD validation (optional)
         
     | 
| 
       137 
145 
     | 
    
         | 
| 
       138 
     | 
    
         
            -
             
     | 
| 
       139 
146 
     | 
    
         
             
            ```ruby
         
     | 
| 
       140 
147 
     | 
    
         
             
            class Server < ActiveRecord::Base
         
     | 
| 
       141 
148 
     | 
    
         
             
              validates_hostname :hostname
         
     | 
| 
         @@ -152,8 +159,8 @@ A valid username/subdomain follows the hostname label validation: 
     | 
|
| 
       152 
159 
     | 
    
         
             
            - cannot begin or end with a hyphen
         
     | 
| 
       153 
160 
     | 
    
         
             
            - cannot consist of numeric values only
         
     | 
| 
       154 
161 
     | 
    
         | 
| 
       155 
     | 
    
         
            -
            The compiled list will be used for both username and subdomain validations. 
         
     | 
| 
       156 
     | 
    
         
            -
             
     | 
| 
      
 162 
     | 
    
         
            +
            The compiled list will be used for both username and subdomain validations. This
         
     | 
| 
      
 163 
     | 
    
         
            +
            validation loads ~20KB of text.
         
     | 
| 
       157 
164 
     | 
    
         | 
| 
       158 
165 
     | 
    
         
             
            ```ruby
         
     | 
| 
       159 
166 
     | 
    
         
             
            class Server < ActiveRecord::Base
         
     | 
| 
         @@ -189,27 +196,25 @@ end 
     | 
|
| 
       189 
196 
     | 
    
         | 
| 
       190 
197 
     | 
    
         
             
            ## Maintainer
         
     | 
| 
       191 
198 
     | 
    
         | 
| 
       192 
     | 
    
         
            -
             
     | 
| 
      
 199 
     | 
    
         
            +
            - [Nando Vieira](http://nandovieira.com)
         
     | 
| 
       193 
200 
     | 
    
         | 
| 
       194 
201 
     | 
    
         
             
            ## License
         
     | 
| 
       195 
202 
     | 
    
         | 
| 
       196 
203 
     | 
    
         
             
            (The MIT License)
         
     | 
| 
       197 
204 
     | 
    
         | 
| 
       198 
     | 
    
         
            -
            Permission is hereby granted, free of charge, to any person obtaining
         
     | 
| 
       199 
     | 
    
         
            -
             
     | 
| 
       200 
     | 
    
         
            -
             
     | 
| 
       201 
     | 
    
         
            -
             
     | 
| 
       202 
     | 
    
         
            -
             
     | 
| 
       203 
     | 
    
         
            -
             
     | 
| 
       204 
     | 
    
         
            -
             
     | 
| 
       205 
     | 
    
         
            -
             
     | 
| 
       206 
     | 
    
         
            -
             
     | 
| 
       207 
     | 
    
         
            -
             
     | 
| 
       208 
     | 
    
         
            -
             
     | 
| 
       209 
     | 
    
         
            -
             
     | 
| 
       210 
     | 
    
         
            -
             
     | 
| 
       211 
     | 
    
         
            -
             
     | 
| 
       212 
     | 
    
         
            -
            IN  
     | 
| 
       213 
     | 
    
         
            -
             
     | 
| 
       214 
     | 
    
         
            -
            TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
         
     | 
| 
       215 
     | 
    
         
            -
            SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
         
     | 
| 
      
 205 
     | 
    
         
            +
            Permission is hereby granted, free of charge, to any person obtaining a copy of
         
     | 
| 
      
 206 
     | 
    
         
            +
            this software and associated documentation files (the 'Software'), to deal in
         
     | 
| 
      
 207 
     | 
    
         
            +
            the Software without restriction, including without limitation the rights to
         
     | 
| 
      
 208 
     | 
    
         
            +
            use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
         
     | 
| 
      
 209 
     | 
    
         
            +
            the Software, and to permit persons to whom the Software is furnished to do so,
         
     | 
| 
      
 210 
     | 
    
         
            +
            subject to the following conditions:
         
     | 
| 
      
 211 
     | 
    
         
            +
             
     | 
| 
      
 212 
     | 
    
         
            +
            The above copyright notice and this permission notice shall be included in all
         
     | 
| 
      
 213 
     | 
    
         
            +
            copies or substantial portions of the Software.
         
     | 
| 
      
 214 
     | 
    
         
            +
             
     | 
| 
      
 215 
     | 
    
         
            +
            THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         
     | 
| 
      
 216 
     | 
    
         
            +
            IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
         
     | 
| 
      
 217 
     | 
    
         
            +
            FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
         
     | 
| 
      
 218 
     | 
    
         
            +
            COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
         
     | 
| 
      
 219 
     | 
    
         
            +
            IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
         
     | 
| 
      
 220 
     | 
    
         
            +
            CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
         
     | 
    
        data/Rakefile
    CHANGED
    
    
| 
         @@ -0,0 +1,96 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #!/usr/bin/env ruby
         
     | 
| 
      
 2 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            require "bundler/setup"
         
     | 
| 
      
 5 
     | 
    
         
            +
            require "open-uri"
         
     | 
| 
      
 6 
     | 
    
         
            +
            require "json"
         
     | 
| 
      
 7 
     | 
    
         
            +
            require "yaml"
         
     | 
| 
      
 8 
     | 
    
         
            +
            require "email_data"
         
     | 
| 
      
 9 
     | 
    
         
            +
            require "aitch"
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            def fetch_nkkollaw
         
     | 
| 
      
 12 
     | 
    
         
            +
              matchers = YAML.safe_load(Aitch.get("https://github.com/nkkollaw/reserved-subdomains/raw/master/reserved-subdomains.yaml").body).map(&:to_s)
         
     | 
| 
      
 13 
     | 
    
         
            +
              matchers.map do |matcher|
         
     | 
| 
      
 14 
     | 
    
         
            +
                next matcher unless matcher.start_with?("/")
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                matcher.gsub(%r{/(.*?)/}) do |_m, _group|
         
     | 
| 
      
 17 
     | 
    
         
            +
                  new_matcher = Regexp.last_match(1).gsub("[0-9]+", "[0-9-]*")
         
     | 
| 
      
 18 
     | 
    
         
            +
                  "/^#{new_matcher}$/"
         
     | 
| 
      
 19 
     | 
    
         
            +
                end
         
     | 
| 
      
 20 
     | 
    
         
            +
              end
         
     | 
| 
      
 21 
     | 
    
         
            +
            end
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
            def fetch_mottie
         
     | 
| 
      
 24 
     | 
    
         
            +
              data = JSON.parse(Aitch.get("https://github.com/Mottie/github-reserved-names/raw/master/oddballs.json").body, symbolize_names: true)
         
     | 
| 
      
 25 
     | 
    
         
            +
              data.keys.map(&:to_s)
         
     | 
| 
      
 26 
     | 
    
         
            +
            end
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
            def fetch_jedireza
         
     | 
| 
      
 29 
     | 
    
         
            +
              data = JSON.parse(Aitch.get("https://github.com/jedireza/reserved-subdomains/raw/master/names.json").body, symbolize_names: true)
         
     | 
| 
      
 30 
     | 
    
         
            +
              data.map(&:to_s)
         
     | 
| 
      
 31 
     | 
    
         
            +
            end
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
            def fetch_mvila
         
     | 
| 
      
 34 
     | 
    
         
            +
              data = JSON.parse(Aitch.get("https://github.com/mvila/reserved-usernames/raw/master/data.json").body)
         
     | 
| 
      
 35 
     | 
    
         
            +
              data.map(&:to_s)
         
     | 
| 
      
 36 
     | 
    
         
            +
            end
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
            def fetch_lukes
         
     | 
| 
      
 39 
     | 
    
         
            +
              data = JSON.parse(Aitch.get("https://github.com/lukes/ISO-3166-Countries-with-Regional-Codes/raw/master/all/all.json").body)
         
     | 
| 
      
 40 
     | 
    
         
            +
              data.map do |info|
         
     | 
| 
      
 41 
     | 
    
         
            +
                info["alpha-2"].downcase
         
     | 
| 
      
 42 
     | 
    
         
            +
              end
         
     | 
| 
      
 43 
     | 
    
         
            +
            end
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
            def fetch_dominicsayers
         
     | 
| 
      
 46 
     | 
    
         
            +
              %w[
         
     | 
| 
      
 47 
     | 
    
         
            +
                https://github.com/dominicsayers/reserved_subdomain/raw/master/lib/reserved_subdomain/literals/miscellaneous.txt
         
     | 
| 
      
 48 
     | 
    
         
            +
              ].each_with_object([]) do |url, buffer|
         
     | 
| 
      
 49 
     | 
    
         
            +
                data = Aitch.get(url).body.lines
         
     | 
| 
      
 50 
     | 
    
         
            +
                buffer.push(*data.map(&:chomp))
         
     | 
| 
      
 51 
     | 
    
         
            +
              end
         
     | 
| 
      
 52 
     | 
    
         
            +
            end
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
            subdomains = []
         
     | 
| 
      
 55 
     | 
    
         
            +
            subdomains << fetch_nkkollaw
         
     | 
| 
      
 56 
     | 
    
         
            +
            subdomains << fetch_mottie
         
     | 
| 
      
 57 
     | 
    
         
            +
            subdomains << fetch_jedireza
         
     | 
| 
      
 58 
     | 
    
         
            +
            subdomains << fetch_mvila
         
     | 
| 
      
 59 
     | 
    
         
            +
            subdomains << fetch_lukes
         
     | 
| 
      
 60 
     | 
    
         
            +
            subdomains << fetch_dominicsayers
         
     | 
| 
      
 61 
     | 
    
         
            +
            subdomains << ("a".."z").to_a
         
     | 
| 
      
 62 
     | 
    
         
            +
            subdomains << EmailData.tlds
         
     | 
| 
      
 63 
     | 
    
         
            +
            subdomains << %w[
         
     | 
| 
      
 64 
     | 
    
         
            +
              /^db[0-9-]*$/
         
     | 
| 
      
 65 
     | 
    
         
            +
              /^dc[0-9-]*$/
         
     | 
| 
      
 66 
     | 
    
         
            +
              /^dev[0-9-]*$/
         
     | 
| 
      
 67 
     | 
    
         
            +
              /^dns[0-9-]*$/
         
     | 
| 
      
 68 
     | 
    
         
            +
              /^ftp[0-9-]*$/
         
     | 
| 
      
 69 
     | 
    
         
            +
              /^host[0-9-]*$/
         
     | 
| 
      
 70 
     | 
    
         
            +
              /^mail[0-9-]*$/
         
     | 
| 
      
 71 
     | 
    
         
            +
              /^mx[0-9-]*$/
         
     | 
| 
      
 72 
     | 
    
         
            +
              /^ns[0-9-]*$/
         
     | 
| 
      
 73 
     | 
    
         
            +
              /^ntp[0-9-]*$/
         
     | 
| 
      
 74 
     | 
    
         
            +
              /^server[0-9-]*$/
         
     | 
| 
      
 75 
     | 
    
         
            +
              /^smtp[0-9-]*$/
         
     | 
| 
      
 76 
     | 
    
         
            +
              /^static[0-9-]*$/
         
     | 
| 
      
 77 
     | 
    
         
            +
              /^support[0-9-]*$/
         
     | 
| 
      
 78 
     | 
    
         
            +
              /^test[0-9-]*$/
         
     | 
| 
      
 79 
     | 
    
         
            +
              /^vpn[0-9-]*$/
         
     | 
| 
      
 80 
     | 
    
         
            +
              /^web[0-9-]*$/
         
     | 
| 
      
 81 
     | 
    
         
            +
              /^www[0-9-]*$/
         
     | 
| 
      
 82 
     | 
    
         
            +
              /^your.+$/
         
     | 
| 
      
 83 
     | 
    
         
            +
              /^[0-9-]+$/
         
     | 
| 
      
 84 
     | 
    
         
            +
              eu
         
     | 
| 
      
 85 
     | 
    
         
            +
              us
         
     | 
| 
      
 86 
     | 
    
         
            +
            ]
         
     | 
| 
      
 87 
     | 
    
         
            +
             
     | 
| 
      
 88 
     | 
    
         
            +
            subdomains = subdomains.flatten.map do |subdomain|
         
     | 
| 
      
 89 
     | 
    
         
            +
              next subdomain if subdomain.start_with?("/")
         
     | 
| 
      
 90 
     | 
    
         
            +
             
     | 
| 
      
 91 
     | 
    
         
            +
              subdomain.gsub(/[-_]/, "")
         
     | 
| 
      
 92 
     | 
    
         
            +
            end
         
     | 
| 
      
 93 
     | 
    
         
            +
             
     | 
| 
      
 94 
     | 
    
         
            +
            File.open("./data/reserved_subdomains.txt", "w") do |file|
         
     | 
| 
      
 95 
     | 
    
         
            +
              file << subdomains.flatten.uniq.sort.map(&:downcase).join("\n")
         
     | 
| 
      
 96 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -136,6 +136,7 @@ adult 
     | 
|
| 
       136 
136 
     | 
    
         
             
            adv
         
     | 
| 
       137 
137 
     | 
    
         
             
            advanceautoparts
         
     | 
| 
       138 
138 
     | 
    
         
             
            advertising
         
     | 
| 
      
 139 
     | 
    
         
            +
            advisories
         
     | 
| 
       139 
140 
     | 
    
         
             
            ae
         
     | 
| 
       140 
141 
     | 
    
         
             
            aecom
         
     | 
| 
       141 
142 
     | 
    
         
             
            aeg
         
     | 
| 
         @@ -144,7 +145,6 @@ aero 
     | 
|
| 
       144 
145 
     | 
    
         
             
            aes
         
     | 
| 
       145 
146 
     | 
    
         
             
            aetna
         
     | 
| 
       146 
147 
     | 
    
         
             
            af
         
     | 
| 
       147 
     | 
    
         
            -
            afamilycompany
         
     | 
| 
       148 
148 
     | 
    
         
             
            affiliate
         
     | 
| 
       149 
149 
     | 
    
         
             
            affiliates
         
     | 
| 
       150 
150 
     | 
    
         
             
            afginc
         
     | 
| 
         @@ -398,7 +398,6 @@ brother 
     | 
|
| 
       398 
398 
     | 
    
         
             
            brussels
         
     | 
| 
       399 
399 
     | 
    
         
             
            bs
         
     | 
| 
       400 
400 
     | 
    
         
             
            bt
         
     | 
| 
       401 
     | 
    
         
            -
            budapest
         
     | 
| 
       402 
401 
     | 
    
         
             
            bug
         
     | 
| 
       403 
402 
     | 
    
         
             
            bugatti
         
     | 
| 
       404 
403 
     | 
    
         
             
            bugs
         
     | 
| 
         @@ -451,7 +450,6 @@ cars 
     | 
|
| 
       451 
450 
     | 
    
         
             
            cart
         
     | 
| 
       452 
451 
     | 
    
         
             
            casa
         
     | 
| 
       453 
452 
     | 
    
         
             
            case
         
     | 
| 
       454 
     | 
    
         
            -
            caseih
         
     | 
| 
       455 
453 
     | 
    
         
             
            casestudies
         
     | 
| 
       456 
454 
     | 
    
         
             
            caseys
         
     | 
| 
       457 
455 
     | 
    
         
             
            cash
         
     | 
| 
         @@ -472,7 +470,6 @@ cc 
     | 
|
| 
       472 
470 
     | 
    
         
             
            cd
         
     | 
| 
       473 
471 
     | 
    
         
             
            cdn
         
     | 
| 
       474 
472 
     | 
    
         
             
            cdw
         
     | 
| 
       475 
     | 
    
         
            -
            ceb
         
     | 
| 
       476 
473 
     | 
    
         
             
            celanese
         
     | 
| 
       477 
474 
     | 
    
         
             
            celgene
         
     | 
| 
       478 
475 
     | 
    
         
             
            centene
         
     | 
| 
         @@ -743,7 +740,6 @@ drupal 
     | 
|
| 
       743 
740 
     | 
    
         
             
            dteenergy
         
     | 
| 
       744 
741 
     | 
    
         
             
            dtv
         
     | 
| 
       745 
742 
     | 
    
         
             
            dubai
         
     | 
| 
       746 
     | 
    
         
            -
            duck
         
     | 
| 
       747 
743 
     | 
    
         
             
            dukeenergy
         
     | 
| 
       748 
744 
     | 
    
         
             
            dunlop
         
     | 
| 
       749 
745 
     | 
    
         
             
            dupont
         
     | 
| 
         @@ -950,7 +946,6 @@ fs 
     | 
|
| 
       950 
946 
     | 
    
         
             
            ftp
         
     | 
| 
       951 
947 
     | 
    
         
             
            ftr
         
     | 
| 
       952 
948 
     | 
    
         
             
            fujitsu
         
     | 
| 
       953 
     | 
    
         
            -
            fujixerox
         
     | 
| 
       954 
949 
     | 
    
         
             
            fun
         
     | 
| 
       955 
950 
     | 
    
         
             
            fund
         
     | 
| 
       956 
951 
     | 
    
         
             
            furniture
         
     | 
| 
         @@ -1008,7 +1003,6 @@ github 
     | 
|
| 
       1008 
1003 
     | 
    
         
             
            gives
         
     | 
| 
       1009 
1004 
     | 
    
         
             
            giving
         
     | 
| 
       1010 
1005 
     | 
    
         
             
            gl
         
     | 
| 
       1011 
     | 
    
         
            -
            glade
         
     | 
| 
       1012 
1006 
     | 
    
         
             
            glass
         
     | 
| 
       1013 
1007 
     | 
    
         
             
            gle
         
     | 
| 
       1014 
1008 
     | 
    
         
             
            global
         
     | 
| 
         @@ -1230,7 +1224,6 @@ item 
     | 
|
| 
       1230 
1224 
     | 
    
         
             
            items
         
     | 
| 
       1231 
1225 
     | 
    
         
             
            itv
         
     | 
| 
       1232 
1226 
     | 
    
         
             
            itw
         
     | 
| 
       1233 
     | 
    
         
            -
            iveco
         
     | 
| 
       1234 
1227 
     | 
    
         
             
            j
         
     | 
| 
       1235 
1228 
     | 
    
         
             
            jabber
         
     | 
| 
       1236 
1229 
     | 
    
         
             
            jabil
         
     | 
| 
         @@ -1243,7 +1236,6 @@ javanese 
     | 
|
| 
       1243 
1236 
     | 
    
         
             
            javascript
         
     | 
| 
       1244 
1237 
     | 
    
         
             
            jbhunt
         
     | 
| 
       1245 
1238 
     | 
    
         
             
            jcb
         
     | 
| 
       1246 
     | 
    
         
            -
            jcp
         
     | 
| 
       1247 
1239 
     | 
    
         
             
            jcpenney
         
     | 
| 
       1248 
1240 
     | 
    
         
             
            je
         
     | 
| 
       1249 
1241 
     | 
    
         
             
            jeep
         
     | 
| 
         @@ -1292,6 +1284,7 @@ kg 
     | 
|
| 
       1292 
1284 
     | 
    
         
             
            kh
         
     | 
| 
       1293 
1285 
     | 
    
         
             
            ki
         
     | 
| 
       1294 
1286 
     | 
    
         
             
            kia
         
     | 
| 
      
 1287 
     | 
    
         
            +
            kids
         
     | 
| 
       1295 
1288 
     | 
    
         
             
            kiewit
         
     | 
| 
       1296 
1289 
     | 
    
         
             
            kim
         
     | 
| 
       1297 
1290 
     | 
    
         
             
            kimberlyclark
         
     | 
| 
         @@ -1397,7 +1390,6 @@ live 
     | 
|
| 
       1397 
1390 
     | 
    
         
             
            livejournal
         
     | 
| 
       1398 
1391 
     | 
    
         
             
            livenation
         
     | 
| 
       1399 
1392 
     | 
    
         
             
            living
         
     | 
| 
       1400 
     | 
    
         
            -
            lixil
         
     | 
| 
       1401 
1393 
     | 
    
         
             
            lj
         
     | 
| 
       1402 
1394 
     | 
    
         
             
            lk
         
     | 
| 
       1403 
1395 
     | 
    
         
             
            lkqcorp
         
     | 
| 
         @@ -1435,7 +1427,6 @@ ltd 
     | 
|
| 
       1435 
1427 
     | 
    
         
             
            ltda
         
     | 
| 
       1436 
1428 
     | 
    
         
             
            lu
         
     | 
| 
       1437 
1429 
     | 
    
         
             
            lundbeck
         
     | 
| 
       1438 
     | 
    
         
            -
            lupin
         
     | 
| 
       1439 
1430 
     | 
    
         
             
            luxe
         
     | 
| 
       1440 
1431 
     | 
    
         
             
            luxury
         
     | 
| 
       1441 
1432 
     | 
    
         
             
            lv
         
     | 
| 
         @@ -1631,7 +1622,6 @@ networkip 
     | 
|
| 
       1631 
1622 
     | 
    
         
             
            neustar
         
     | 
| 
       1632 
1623 
     | 
    
         
             
            new
         
     | 
| 
       1633 
1624 
     | 
    
         
             
            newellbrands
         
     | 
| 
       1634 
     | 
    
         
            -
            newholland
         
     | 
| 
       1635 
1625 
     | 
    
         
             
            newmont
         
     | 
| 
       1636 
1626 
     | 
    
         
             
            news
         
     | 
| 
       1637 
1627 
     | 
    
         
             
            newscorp
         
     | 
| 
         @@ -1709,7 +1699,6 @@ oauth 
     | 
|
| 
       1709 
1699 
     | 
    
         
             
            oauthclients
         
     | 
| 
       1710 
1700 
     | 
    
         
             
            obi
         
     | 
| 
       1711 
1701 
     | 
    
         
             
            observer
         
     | 
| 
       1712 
     | 
    
         
            -
            off
         
     | 
| 
       1713 
1702 
     | 
    
         
             
            offer
         
     | 
| 
       1714 
1703 
     | 
    
         
             
            offers
         
     | 
| 
       1715 
1704 
     | 
    
         
             
            office
         
     | 
| 
         @@ -1732,7 +1721,6 @@ oneok 
     | 
|
| 
       1732 
1721 
     | 
    
         
             
            ong
         
     | 
| 
       1733 
1722 
     | 
    
         
             
            onl
         
     | 
| 
       1734 
1723 
     | 
    
         
             
            online
         
     | 
| 
       1735 
     | 
    
         
            -
            onyourside
         
     | 
| 
       1736 
1724 
     | 
    
         
             
            ooo
         
     | 
| 
       1737 
1725 
     | 
    
         
             
            open
         
     | 
| 
       1738 
1726 
     | 
    
         
             
            openid
         
     | 
| 
         @@ -1924,11 +1912,9 @@ query 
     | 
|
| 
       1924 
1912 
     | 
    
         
             
            quest
         
     | 
| 
       1925 
1913 
     | 
    
         
             
            questdiagnostics
         
     | 
| 
       1926 
1914 
     | 
    
         
             
            quintiles
         
     | 
| 
       1927 
     | 
    
         
            -
            qvc
         
     | 
| 
       1928 
1915 
     | 
    
         
             
            r
         
     | 
| 
       1929 
1916 
     | 
    
         
             
            racing
         
     | 
| 
       1930 
1917 
     | 
    
         
             
            radio
         
     | 
| 
       1931 
     | 
    
         
            -
            raid
         
     | 
| 
       1932 
1918 
     | 
    
         
             
            ralphlauren
         
     | 
| 
       1933 
1919 
     | 
    
         
             
            random
         
     | 
| 
       1934 
1920 
     | 
    
         
             
            ranking
         
     | 
| 
         @@ -1999,7 +1985,6 @@ ril 
     | 
|
| 
       1999 
1985 
     | 
    
         
             
            rio
         
     | 
| 
       2000 
1986 
     | 
    
         
             
            rip
         
     | 
| 
       2001 
1987 
     | 
    
         
             
            riteaid
         
     | 
| 
       2002 
     | 
    
         
            -
            rmit
         
     | 
| 
       2003 
1988 
     | 
    
         
             
            ro
         
     | 
| 
       2004 
1989 
     | 
    
         
             
            rocher
         
     | 
| 
       2005 
1990 
     | 
    
         
             
            rocks
         
     | 
| 
         @@ -2071,7 +2056,6 @@ schools 
     | 
|
| 
       2071 
2056 
     | 
    
         
             
            schule
         
     | 
| 
       2072 
2057 
     | 
    
         
             
            schwarz
         
     | 
| 
       2073 
2058 
     | 
    
         
             
            science
         
     | 
| 
       2074 
     | 
    
         
            -
            scjohnson
         
     | 
| 
       2075 
2059 
     | 
    
         
             
            scot
         
     | 
| 
       2076 
2060 
     | 
    
         
             
            script
         
     | 
| 
       2077 
2061 
     | 
    
         
             
            scripts
         
     | 
| 
         @@ -2128,7 +2112,6 @@ shopping 
     | 
|
| 
       2128 
2112 
     | 
    
         
             
            shouji
         
     | 
| 
       2129 
2113 
     | 
    
         
             
            show
         
     | 
| 
       2130 
2114 
     | 
    
         
             
            showtime
         
     | 
| 
       2131 
     | 
    
         
            -
            shriram
         
     | 
| 
       2132 
2115 
     | 
    
         
             
            si
         
     | 
| 
       2133 
2116 
     | 
    
         
             
            signin
         
     | 
| 
       2134 
2117 
     | 
    
         
             
            signout
         
     | 
| 
         @@ -2176,6 +2159,7 @@ southerncompany 
     | 
|
| 
       2176 
2159 
     | 
    
         
             
            southwest
         
     | 
| 
       2177 
2160 
     | 
    
         
             
            soy
         
     | 
| 
       2178 
2161 
     | 
    
         
             
            sp
         
     | 
| 
      
 2162 
     | 
    
         
            +
            spa
         
     | 
| 
       2179 
2163 
     | 
    
         
             
            space
         
     | 
| 
       2180 
2164 
     | 
    
         
             
            spam
         
     | 
| 
       2181 
2165 
     | 
    
         
             
            spanish
         
     | 
| 
         @@ -2189,7 +2173,6 @@ spiritaero 
     | 
|
| 
       2189 
2173 
     | 
    
         
             
            sport
         
     | 
| 
       2190 
2174 
     | 
    
         
             
            sports
         
     | 
| 
       2191 
2175 
     | 
    
         
             
            spot
         
     | 
| 
       2192 
     | 
    
         
            -
            spreadbetting
         
     | 
| 
       2193 
2176 
     | 
    
         
             
            sql
         
     | 
| 
       2194 
2177 
     | 
    
         
             
            sr
         
     | 
| 
       2195 
2178 
     | 
    
         
             
            src
         
     | 
| 
         @@ -2262,7 +2245,6 @@ suzuki 
     | 
|
| 
       2262 
2245 
     | 
    
         
             
            sv
         
     | 
| 
       2263 
2246 
     | 
    
         
             
            svn
         
     | 
| 
       2264 
2247 
     | 
    
         
             
            swatch
         
     | 
| 
       2265 
     | 
    
         
            -
            swiftcover
         
     | 
| 
       2266 
2248 
     | 
    
         
             
            swiss
         
     | 
| 
       2267 
2249 
     | 
    
         
             
            sx
         
     | 
| 
       2268 
2250 
     | 
    
         
             
            sy
         
     | 
| 
         @@ -2646,12 +2628,12 @@ xn3bst00m 
     | 
|
| 
       2646 
2628 
     | 
    
         
             
            xn3ds443g
         
     | 
| 
       2647 
2629 
     | 
    
         
             
            xn3e0b707e
         
     | 
| 
       2648 
2630 
     | 
    
         
             
            xn3hcrj9c
         
     | 
| 
       2649 
     | 
    
         
            -
            xn3oq18vl8pn36a
         
     | 
| 
       2650 
2631 
     | 
    
         
             
            xn3pxu8k
         
     | 
| 
       2651 
2632 
     | 
    
         
             
            xn42c2d9a
         
     | 
| 
       2652 
2633 
     | 
    
         
             
            xn45br5cyl
         
     | 
| 
       2653 
2634 
     | 
    
         
             
            xn45brj9c
         
     | 
| 
       2654 
2635 
     | 
    
         
             
            xn45q11c
         
     | 
| 
      
 2636 
     | 
    
         
            +
            xn4dbrk0ce
         
     | 
| 
       2655 
2637 
     | 
    
         
             
            xn4gbrim
         
     | 
| 
       2656 
2638 
     | 
    
         
             
            xn54b7fta0cc
         
     | 
| 
       2657 
2639 
     | 
    
         
             
            xn55qw42g
         
     | 
| 
         @@ -0,0 +1,18 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module Validators
         
     | 
| 
      
 4 
     | 
    
         
            +
              class DisposableDomains
         
     | 
| 
      
 5 
     | 
    
         
            +
                def self.all
         
     | 
| 
      
 6 
     | 
    
         
            +
                  @all ||=
         
     | 
| 
      
 7 
     | 
    
         
            +
                    begin
         
     | 
| 
      
 8 
     | 
    
         
            +
                      Validators.require_dependency! "root_domain"
         
     | 
| 
      
 9 
     | 
    
         
            +
                      Validators.require_dependency! "email_data"
         
     | 
| 
      
 10 
     | 
    
         
            +
                      EmailData.disposable_domains
         
     | 
| 
      
 11 
     | 
    
         
            +
                    end
         
     | 
| 
      
 12 
     | 
    
         
            +
                end
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                def self.include?(domain)
         
     | 
| 
      
 15 
     | 
    
         
            +
                  all.include?(domain)
         
     | 
| 
      
 16 
     | 
    
         
            +
                end
         
     | 
| 
      
 17 
     | 
    
         
            +
              end
         
     | 
| 
      
 18 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -2,15 +2,18 @@ 
     | 
|
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            module Validators
         
     | 
| 
       4 
4 
     | 
    
         
             
              class DisposableEmails
         
     | 
| 
       5 
     | 
    
         
            -
                FILE_PATH = File.expand_path("../../data/disposable_emails.txt", __dir__)
         
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
5 
     | 
    
         
             
                def self.all
         
     | 
| 
       8 
     | 
    
         
            -
                  @all ||= 
     | 
| 
      
 6 
     | 
    
         
            +
                  @all ||=
         
     | 
| 
      
 7 
     | 
    
         
            +
                    begin
         
     | 
| 
      
 8 
     | 
    
         
            +
                      Validators.require_dependency! "root_domain"
         
     | 
| 
      
 9 
     | 
    
         
            +
                      Validators.require_dependency! "email_data"
         
     | 
| 
      
 10 
     | 
    
         
            +
                      EmailData.disposable_emails
         
     | 
| 
      
 11 
     | 
    
         
            +
                    end
         
     | 
| 
       9 
12 
     | 
    
         
             
                end
         
     | 
| 
       10 
13 
     | 
    
         | 
| 
       11 
14 
     | 
    
         
             
                def self.include?(email)
         
     | 
| 
       12 
15 
     | 
    
         
             
                  mailbox, domain = email.to_s.split("@")
         
     | 
| 
       13 
     | 
    
         
            -
                  mailbox = mailbox.to_s. 
     | 
| 
      
 16 
     | 
    
         
            +
                  mailbox = mailbox.to_s.delete(".")
         
     | 
| 
       14 
17 
     | 
    
         
             
                  mailbox = mailbox.gsub(/\+(.+)?\Z/, "")
         
     | 
| 
       15 
18 
     | 
    
         | 
| 
       16 
19 
     | 
    
         
             
                  all.include?("#{mailbox}@#{domain}")
         
     | 
    
        data/lib/validators/ip.rb
    CHANGED
    
    | 
         @@ -11,13 +11,13 @@ module Validators 
     | 
|
| 
       11 
11 
     | 
    
         
             
                # Extracted from Ruby 1.8.7
         
     | 
| 
       12 
12 
     | 
    
         
             
                def v6?(addr)
         
     | 
| 
       13 
13 
     | 
    
         
             
                  # IPv6 (normal)
         
     | 
| 
       14 
     | 
    
         
            -
                  return true if /\A[\da-f]{1,4}(:[\da-f]{1,4})*\Z/i 
     | 
| 
       15 
     | 
    
         
            -
                  return true if /\A[\da-f]{1,4}(:[\da-f]{1,4})*::([\da-f]{1,4}(:[\da-f]{1,4})*)?\Z/i 
     | 
| 
       16 
     | 
    
         
            -
                  return true if /\A::([\da-f]{1,4}(:[\da-f]{1,4})*)?\Z/i 
     | 
| 
      
 14 
     | 
    
         
            +
                  return true if /\A[\da-f]{1,4}(:[\da-f]{1,4})*\Z/i.match?(addr)
         
     | 
| 
      
 15 
     | 
    
         
            +
                  return true if /\A[\da-f]{1,4}(:[\da-f]{1,4})*::([\da-f]{1,4}(:[\da-f]{1,4})*)?\Z/i.match?(addr)
         
     | 
| 
      
 16 
     | 
    
         
            +
                  return true if /\A::([\da-f]{1,4}(:[\da-f]{1,4})*)?\Z/i.match?(addr)
         
     | 
| 
       17 
17 
     | 
    
         
             
                  # IPv6 (IPv4 compat)
         
     | 
| 
       18 
     | 
    
         
            -
                  return true if /\A[\da-f]{1,4}(:[\da-f]{1,4})*:/i =~ addr && v4?( 
     | 
| 
       19 
     | 
    
         
            -
                  return true if /\A[\da-f]{1,4}(:[\da-f]{1,4})*::([\da-f]{1,4}(:[\da-f]{1,4})*:)?/i =~ addr && v4?( 
     | 
| 
       20 
     | 
    
         
            -
                  return true if /\A::([\da-f]{1,4}(:[\da-f]{1,4})*:)?/i =~ addr && v4?( 
     | 
| 
      
 18 
     | 
    
         
            +
                  return true if /\A[\da-f]{1,4}(:[\da-f]{1,4})*:/i =~ addr && v4?(Regexp.last_match.post_match)
         
     | 
| 
      
 19 
     | 
    
         
            +
                  return true if /\A[\da-f]{1,4}(:[\da-f]{1,4})*::([\da-f]{1,4}(:[\da-f]{1,4})*:)?/i =~ addr && v4?(Regexp.last_match.post_match)
         
     | 
| 
      
 20 
     | 
    
         
            +
                  return true if /\A::([\da-f]{1,4}(:[\da-f]{1,4})*:)?/i =~ addr && v4?(Regexp.last_match.post_match)
         
     | 
| 
       21 
21 
     | 
    
         | 
| 
       22 
22 
     | 
    
         
             
                  false
         
     | 
| 
       23 
23 
     | 
    
         
             
                end
         
     | 
| 
         @@ -3,8 +3,8 @@ en: 
     | 
|
| 
       3 
3 
     | 
    
         
             
              activemodel: &activemodel
         
     | 
| 
       4 
4 
     | 
    
         
             
                errors:
         
     | 
| 
       5 
5 
     | 
    
         
             
                  messages:
         
     | 
| 
       6 
     | 
    
         
            -
                    disposable_email: "is not allowed (high-bounce email)"
         
     | 
| 
       7 
6 
     | 
    
         
             
                    disposable_domain: "is not allowed (high-bounce domain)"
         
     | 
| 
      
 7 
     | 
    
         
            +
                    disposable_email: "is not allowed (high-bounce email)"
         
     | 
| 
       8 
8 
     | 
    
         
             
                    invalid_cnpj: "is not a valid CNPJ"
         
     | 
| 
       9 
9 
     | 
    
         
             
                    invalid_cpf: "is not a valid CPF"
         
     | 
| 
       10 
10 
     | 
    
         
             
                    invalid_date: "is not a valid date"
         
     | 
| 
         @@ -17,14 +17,15 @@ en: 
     | 
|
| 
       17 
17 
     | 
    
         
             
                    invalid_ipv6_address: "is not a valid IPv6 address"
         
     | 
| 
       18 
18 
     | 
    
         
             
                    invalid_owner: "is not associated with your user"
         
     | 
| 
       19 
19 
     | 
    
         
             
                    invalid_ssh_private_key: "is not a valid private SSH key"
         
     | 
| 
       20 
     | 
    
         
            -
                    invalid_ssh_private_key_bits: 
     | 
| 
      
 20 
     | 
    
         
            +
                    invalid_ssh_private_key_bits:
         
     | 
| 
      
 21 
     | 
    
         
            +
                      "needs to be at least %{required} bits; got %{value} bits instead"
         
     | 
| 
       21 
22 
     | 
    
         
             
                    invalid_ssh_private_key_type: "must be a %{value} key"
         
     | 
| 
       22 
23 
     | 
    
         
             
                    invalid_ssh_public_key: "is not a valid public SSH key"
         
     | 
| 
      
 24 
     | 
    
         
            +
                    invalid_subdomain: "is invalid"
         
     | 
| 
       23 
25 
     | 
    
         
             
                    invalid_url: "is not a valid address"
         
     | 
| 
      
 26 
     | 
    
         
            +
                    invalid_username: "is invalid"
         
     | 
| 
       24 
27 
     | 
    
         
             
                    reserved_subdomain: "%{value} is a reserved subdomain"
         
     | 
| 
       25 
     | 
    
         
            -
                    invalid_subdomain: "is invalid"
         
     | 
| 
       26 
28 
     | 
    
         
             
                    reserved_username: "%{value} is a reserved username"
         
     | 
| 
       27 
     | 
    
         
            -
                    invalid_username: "is invalid"
         
     | 
| 
       28 
29 
     | 
    
         | 
| 
       29 
30 
     | 
    
         
             
              activerecord:
         
     | 
| 
       30 
31 
     | 
    
         
             
                <<: *activemodel
         
     | 
| 
         @@ -3,8 +3,8 @@ pt-BR: 
     | 
|
| 
       3 
3 
     | 
    
         
             
              activemodel: &activemodel
         
     | 
| 
       4 
4 
     | 
    
         
             
                errors:
         
     | 
| 
       5 
5 
     | 
    
         
             
                  messages:
         
     | 
| 
       6 
     | 
    
         
            -
                    disposable_email: "não é permitido (e-mail temporário)"
         
     | 
| 
       7 
6 
     | 
    
         
             
                    disposable_domain: "não é permitido (e-mail temporário)"
         
     | 
| 
      
 7 
     | 
    
         
            +
                    disposable_email: "não é permitido (e-mail temporário)"
         
     | 
| 
       8 
8 
     | 
    
         
             
                    invalid_cnpj: "não é um CNPJ válido"
         
     | 
| 
       9 
9 
     | 
    
         
             
                    invalid_cpf: "não é um CPF válido"
         
     | 
| 
       10 
10 
     | 
    
         
             
                    invalid_date: "não é uma data válida"
         
     | 
| 
         @@ -17,11 +17,15 @@ pt-BR: 
     | 
|
| 
       17 
17 
     | 
    
         
             
                    invalid_ipv6_address: "não é um endereço IPv6 válido"
         
     | 
| 
       18 
18 
     | 
    
         
             
                    invalid_owner: "não está associado ao seu usuário"
         
     | 
| 
       19 
19 
     | 
    
         
             
                    invalid_ssh_private_key: "não é uma chave privada de SSH válida"
         
     | 
| 
       20 
     | 
    
         
            -
                    invalid_ssh_private_key_bits: 
     | 
| 
      
 20 
     | 
    
         
            +
                    invalid_ssh_private_key_bits:
         
     | 
| 
      
 21 
     | 
    
         
            +
                      "precisa ter pelo menos %{required} bits; a sua chave tem %{value}
         
     | 
| 
      
 22 
     | 
    
         
            +
                      bits"
         
     | 
| 
       21 
23 
     | 
    
         
             
                    invalid_ssh_private_key_type: "precisa ser uma chave %{value}"
         
     | 
| 
       22 
24 
     | 
    
         
             
                    invalid_ssh_public_key: "não é uma chave pública de SSH válida"
         
     | 
| 
      
 25 
     | 
    
         
            +
                    invalid_subdomain: "é inválido"
         
     | 
| 
       23 
26 
     | 
    
         
             
                    invalid_url: "não parece ser uma URL válida"
         
     | 
| 
       24 
     | 
    
         
            -
                     
     | 
| 
      
 27 
     | 
    
         
            +
                    invalid_username: "não é válido"
         
     | 
| 
      
 28 
     | 
    
         
            +
                    reserved_subdomain: "%{value} é um subdomínio reservado"
         
     | 
| 
       25 
29 
     | 
    
         
             
                    reserved_username: "%{value} é nome de usuário reservado"
         
     | 
| 
       26 
30 
     | 
    
         | 
| 
       27 
31 
     | 
    
         
             
              activerecord:
         
     | 
    
        data/lib/validators/tld.rb
    CHANGED
    
    | 
         @@ -2,10 +2,12 @@ 
     | 
|
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            module Validators
         
     | 
| 
       4 
4 
     | 
    
         
             
              class TLD
         
     | 
| 
       5 
     | 
    
         
            -
                FILE_PATH = File.expand_path("../../data/tld.txt", __dir__)
         
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
5 
     | 
    
         
             
                def self.all
         
     | 
| 
       8 
     | 
    
         
            -
                  @all ||= 
     | 
| 
      
 6 
     | 
    
         
            +
                  @all ||=
         
     | 
| 
      
 7 
     | 
    
         
            +
                    begin
         
     | 
| 
      
 8 
     | 
    
         
            +
                      Validators.require_dependency! "email_data"
         
     | 
| 
      
 9 
     | 
    
         
            +
                      EmailData.tlds
         
     | 
| 
      
 10 
     | 
    
         
            +
                    end
         
     | 
| 
       9 
11 
     | 
    
         
             
                end
         
     | 
| 
       10 
12 
     | 
    
         | 
| 
       11 
13 
     | 
    
         
             
                def self.host_with_valid_tld?(host)
         
     | 
| 
         @@ -13,10 +15,10 @@ module Validators 
     | 
|
| 
       13 
15 
     | 
    
         | 
| 
       14 
16 
     | 
    
         
             
                  return false if host.split(".").size == 1
         
     | 
| 
       15 
17 
     | 
    
         | 
| 
       16 
     | 
    
         
            -
                   
     | 
| 
      
 18 
     | 
    
         
            +
                  include?(host[/\.([^.]+)$/, 1].to_s.downcase)
         
     | 
| 
       17 
19 
     | 
    
         
             
                end
         
     | 
| 
       18 
20 
     | 
    
         | 
| 
       19 
     | 
    
         
            -
                def self. 
     | 
| 
      
 21 
     | 
    
         
            +
                def self.include?(tld)
         
     | 
| 
       20 
22 
     | 
    
         
             
                  all.include?(tld)
         
     | 
| 
       21 
23 
     | 
    
         
             
                end
         
     | 
| 
       22 
24 
     | 
    
         
             
              end
         
     | 
| 
         @@ -25,10 +25,9 @@ module ActiveModel 
     | 
|
| 
       25 
25 
     | 
    
         
             
                  #   end
         
     | 
| 
       26 
26 
     | 
    
         
             
                  #
         
     | 
| 
       27 
27 
     | 
    
         
             
                  def validates_cnpj_format_of(*attr_names)
         
     | 
| 
      
 28 
     | 
    
         
            +
                    Validators.require_dependency! "cpf_cnpj"
         
     | 
| 
       28 
29 
     | 
    
         
             
                    require "cnpj"
         
     | 
| 
       29 
30 
     | 
    
         
             
                    validates_with CnpjValidator, _merge_attributes(attr_names)
         
     | 
| 
       30 
     | 
    
         
            -
                  rescue LoadError
         
     | 
| 
       31 
     | 
    
         
            -
                    raise "cpf_cnpj is not part of the bundle. Add it to Gemfile."
         
     | 
| 
       32 
31 
     | 
    
         
             
                  end
         
     | 
| 
       33 
32 
     | 
    
         | 
| 
       34 
33 
     | 
    
         
             
                  alias_method :validates_cnpj, :validates_cnpj_format_of
         
     | 
| 
         @@ -25,10 +25,9 @@ module ActiveModel 
     | 
|
| 
       25 
25 
     | 
    
         
             
                  #   end
         
     | 
| 
       26 
26 
     | 
    
         
             
                  #
         
     | 
| 
       27 
27 
     | 
    
         
             
                  def validates_cpf_format_of(*attr_names)
         
     | 
| 
      
 28 
     | 
    
         
            +
                    Validators.require_dependency! "cpf_cnpj"
         
     | 
| 
       28 
29 
     | 
    
         
             
                    require "cpf"
         
     | 
| 
       29 
30 
     | 
    
         
             
                    validates_with CpfValidator, _merge_attributes(attr_names)
         
     | 
| 
       30 
     | 
    
         
            -
                  rescue LoadError
         
     | 
| 
       31 
     | 
    
         
            -
                    raise "cpf_cnpj is not part of the bundle. Add it to Gemfile."
         
     | 
| 
       32 
31 
     | 
    
         
             
                  end
         
     | 
| 
       33 
32 
     | 
    
         | 
| 
       34 
33 
     | 
    
         
             
                  alias_method :validates_cpf, :validates_cpf_format_of
         
     | 
| 
         @@ -1,7 +1,5 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # frozen_string_literal: true
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
            require "root_domain"
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
3 
     | 
    
         
             
            module ActiveModel
         
     | 
| 
       6 
4 
     | 
    
         
             
              module Validations
         
     | 
| 
       7 
5 
     | 
    
         
             
                class EmailValidator < EachValidator
         
     | 
| 
         @@ -21,8 +19,8 @@ module ActiveModel 
     | 
|
| 
       21 
19 
     | 
    
         
             
                  end
         
     | 
| 
       22 
20 
     | 
    
         | 
| 
       23 
21 
     | 
    
         
             
                  def validate_email_format(record, attribute, value, options)
         
     | 
| 
       24 
     | 
    
         
            -
                    return if value.to_s 
     | 
| 
       25 
     | 
    
         
            -
                    return if value.to_s 
     | 
| 
      
 22 
     | 
    
         
            +
                    return if Validators::EMAIL_FORMAT.match?(value.to_s)
         
     | 
| 
      
 23 
     | 
    
         
            +
                    return if Validators::MICROSOFT_EMAIL_FORMAT.match?(value.to_s)
         
     | 
| 
       26 
24 
     | 
    
         | 
| 
       27 
25 
     | 
    
         
             
                    record.errors.add(
         
     | 
| 
       28 
26 
     | 
    
         
             
                      attribute,
         
     | 
| 
         @@ -50,7 +48,7 @@ module ActiveModel 
     | 
|
| 
       50 
48 
     | 
    
         
             
                    hostname = value.to_s.split(AT_SIGN).last.to_s.downcase
         
     | 
| 
       51 
49 
     | 
    
         
             
                    root_domain = RootDomain.call(hostname)
         
     | 
| 
       52 
50 
     | 
    
         | 
| 
       53 
     | 
    
         
            -
                    return unless Validators:: 
     | 
| 
      
 51 
     | 
    
         
            +
                    return unless Validators::DisposableDomains.include?(root_domain)
         
     | 
| 
       54 
52 
     | 
    
         | 
| 
       55 
53 
     | 
    
         
             
                    record.errors.add(
         
     | 
| 
       56 
54 
     | 
    
         
             
                      attribute,
         
     | 
| 
         @@ -79,6 +77,8 @@ module ActiveModel 
     | 
|
| 
       79 
77 
     | 
    
         
             
                  #   end
         
     | 
| 
       80 
78 
     | 
    
         
             
                  #
         
     | 
| 
       81 
79 
     | 
    
         
             
                  def validates_email_format_of(*attr_names)
         
     | 
| 
      
 80 
     | 
    
         
            +
                    Validators.require_dependency! "root_domain"
         
     | 
| 
      
 81 
     | 
    
         
            +
                    Validators.require_dependency! "email_data"
         
     | 
| 
       82 
82 
     | 
    
         
             
                    validates_with EmailValidator, _merge_attributes(attr_names)
         
     | 
| 
       83 
83 
     | 
    
         
             
                  end
         
     | 
| 
       84 
84 
     | 
    
         | 
| 
         @@ -56,10 +56,8 @@ module ActiveModel 
     | 
|
| 
       56 
56 
     | 
    
         
             
                  #   end
         
     | 
| 
       57 
57 
     | 
    
         
             
                  #
         
     | 
| 
       58 
58 
     | 
    
         
             
                  def validates_ssh_private_key(*attr_names)
         
     | 
| 
       59 
     | 
    
         
            -
                     
     | 
| 
      
 59 
     | 
    
         
            +
                    Validators.require_dependency! "sshkey"
         
     | 
| 
       60 
60 
     | 
    
         
             
                    validates_with SshPrivateKeyValidator, _merge_attributes(attr_names)
         
     | 
| 
       61 
     | 
    
         
            -
                  rescue LoadError
         
     | 
| 
       62 
     | 
    
         
            -
                    raise "sshkey is not part of the bundle. Add it to Gemfile."
         
     | 
| 
       63 
61 
     | 
    
         
             
                  end
         
     | 
| 
       64 
62 
     | 
    
         
             
                end
         
     | 
| 
       65 
63 
     | 
    
         
             
              end
         
     |