Module: Sinatra::CSRF::Helpers

Defined in:
lib/sinatra/csrf.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) authenticity_tag Also known as: csrf_tag



21
22
23
24
# File 'lib/sinatra/csrf.rb', line 21

def authenticity_tag
  return "" unless authenticity_token
  "<input type='hidden' name='#{TOKEN_FIELD}' value='#{authenticity_token}' />"
end

- (Object) authenticity_token Also known as: csrf_token



17
18
19
# File 'lib/sinatra/csrf.rb', line 17

def authenticity_token
  session['sinatra.token']
end