lib/auth/helpers.rb
def check_user_authentication
      if cookies[OLD_COOKIE]
        user = User.where(authentication_token: cookies[OLD_COOKIE]).first
        cookies.delete("auth_token", domain: :all)
        sign_in(user) if user
      end

      env[CURRENT_USER_PROVIDER_KEY] ||= Auth::CurrentUserProvider.new(env)
      current_user_provider = env[CURRENT_USER_PROVIDER_KEY]

      if user_signed_in?
        sign_in(current_user) if current_user_provider.token.expires_in < 1.month
        current_user.update_ip! request.remote_ip
      end
    end
# Upgrade auth token, set up CurrentUserProvider, refresh token if needed,
# log IP address.
Upgrade auth token, set up CurrentUserProvider, refresh token if needed,
log IP address.
Upgrade auth token set up CurrentUserProvider refresh token if needed log IP address .
def check_user_authentication
      if cookies[OLD_COOKIE]
        user = User.where(authentication_token: cookies[OLD_COOKIE]).first
        cookies.delete("auth_token", domain: :all)
        sign_in(user) if user
      end
      env[CURRENT_USER_PROVIDER_KEY] ||= Auth::CurrentUserProvider.new(env)
      current_user_provider = env[CURRENT_USER_PROVIDER_KEY]
      if user_signed_in?
        sign_in(current_user) if current_user_provider.token.expires_in < 1.month
        current_user.update_ip! request.remote_ip
      end
    end
def check_user_authentication if cookies [ OLD_COOKIE ] user = User . where ( authentication_token : cookies [ OLD_COOKIE ] ) . first cookies . delete ( "auth_token" , domain : :all ) sign_in ( user ) if user end env [ CURRENT_USER_PROVIDER_KEY ] ||= Auth :: CurrentUserProvider . new ( env ) current_user_provider = env [ CURRENT_USER_PROVIDER_KEY ] if user_signed_in? sign_in ( current_user ) if current_user_provider . token . expires_in < 1 . month current_user . update_ip! request . remote_ip end end
Upgrade auth token, set up CurrentUserProvider, refresh token if needed,
log IP address.
Upgrade auth token set up CurrentUserProvider refresh token if needed log IP address .