Class: Locomotive::Steam::Middlewares::PrivateAccess

Inherits:
ThreadSafe
  • Object
show all
Includes:
Helpers
Defined in:
lib/locomotive/steam/middlewares/private_access.rb

Overview

Hide a site behind a password to prevent public access. If page with the “lock_screen” handle exists, then it will be used to display the login form. Otherwise, a very basic form will be displayed.

Instance Attribute Summary

Attributes inherited from ThreadSafe

#env

Instance Method Summary collapse

Methods included from Helpers

#html?, #json?, #log, #make_local_path, #modify_path, #mounted_on, #redirect_to, #render_response

Methods inherited from ThreadSafe

#call, #default_locale, #liquid_assigns, #live_editing?, #locale, #next, #page, #params, #path, #request, #services, #site

Instance Method Details

#_callObject



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/locomotive/steam/middlewares/private_access.rb', line 13

def _call
  return if env['steam.private_access_disabled']

  if site.private_access
    log "Site with private access"

    if access_granted?
      store_password
    else
      render_lock_screen
    end
  end
end