Sha256: 89ccfd2ac4cddcf7545b8501136966608c6c0ed99297884b01bc14b01149a679

Contents?: true

Size: 639 Bytes

Versions: 10

Compression:

Stored size: 639 Bytes

Contents

class ApplicationController < ActionController::Base
  before_action :set_current_request_details
  before_action :authenticate
  <%- if options.sudoable? %>
  def require_sudo
    unless Current.session.sudo?
      redirect_to new_sessions_sudo_path(proceed_to_url: request.url)
    end
  end
  <%- end -%>

  private
    def authenticate
      if session = Session.find_by_id(cookies.signed[:session_token])
        Current.session = session
      else
        redirect_to sign_in_path
      end
    end

    def set_current_request_details
      Current.user_agent = request.user_agent
      Current.ip_address = request.ip
    end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
authentication-zero-2.12.6 lib/generators/authentication/templates/controllers/html/application_controller.rb.tt
authentication-zero-2.12.5 lib/generators/authentication/templates/controllers/html/application_controller.rb.tt
authentication-zero-2.12.4 lib/generators/authentication/templates/controllers/html/application_controller.rb.tt
authentication-zero-2.12.3 lib/generators/authentication/templates/controllers/html/application_controller.rb.tt
authentication-zero-2.12.2 lib/generators/authentication/templates/controllers/html/application_controller.rb.tt
authentication-zero-2.12.1 lib/generators/authentication/templates/controllers/html/application_controller.rb.tt
authentication-zero-2.12.0 lib/generators/authentication/templates/controllers/html/application_controller.rb.tt
authentication-zero-2.11.2 lib/generators/authentication/templates/controllers/html/application_controller.rb.tt
authentication-zero-2.11.1 lib/generators/authentication/templates/controllers/html/application_controller.rb.tt
authentication-zero-2.11.0 lib/generators/authentication/templates/controllers/html/application_controller.rb.tt