rbCaptcha 0.3.3 → 0.3.4
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/lib/rbCaptcha/version.rb +1 -1
 - data/lib/rbCaptcha.rb +22 -19
 - metadata +1 -1
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: e3fa778826608d92cba6bb315d1acc51cb62e58c0954d09f931b9009a5f083d3
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: f11c77d1d10c735811e7416f0c5126b55f3b4461f377a86d1e663d9c9c163768
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 33277b4f10e63ce21e362ce8efc13d6e624fff2c63488159f1ed05388779f02c83891098f2687e8824d9ea5f79672490b1eddd3a07b1f90681aa91175e4b7557
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 4b06eee307b23703154b0234e1eeceb1e88b0a672c0da66a7e28a7e5a730c7f4b2d5de0b370d77690e69738bf11ddd5f5190ae1009ed9ddd2256ad8948c6142a
         
     | 
    
        data/lib/rbCaptcha/version.rb
    CHANGED
    
    
    
        data/lib/rbCaptcha.rb
    CHANGED
    
    | 
         @@ -1,37 +1,40 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # frozen_string_literal: true
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            require_relative "rbCaptcha/version"
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            class << self
         
     | 
| 
      
 6 
     | 
    
         
            +
                    attr_accessor :words, :cwords, :truew, :mw0, :mw, :data
         
     | 
| 
      
 7 
     | 
    
         
            +
                    
         
     | 
| 
      
 8 
     | 
    
         
            +
                    def crun(data)
         
     | 
| 
       6 
9 
     | 
    
         | 
| 
       7 
10 
     | 
    
         
             
                    words = [
         
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
                    cword = words.sample
         
     | 
| 
      
 11 
     | 
    
         
            +
                            '29183!с92-3822a29!``~39t', # => cat
         
     | 
| 
      
 12 
     | 
    
         
            +
                            '38134@3#2d392o1911!!(@)O!!!#g', # => dog
         
     | 
| 
      
 13 
     | 
    
         
            +
                            '3928937h392!@(o)303m39---e'    # => home
         
     | 
| 
      
 14 
     | 
    
         
            +
                            ]
         
     | 
| 
       14 
15 
     | 
    
         | 
| 
      
 16 
     | 
    
         
            +
                    cword = words.sample
         
     | 
| 
      
 17 
     | 
    
         
            +
                    
         
     | 
| 
       15 
18 
     | 
    
         
             
                    if cword == words[0]
         
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
      
 19 
     | 
    
         
            +
                            truew = 'cat'
         
     | 
| 
       17 
20 
     | 
    
         
             
                    elsif cword == words[1]
         
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
      
 21 
     | 
    
         
            +
                            truew = 'dog'
         
     | 
| 
       19 
22 
     | 
    
         
             
                    elsif cword == words[2]
         
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
      
 23 
     | 
    
         
            +
                            truew = 'home'
         
     | 
| 
       21 
24 
     | 
    
         
             
                    end
         
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
                    puts "Please, to continue, write a word that is written in lowercase letters.\n    #{cword}"
         
     | 
| 
       24 
25 
     | 
    
         | 
| 
      
 26 
     | 
    
         
            +
                    puts "Please, to continue, write a word that is written in lowercase letters.\n    #{cword}"
         
     | 
| 
      
 27 
     | 
    
         
            +
                    
         
     | 
| 
       25 
28 
     | 
    
         
             
                    mw0 = gets.chomp 
         
     | 
| 
       26 
29 
     | 
    
         
             
                    mw = mw0.downcase
         
     | 
| 
       27 
30 
     | 
    
         
             
                    if mw == truew
         
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
      
 31 
     | 
    
         
            +
                            puts "You have passed the captcha sir."
         
     | 
| 
      
 32 
     | 
    
         
            +
                            return true
         
     | 
| 
       30 
33 
     | 
    
         
             
                    else
         
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
      
 34 
     | 
    
         
            +
                            puts "You didn't pass the captcha, try again."
         
     | 
| 
      
 35 
     | 
    
         
            +
                            return false
         
     | 
| 
       33 
36 
     | 
    
         
             
                    end
         
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
       35 
     | 
    
         
            -
                    sleep( 
     | 
| 
      
 37 
     | 
    
         
            +
                        
         
     | 
| 
      
 38 
     | 
    
         
            +
                    sleep(data)
         
     | 
| 
       36 
39 
     | 
    
         
             
                end
         
     | 
| 
       37 
40 
     | 
    
         
             
            end
         
     |