cyclid-client 0.3.2 → 0.3.3
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/cyclid/client/user.rb +20 -6
 - data/lib/cyclid/version.rb +1 -1
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: eb286d1fdb3a5a900ad24f35c41fff997b9403eb
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: d62a803b0a9597605906bedc394a1277d9e9bf45
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 8f5a28f869c93715ff81ff3e25da32bf088f9a2ca417a78708a9845aa6ab7312a8decafd3dd8e688888bc1a2ed70e99f0b3e66b909172843dc626614489f3916
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 614077b06d871c421644adc3ccd0ad10af187521a6afb6a35bfcfe84d697fe46183750d1f4490b7f9568266a4e2176b5c0f79c86b57fa9aa648c178a10e9d1cb
         
     | 
    
        data/lib/cyclid/client/user.rb
    CHANGED
    
    | 
         @@ -49,7 +49,8 @@ module Cyclid 
     | 
|
| 
       49 
49 
     | 
    
         
             
                  # @param username [String] User name of the new user.
         
     | 
| 
       50 
50 
     | 
    
         
             
                  # @param name [String] Users real name.
         
     | 
| 
       51 
51 
     | 
    
         
             
                  # @param email [String] Users email address.
         
     | 
| 
       52 
     | 
    
         
            -
                  # @param password [String] Unencrypted initial password
         
     | 
| 
      
 52 
     | 
    
         
            +
                  # @param password [String] Unencrypted initial password OR a BCrypt2
         
     | 
| 
      
 53 
     | 
    
         
            +
                  #   encrypted password string.
         
     | 
| 
       53 
54 
     | 
    
         
             
                  # @param secret [String] Initial HMAC signing secret
         
     | 
| 
       54 
55 
     | 
    
         
             
                  # @return [Hash] Decoded server response object.
         
     | 
| 
       55 
56 
     | 
    
         
             
                  # @see #user_modify
         
     | 
| 
         @@ -64,8 +65,14 @@ module Cyclid 
     | 
|
| 
       64 
65 
     | 
    
         
             
                    # Add the HMAC secret if one was supplied
         
     | 
| 
       65 
66 
     | 
    
         
             
                    user['secret'] = secret unless secret.nil?
         
     | 
| 
       66 
67 
     | 
    
         | 
| 
       67 
     | 
    
         
            -
                    #  
     | 
| 
       68 
     | 
    
         
            -
                    user['password'] =  
     | 
| 
      
 68 
     | 
    
         
            +
                    # Add the password if one was supplied
         
     | 
| 
      
 69 
     | 
    
         
            +
                    user['password'] = if password =~ /\A\$2a\$.+\z/
         
     | 
| 
      
 70 
     | 
    
         
            +
                                         # Password is already encrypted
         
     | 
| 
      
 71 
     | 
    
         
            +
                                         password
         
     | 
| 
      
 72 
     | 
    
         
            +
                                       else
         
     | 
| 
      
 73 
     | 
    
         
            +
                                         # Encrypt the plaintext password
         
     | 
| 
      
 74 
     | 
    
         
            +
                                         BCrypt::Password.create(password).to_s
         
     | 
| 
      
 75 
     | 
    
         
            +
                                       end unless password.nil?
         
     | 
| 
       69 
76 
     | 
    
         | 
| 
       70 
77 
     | 
    
         
             
                    @logger.debug user
         
     | 
| 
       71 
78 
     | 
    
         | 
| 
         @@ -84,6 +91,8 @@ module Cyclid 
     | 
|
| 
       84 
91 
     | 
    
         
             
                  # @option args [String] email Users email address.
         
     | 
| 
       85 
92 
     | 
    
         
             
                  # @option args [String] secret Initial HMAC signing secret
         
     | 
| 
       86 
93 
     | 
    
         
             
                  # @option args [String] password Unencrypted initial password
         
     | 
| 
      
 94 
     | 
    
         
            +
                  # @option args [String] password Unencrypted initial password OR a
         
     | 
| 
      
 95 
     | 
    
         
            +
                  #   BCrypt2 encrypted password string.
         
     | 
| 
       87 
96 
     | 
    
         
             
                  # @return [Hash] Decoded server response object.
         
     | 
| 
       88 
97 
     | 
    
         
             
                  # @see #user_add
         
     | 
| 
       89 
98 
     | 
    
         
             
                  # @see #user_delete
         
     | 
| 
         @@ -104,9 +113,14 @@ module Cyclid 
     | 
|
| 
       104 
113 
     | 
    
         
             
                    # Add the HMAC secret if one was supplied
         
     | 
| 
       105 
114 
     | 
    
         
             
                    user['secret'] = args[:secret] if args.key? :secret and args[:secret]
         
     | 
| 
       106 
115 
     | 
    
         | 
| 
       107 
     | 
    
         
            -
                    #  
     | 
| 
       108 
     | 
    
         
            -
                    user['password'] =  
     | 
| 
       109 
     | 
    
         
            -
             
     | 
| 
      
 116 
     | 
    
         
            +
                    # Add the password if one was supplied
         
     | 
| 
      
 117 
     | 
    
         
            +
                    user['password'] = if args[:password] =~ /\A\$2a\$.+\z/
         
     | 
| 
      
 118 
     | 
    
         
            +
                                         # Password is already encrypted
         
     | 
| 
      
 119 
     | 
    
         
            +
                                         args[:password]
         
     | 
| 
      
 120 
     | 
    
         
            +
                                       else
         
     | 
| 
      
 121 
     | 
    
         
            +
                                         # Encrypt the plaintext password
         
     | 
| 
      
 122 
     | 
    
         
            +
                                         BCrypt::Password.create(args[:password]).to_s
         
     | 
| 
      
 123 
     | 
    
         
            +
                                       end if args.key? :password and args[:password]
         
     | 
| 
       110 
124 
     | 
    
         | 
| 
       111 
125 
     | 
    
         
             
                    @logger.debug user
         
     | 
| 
       112 
126 
     | 
    
         | 
    
        data/lib/cyclid/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: cyclid-client
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.3. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.3.3
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Kristian Van Der Vliet
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2016-10 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2016-12-10 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: thor
         
     |