strongmind-auth 0.1.0 → 1.0.0
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
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 858a24af8bdc82d60c187a237ce0f9012aca8ca0aafea595d55ba05c4bd30dcd
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: a36d21bdee8b7f7baad95bb763cee7233658727c7dfa4e8511f98eb28edda262
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 4176c666a31033ec33658b7138ed3e13787dd3a03c58f31d80f69211e367d45b469fa2ba4f42bd0b65ba54b6bf7235b455df520f592af98bde878b3a494ce95b
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 6bad2f62194ed2adeec7cae1dfc664b571f2d915683b1966c614adc2e1f2997bf2d7a0ab234f8062f403979fa837d861c99cc38be386c69dbcc1d448c58dce87
         
     | 
| 
         @@ -7,7 +7,7 @@ module Users 
     | 
|
| 
       7 
7 
     | 
    
         
             
                def strongmind
         
     | 
| 
       8 
8 
     | 
    
         
             
                  auth = request.env['omniauth.auth']
         
     | 
| 
       9 
9 
     | 
    
         
             
                  User.auth_token_cache = auth
         
     | 
| 
       10 
     | 
    
         
            -
                  @user = User. 
     | 
| 
      
 10 
     | 
    
         
            +
                  @user = User.with_credentials(auth)
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
12 
     | 
    
         
             
                  session[:refresh_token] = request.env['omniauth.auth'].credentials['refresh_token']
         
     | 
| 
       13 
13 
     | 
    
         
             
                  flash.delete(:notice)
         
     | 
    
        data/app/models/user_base.rb
    CHANGED
    
    | 
         @@ -5,13 +5,13 @@ class UserBase < ApplicationRecord 
     | 
|
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
              self.table_name = 'users'
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
       8 
     | 
    
         
            -
              def self. 
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
      
 8 
     | 
    
         
            +
              def self.with_credentials(auth)
         
     | 
| 
       10 
9 
     | 
    
         
             
                email = auth.extra.raw_info['http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress']
         
     | 
| 
       11 
10 
     | 
    
         
             
                user = User.where(uid: auth.uid).first
         
     | 
| 
       12 
11 
     | 
    
         
             
                if user.nil?
         
     | 
| 
       13 
12 
     | 
    
         
             
                  user ||= User.create!(uid: auth.uid, email: email, password: Devise.friendly_token[0, 20])
         
     | 
| 
       14 
13 
     | 
    
         
             
                end
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
       15 
15 
     | 
    
         
             
                user
         
     | 
| 
       16 
16 
     | 
    
         
             
              end
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
         @@ -1,26 +1,23 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            <style>
         
     | 
| 
       2 
     | 
    
         
            -
                 
     | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
                     
     | 
| 
      
 2 
     | 
    
         
            +
                #loading {
         
     | 
| 
      
 3 
     | 
    
         
            +
                    top: 30vh;
         
     | 
| 
      
 4 
     | 
    
         
            +
                    margin-left: auto;
         
     | 
| 
      
 5 
     | 
    
         
            +
                    margin-right: auto;
         
     | 
| 
       5 
6 
     | 
    
         
             
                }
         
     | 
| 
       6 
7 
     | 
    
         | 
| 
       7 
     | 
    
         
            -
                # 
     | 
| 
       8 
     | 
    
         
            -
                     
     | 
| 
      
 8 
     | 
    
         
            +
                #loading .sm-loader {
         
     | 
| 
      
 9 
     | 
    
         
            +
                    height: 120px;
         
     | 
| 
       9 
10 
     | 
    
         
             
                }
         
     | 
| 
       10 
11 
     | 
    
         | 
| 
       11 
     | 
    
         
            -
                #loading .sm- 
     | 
| 
       12 
     | 
    
         
            -
                     
     | 
| 
       13 
     | 
    
         
            -
                }
         
     | 
| 
      
 12 
     | 
    
         
            +
                #loading .sm-loader img {
         
     | 
| 
      
 13 
     | 
    
         
            +
                    height: 100%;
         
     | 
| 
       14 
14 
     | 
    
         | 
| 
       15 
     | 
    
         
            -
                #loading .sm-navbar-container .sm-loader {
         
     | 
| 
       16 
     | 
    
         
            -
                    background: rgb(244, 244, 244);
         
     | 
| 
       17 
     | 
    
         
            -
                    height: 120px;
         
     | 
| 
       18 
15 
     | 
    
         
             
                }
         
     | 
| 
       19 
16 
     | 
    
         
             
            </style>
         
     | 
| 
       20 
17 
     | 
    
         
             
            <%= button_to 'Sign in with StrongMind', '/users/auth/strongmind', style: 'display:none' %>
         
     | 
| 
       21 
18 
     | 
    
         
             
            <script type="text/javascript">
         
     | 
| 
       22 
19 
     | 
    
         
             
                function submitForm() {
         
     | 
| 
       23 
     | 
    
         
            -
                    document.forms[0].submit();
         
     | 
| 
      
 20 
     | 
    
         
            +
                    //document.forms[0].submit();
         
     | 
| 
       24 
21 
     | 
    
         
             
                }
         
     | 
| 
       25 
22 
     | 
    
         | 
| 
       26 
23 
     | 
    
         
             
                // Submit the form on load
         
     | 
| 
         @@ -29,10 +26,9 @@ 
     | 
|
| 
       29 
26 
     | 
    
         
             
                });
         
     | 
| 
       30 
27 
     | 
    
         | 
| 
       31 
28 
     | 
    
         
             
            </script>
         
     | 
| 
       32 
     | 
    
         
            -
            <div id="loading" 
     | 
| 
       33 
     | 
    
         
            -
              <div class="sm- 
     | 
| 
       34 
     | 
    
         
            -
                < 
     | 
| 
       35 
     | 
    
         
            -
                  <img src="https://prod-backpack-ui.strongmind.com/assets/images/strongmind-loader.svg">
         
     | 
| 
       36 
     | 
    
         
            -
                </div>
         
     | 
| 
      
 29 
     | 
    
         
            +
            <div id="loading">
         
     | 
| 
      
 30 
     | 
    
         
            +
              <div class="sm-loader">
         
     | 
| 
      
 31 
     | 
    
         
            +
                <img src="https://prod-backpack-ui.strongmind.com/assets/images/strongmind-loader.svg">
         
     | 
| 
       37 
32 
     | 
    
         
             
              </div>
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
       38 
34 
     | 
    
         
             
            </div>
         
     |