Feature #16930
closedNeed Additional parameter for hook to enable Multi Factor Authentication Patch
0%
Description
I developed a plugin for one of our clients in order to enable multi factor Authentication for their Redmine users, here is the plugin: https://github.com/acceptto-corp/acceptto-mfa-redmine-plugin
In order to enable multi factor login after login we redirect users to another page waiting to accept login on his/her device in a mobile application. for redirecting to another page after login I need to have access to params in Account_controller:
diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb
index ed38eea..4762d64 100644
--- a/app/controllers/account_controller.rb
+++ b/app/controllers/account_controller.rb
@@ -255,7 +255,7 @@ class AccountController < ApplicationController
if params[:autologin] && Setting.autologin?
set_autologin_cookie(user)
end
- call_hook(:controller_account_success_authentication_after, {:user => user })
+ call_hook(:controller_account_success_authentication_after, {:user => user, :params => params})
redirect_back_or_default my_page_path
end
--
1.8.4
Is it possible to include 'param' in hook parameters? I don't want to patch anything and just use plugin for easier upgrades.
Updated by Mani Malekmohammadi almost 10 years ago
@From a303e0c0c7f60d0387dc781f79dc0ed1ff04fc5c Mon Sep 17 00:00:00 2001 From: mani47 <mm.mani@gmail.com> Date: Sat, 17 May 2014 18:27:38 +0430å Subject: [PATCH] patching redmine to enable mfa --- app/controllers/account_controller.rb | 2 +- 1 file changed, 1 insertions(+), 1 deletion(-) diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index ed38eea..4762d64 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -255,7 +255,7 @@ class AccountController < ApplicationController if params[:autologin] && Setting.autologin? set_autologin_cookie(user) end - call_hook(:controller_account_success_authentication_after, {:user => user }) + call_hook(:controller_account_success_authentication_after, {:user => user, :params => params}) redirect_back_or_default my_page_path end -- 1.8.4 @
Updated by Jean-Philippe Lang over 9 years ago
- Status changed from New to Closed
- Assignee set to Jean-Philippe Lang
- Target version deleted (
2.6.0) - Resolution set to Wont fix
Actually, adding :params to the context of controller hooks is not needed. The request is automatically added to the context of these hooks (see: source:/tags/2.5.0/lib/redmine/hook.rb#L149).
You can use context[:request].params
in your hook to access the params (test added in r13394).