-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #107 from southbridgeio/redmine_5.1_compatibility
add compatibility with Redmine 5.1
- Loading branch information
Showing
6 changed files
with
38 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 0 additions & 12 deletions
12
lib/redmine_two_fa/patches/application_controller_patch.rb
This file was deleted.
Oops, something went wrong.
15 changes: 15 additions & 0 deletions
15
lib/redmine_two_fa/patches/two_fa_application_controller_patch.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module RedmineTwoFa::Patches | ||
module TwoFaApplicationControllerPatch | ||
def find_current_user | ||
user = super | ||
return user unless api_request? || api_key_from_request.present? | ||
return user unless Setting.rest_api_enabled? && Setting.plugin_redmine_2fa['restrict_api_access'] && accept_api_auth? | ||
user&.api_allowed? ? user : nil | ||
end | ||
end | ||
end | ||
|
||
Rails.configuration.to_prepare do | ||
ApplicationController.prepend(RedmineTwoFa::Patches::TwoFaApplicationControllerPatch) | ||
end | ||
|