Project

General

Profile

Actions

Defect #31168

closed

[Redmine 4.0.2] Undefine method "alias_method_chain" Rails 5 upgrade

Added by Tu Nguyen Duy about 5 years ago. Updated about 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Invalid
Affected version:

Description

Because Rails vesion 5.2 upgrade, method "alias_method_chain" don't work.
Would to expert help me to Replace method "alias_method_chain" in Redmine 4.0.2, rails 5.2.

require_dependency 'account_controller'

module AccountLockable
  module AccountControllerPatch
    # unloadable

    extend ActiveSupport::Concern

    included do
      # unloadable

      #alias_method_chain :invalid_credentials, :account_lock
    end

    def invalid_credentials_with_account_lock
      invalid_credentials_without_account_lock
      return if params[:username].blank?

      user = User.active.find_by_login(params[:username])
      return if user.blank?

      login_log = LoginLog.find_or_create_by(user_id: user.id)
      login_log.failed!(request.remote_ip)

      if login_log.lockable?
        user.lock!
        login_log.locked!

        AccountLockableMailer.account_locked(user, login_log).deliver
      end
    end

  end
end

AccountLockable::AccountControllerPatch.tap do |mod|
  AccountController.send :include, mod unless AccountController.include?(mod)
end
Actions #1

Updated by Go MAEDA about 5 years ago

  • Description updated (diff)
  • Category deleted (Accounts / authentication)
  • Status changed from New to Closed
  • Resolution set to Invalid

Please use forums for questions. Reading How to request help may be helpful for you.

Actions

Also available in: Atom PDF