Commit 1b822029 authored by Tan Le's avatar Tan Le

Make concern module more auto-load friendly

The existing folder `app/controllers/admin/concerns` is not part of the
top-level auto-load and making EE extension for this concern is
problematic. Other non-admin controller
(e.g. `OmniauthCallbacksController`) is also using this concern so it is
better place in the standard `app/controllers/concerns` folder.

The class is also renamed to be consistent with the existing counterpart
`AuthenticatesWithTwoFactor` class and avoid issue with RSpec cop
misreading the name due to usages of numbers and acronyms (i.e. `2FA`).
parent 149846e1
# frozen_string_literal: true # frozen_string_literal: true
class Admin::SessionsController < ApplicationController class Admin::SessionsController < ApplicationController
include Authenticates2FAForAdminMode include AuthenticatesWithTwoFactorForAdminMode
include InternalRedirect include InternalRedirect
include RendersLdapServers include RendersLdapServers
......
# frozen_string_literal: true # frozen_string_literal: true
module Authenticates2FAForAdminMode module AuthenticatesWithTwoFactorForAdminMode
extend ActiveSupport::Concern extend ActiveSupport::Concern
included do included do
......
# frozen_string_literal: true # frozen_string_literal: true
class OmniauthCallbacksController < Devise::OmniauthCallbacksController class OmniauthCallbacksController < Devise::OmniauthCallbacksController
include AuthenticatesWithTwoFactor include AuthenticatesWithTwoFactorForAdminMode
include Authenticates2FAForAdminMode
include Devise::Controllers::Rememberable include Devise::Controllers::Rememberable
include AuthHelper include AuthHelper
include InitializesCurrentUserMode include InitializesCurrentUserMode
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment