Skip to content

Instantly share code, notes, and snippets.

@fedeagripa
Created June 9, 2020 17:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fedeagripa/69a868ad03da582a17a4593848a5aecf to your computer and use it in GitHub Desktop.
Save fedeagripa/69a868ad03da582a17a4593848a5aecf to your computer and use it in GitHub Desktop.
2fa_session_controller_devise_patch
# app/controllers/admin_users/sessions_controller.rb
prepend_before_action :require_no_authentication, only: [:new, :create]
prepend_before_action :allow_params_authentication!, only: :create
prepend_before_action :verify_signed_out_user, only: :destroy
prepend_before_action(only: [:create, :destroy]) { request.env["devise.skip_timeout"] = true }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment