authie 4.0.0.rc3 → 4.0.0.rc4
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/authie/controller_delegate.rb +2 -2
 - data/lib/authie/session.rb +7 -4
 - 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: 99cb3ea1143001fdb259df6d251223036ae94ac4f2661d9732e01b9438a67702
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 261dd3764202502100c0ba19bc649cb7cf3c09b57250d1643b0f14c35e10f2f3
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: b1bfae12c744d812a64dc757b6524f3b09f951adf5f62528e96560dcb93f0424d4590575b5a082a715402c1dbfe8f8721b184fb4b369a9f71b1b51a9c318c81b
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 8c344e7933ec8d13bea40130ba0974a9f2ac97fd5bcb3aa0694305b140b290f4a6a1082cfcfbba82261a11f0bf6c2611662acdb7fc65506b5107b09250f61fae
         
     | 
| 
         @@ -61,9 +61,9 @@ module Authie 
     | 
|
| 
       61 
61 
     | 
    
         
             
                # will be invalidated.
         
     | 
| 
       62 
62 
     | 
    
         
             
                #
         
     | 
| 
       63 
63 
     | 
    
         
             
                # @return [Authie::Session, nil]
         
     | 
| 
       64 
     | 
    
         
            -
                def create_auth_session(user)
         
     | 
| 
      
 64 
     | 
    
         
            +
                def create_auth_session(user, **kwargs)
         
     | 
| 
       65 
65 
     | 
    
         
             
                  if user
         
     | 
| 
       66 
     | 
    
         
            -
                    @auth_session = Authie::Session.start(@controller, user: user)
         
     | 
| 
      
 66 
     | 
    
         
            +
                    @auth_session = Authie::Session.start(@controller, user: user, **kwargs)
         
     | 
| 
       67 
67 
     | 
    
         
             
                    return @auth_session
         
     | 
| 
       68 
68 
     | 
    
         
             
                  end
         
     | 
| 
       69 
69 
     | 
    
         | 
    
        data/lib/authie/session.rb
    CHANGED
    
    | 
         @@ -206,20 +206,22 @@ module Authie 
     | 
|
| 
       206 
206 
     | 
    
         
             
                  # Create a new session within the given controller for the
         
     | 
| 
       207 
207 
     | 
    
         
             
                  #
         
     | 
| 
       208 
208 
     | 
    
         
             
                  # @param controller [ActionController::Base]
         
     | 
| 
       209 
     | 
    
         
            -
                  # @ 
     | 
| 
      
 209 
     | 
    
         
            +
                  # @param user [ActiveRecord::Base] user
         
     | 
| 
      
 210 
     | 
    
         
            +
                  # @param persistent [Boolean] create a persistent session
         
     | 
| 
       210 
211 
     | 
    
         
             
                  # @return [Authie::Session]
         
     | 
| 
       211 
     | 
    
         
            -
                  def start(controller,  
     | 
| 
      
 212 
     | 
    
         
            +
                  def start(controller, user:, persistent: false, see_password: false, **params)
         
     | 
| 
       212 
213 
     | 
    
         
             
                    cookies = controller.send(:cookies)
         
     | 
| 
       213 
214 
     | 
    
         
             
                    SessionModel.active.where(browser_id: cookies[:browser_id]).each(&:invalidate!)
         
     | 
| 
       214 
     | 
    
         
            -
                    user_object = params.delete(:user)
         
     | 
| 
       215 
215 
     | 
    
         | 
| 
       216 
216 
     | 
    
         
             
                    session = SessionModel.new(params)
         
     | 
| 
       217 
     | 
    
         
            -
                    session.user =  
     | 
| 
      
 217 
     | 
    
         
            +
                    session.user = user
         
     | 
| 
       218 
218 
     | 
    
         
             
                    session.browser_id = cookies[:browser_id]
         
     | 
| 
       219 
219 
     | 
    
         
             
                    session.login_at = Time.now
         
     | 
| 
       220 
220 
     | 
    
         
             
                    session.login_ip = controller.request.ip
         
     | 
| 
       221 
221 
     | 
    
         
             
                    session.host = controller.request.host
         
     | 
| 
       222 
222 
     | 
    
         
             
                    session.user_agent = controller.request.user_agent
         
     | 
| 
      
 223 
     | 
    
         
            +
                    session.expires_at = Time.now + Authie.config.persistent_session_length if persistent
         
     | 
| 
      
 224 
     | 
    
         
            +
                    session.password_seen_at = Time.now if see_password
         
     | 
| 
       223 
225 
     | 
    
         
             
                    session.save!
         
     | 
| 
       224 
226 
     | 
    
         | 
| 
       225 
227 
     | 
    
         
             
                    new(controller, session).start
         
     | 
| 
         @@ -261,6 +263,7 @@ module Authie 
     | 
|
| 
       261 
263 
     | 
    
         
             
                delegate :active?, to: :session
         
     | 
| 
       262 
264 
     | 
    
         
             
                delegate :browser_id, to: :session
         
     | 
| 
       263 
265 
     | 
    
         
             
                delegate :expired?, to: :session
         
     | 
| 
      
 266 
     | 
    
         
            +
                delegate :expires_at, to: :session
         
     | 
| 
       264 
267 
     | 
    
         
             
                delegate :first_session_for_browser?, to: :session
         
     | 
| 
       265 
268 
     | 
    
         
             
                delegate :first_session_for_ip?, to: :session
         
     | 
| 
       266 
269 
     | 
    
         
             
                delegate :get, to: :session
         
     |