Module: Rodauth::Rails::Feature::Csrf

Defined in:
lib/rodauth/rails/feature/csrf.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(feature) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/rodauth/rails/feature/csrf.rb', line 5

def self.included(feature)
  feature.auth_methods(
    :rails_csrf_tag,
    :rails_csrf_param,
    :rails_csrf_token,
    :rails_check_csrf!,
  )
end

Instance Method Details

#check_csrfObject

Verify Rails’ authenticity token.



20
21
22
# File 'lib/rodauth/rails/feature/csrf.rb', line 20

def check_csrf
  rails_check_csrf!
end

#check_csrf?Boolean

Have Rodauth call #check_csrf automatically.

Returns:

  • (Boolean)


25
26
27
# File 'lib/rodauth/rails/feature/csrf.rb', line 25

def check_csrf?
  true
end

#csrf_tagObject

Render Rails CSRF tags in Rodauth templates.



15
16
17
# File 'lib/rodauth/rails/feature/csrf.rb', line 15

def csrf_tag(*)
  rails_csrf_tag
end