Class: Rad::Processors::PrepareAutenticityToken

Inherits:
Conveyors::Processor
  • Object
show all
Defined in:
lib/rad_ext/protect_from_forgery.rb

Overview

Processor

Instance Method Summary collapse

Instance Method Details

#callObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/rad_ext/protect_from_forgery.rb', line 5

def call        
  if rad.http.session
    request = workspace.request.must_be.defined
    params = workspace.params.must_be.defined
        
    token = request.session['authenticity_token']

    if token.blank? and request.get? and
      token = generate_authenticity_token
      request.session['authenticity_token'] = token
    end              
  end
  
  next_processor.call
end