Module: CSRF

Included in:
ControllerBase
Defined in:
lib/laris/controller/csrf.rb

Instance Method Summary collapse

Instance Method Details

#form_authenticity_tokenObject



2
3
4
# File 'lib/laris/controller/csrf.rb', line 2

def form_authenticity_token
  @token ||= SecureRandom.urlsafe_base64
end

#verify_authenticityObject



6
7
8
9
10
# File 'lib/laris/controller/csrf.rb', line 6

def verify_authenticity
  unless session_auth_token == form_auth_token
    raise "Invalid Authenticity Token"
  end
end