Project

General

Profile

Actions

Feature #16930

closed

Need Additional parameter for hook to enable Multi Factor Authentication Patch

Added by Mani Malekmohammadi almost 10 years ago. Updated over 9 years ago.

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

0%

Estimated time:
Resolution:
Wont fix

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.

Actions #1

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
@
Actions #2

Updated by Jean-Philippe Lang almost 10 years ago

  • Target version set to 2.6.0
Actions #3

Updated by Toshi MARUYAMA almost 10 years ago

  • Description updated (diff)
Actions #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).

Actions

Also available in: Atom PDF