class

BrowserAction

Inherits Lucky::SecureHeaders::SetXSSGuard < Lucky::SecureHeaders::SetSniffGuard < Lucky::SecureHeaders::SetFrameGuard < Shield::PasswordResetPipes < Shield::EmailConfirmationPipes < Shield::LoginPipes < Shield::PasswordResetHelpers < Shield::EmailConfirmationHelpers < Shield::LoginHelpers < Shield::ActionPipes < Shield::ActionHelpers < Lucille::ActionHelpers < Lucky::Paginator::BackendHelpers < Lucky::ProtectFromForgery < Habitat::SettingsHelpers < Habitat::TempConfig < Shield::BrowserAction < Lucky::Action < Lucky::VerifyAcceptsFormat < Lucky::Redirectable < Habitat::SettingsHelpers < Habitat::TempConfig < Lucky::RequestBodyLimit < Lucky::ActionPipes < Lucky::ParamHelpers < Lucky::Renderable < Lucky::Routable < Lucky::Exposable < Lucky::RequestTypeHelpers < Lucky::ActionDelegates < Reference < Object

Constants

ACCEPTED_FORMAT_SYMBOLS = [:html, :json]
AFTER_PIPES = [set_previous_page_url] of Symbol
BEFORE_PIPES = [verify_accepted_format, protect_from_forgery, disable_caching, require_logged_in, require_logged_out, pin_login_to_ip_address, enforce_login_idle_timeout, check_authorization, set_frame_guard_header, set_sniff_guard_header, set_xss_guard_header] of Symbol
EXPOSURES = [] of Symbol
PARAM_DECLARATIONS = [] of Crystal::Macros::TypeDeclaration
ROUTE_SETTINGS = {prefix: ""}
SKIPPED_PIPES = [pin_login_to_ip_address] of Symbol

Class methods

_accepted_formats
Source

Instance methods

authorize?(__arg0 : Shield::User) : Bool | Nil
Source
authorize?
check_authorization
Source
current_login
Source
current_login?
current_user
Source
current_user?
disable_caching
Source
do_check_authorization_failed
Source
do_enforce_login_idle_timeout_failed
Source
do_pin_email_confirmation_to_ip_address_failed
Source
do_pin_login_to_ip_address_failed
Source
do_pin_password_reset_to_ip_address_failed
Source
do_require_logged_in_failed
Source
do_require_logged_out_failed
Source
enforce_login_idle_timeout
Source
frame_guard_value
Source
logged_in?
Source
logged_out?
Source
paginator_per_page

The number of records to display per page. Defaults to 25

You can override this in your actions

Example

abstract class BrowserAction < Lucky::Action
  include Lucky::Paginator::BackendHelpers

  # Set to a new static value
  def paginator_per_page : Int32
    50 # defaults to 25
  end

  # Or you could allow setting the number from a param
  def paginator_per_page : Int32
    params.get?(:per_page).try(&.to_i) || 25
  end
end
Source
pin_email_confirmation_to_ip_address
Source
pin_login_to_ip_address
Source
pin_password_reset_to_ip_address
Source
previous_page_url
previous_page_url?
redirect_back(*, fallback : Lucky::Action.class, status : HTTP::Status, allow_external = false)
redirect_back(*, fallback : Lucky::RouteHelper, status : HTTP::Status, allow_external = false)
redirect_back(*, fallback : String, status : Int32 = 302, allow_external : Bool = false)

Redirects the browser to the page that issued the request (the referrer) if possible, otherwise redirects to the provided default fallback location.

The referrer information is pulled from the 'Referer' header on the request. This is an optional header, and if the request is missing this header the fallback will be used.

redirect_back fallback: "/users"

A redirect status can be specified

redirect_back fallback: "/home", status: 301

External referrers are ignored by default. It is determined by comparing the referer header to the request host. They can be explicitly allowed if necessary

redirect_back fallback: "/home", allow_external: true

If the referer path matches the current request path, the fallback will be used to avoid redirecting back to the same page.

remote_ip
remote_ip?
require_logged_in
Source
require_logged_out
Source
return_url
return_url?
set_no_referrer_policy
Source
set_previous_page_url

Macros

authorize
Source
authorize_user
Source