View Issue Details

IDProjectCategoryView StatusLast Update
0013060mantisbtauthenticationpublic2014-09-23 18:05
ReporterLapinkiller Assigned Todregad  
PrioritynormalSeveritymajorReproducibilitysometimes
Status closedResolutionfixed 
Product Version1.2.5 
Target Version1.2.9Fixed in Version1.2.9 
Summary0013060: links from excel to mantis
Description

Hi,

In a excel file (office 2003) i have links to bugs, attachments etc...

If I'm not authenticated on mantis, Mantis ask me to authenticate, and redirect me to the link (as a bug or an attachment). If I click on a second link (I'm still authenticated, I'm redirected to view page instead of the bug or the attachment... I can see, the url is modified ( {mantisurl}/view.php?bug_id=1 to {mantisurl}/login_page.php?return={mantisurl}/view.php?bug_id=1 )

I tried with and without options : "remember me" & "secure session" and still have the problem...

But sometimes there is no problem...

Additional Information

tried on
Win XP : firefox 4.01, Firefox 7alpha1, IE6
Win Seven : IE8

Tagspatch
Attached Files
return-parameter-is-ignored-when-already-auth.patch (1,450 bytes)   
From 6d28cf5925bdb86d4b26e1ce866d3f1d01aa3948 Mon Sep 17 00:00:00 2001
From: Lapinkiller <lapinkiller@hotmail.fr>
Date: Fri, 10 Jun 2011 13:23:41 +0200
Subject: [PATCH] login_page.php return parameter is ignored, when already logged in mantis#13065 ; mantis#13060

---
 login_page.php |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/login_page.php b/login_page.php
index cb7db04..0efa988 100644
--- a/login_page.php
+++ b/login_page.php
@@ -28,10 +28,6 @@
 	  */
 	require_once( 'core.php' );
 
-	if ( auth_is_user_authenticated() && !current_user_is_anonymous() ) {
-		print_header_redirect( config_get( 'default_home_page' ) );
-	}
-
 	$f_error		= gpc_get_bool( 'error' );
 	$f_cookie_error	= gpc_get_bool( 'cookie_error' );
 	$f_return		= string_sanitize_url( gpc_get_string( 'return', '' ) );
@@ -42,6 +38,18 @@
 
 	$t_session_validation = ( ON == config_get_global( 'session_validation' ) );
 
+	//If user is already authenticated and if it isn't anonymous
+	if ( auth_is_user_authenticated() && !current_user_is_anonymous() ) {
+		
+		if($f_return !== ''){//If return URL is specified
+			print_header_redirect( $f_return );
+		}else{
+			print_header_redirect( config_get( 'default_home_page' ) );
+		}
+	}
+	
+	
+	
 	# Check for automatic logon methods where we want the logon to just be handled by login.php
 	if ( auth_automatic_logon_bypass_form() ) {
 		$t_uri = "login.php";
-- 
1.7.4.msysgit.0

return-parameter-is-ignored-when-already-auth.patch-2.txt (1,470 bytes)   
From 6d28cf5925bdb86d4b26e1ce866d3f1d01aa3948 Mon Sep 17 00:00:00 2001
From: Lapinkiller <lapinkiller@hotmail.fr>
Date: Fri, 10 Jun 2011 13:23:41 +0200
Subject: [PATCH] login_page.php return parameter is ignored, when already logged in mantis#13065 ; mantis#13060

---
 login_page.php |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/login_page.php b/login_page.php
index cb7db04..0efa988 100644
--- a/login_page.php
+++ b/login_page.php
@@ -28,10 +28,6 @@
 	  */
 	require_once( 'core.php' );
 
-	if ( auth_is_user_authenticated() && !current_user_is_anonymous() ) {
-		print_header_redirect( config_get( 'default_home_page' ) );
-	}
-
 	$f_error		= gpc_get_bool( 'error' );
 	$f_cookie_error	= gpc_get_bool( 'cookie_error' );
 	$f_return		= string_sanitize_url( gpc_get_string( 'return', '' ) );
@@ -42,6 +38,18 @@
 
 	$t_session_validation = ( ON == config_get_global( 'session_validation' ) );
 
+	//If user is already authenticated and if it isn't anonymous
+	if ( auth_is_user_authenticated() && !current_user_is_anonymous() ) {
+		
+		if($f_return !== ''){//If return URL is specified
+			print_header_redirect( $f_return, false, false, true );
+		}else{
+			print_header_redirect( config_get( 'default_home_page' ) );
+		}
+	}
+	
+	
+	
 	# Check for automatic logon methods where we want the logon to just be handled by login.php
 	if ( auth_automatic_logon_bypass_form() ) {
 		$t_uri = "login.php";
-- 
1.7.4.msysgit.0

Relationships

related to 0015721 closedgrangeway Functionality to consider porting to master-2.0.x 
has duplicate 0013065 closeddregad login_page.php return paremter is ignored, when already logged in 

Activities

mluker

mluker

2011-06-07 10:54

reporter   ~0028937

I've found that if I paste a link to a bug id into eg a mail document, the link works fine.
However, the same link in Excel or Word re-directs me to the MyView page.

atrol

atrol

2011-06-07 11:08

developer   ~0028938

If the solution is found, please post also to the forum
http://www.mantisbt.org/forums/viewtopic.php?f=3&t=12741

Lapinkiller

Lapinkiller

2011-06-08 09:28

reporter   ~0028945

Last edited: 2011-06-08 09:34

i have investigate : when the link is open via Excel, Mantis doesn't see the cookie MANTIS_COOKIE_STRING ... but it exists...

about the hidden cookie :

http://stackoverflow.com/questions/1299632/using-a-query-string-in-an-excel-hyperlink-to-an-asp-net-web-application
http://support.microsoft.com/kb/899927

Why mantis try to get cookie and not try to get php session ??? (with a flag in session that confirm we are authenticated)

Lapinkiller

Lapinkiller

2011-06-10 07:27

reporter   ~0028969

patch attached !

Lapinkiller

Lapinkiller

2011-07-21 04:11

reporter   ~0029245

no feedack about my patch ?

rombert

rombert

2011-07-21 17:55

reporter   ~0029259

@Lapinkiller: sorry for the lack of feedback. Could you submit a pull request on GitHub ? That should be more visible ...

funta222

funta222

2011-11-22 03:53

reporter   ~0030257

Last edited: 2011-11-22 04:06

@Lapinkiller

I installed your patch in Mantis 1.2.8, but unfortunately it does not resolve the issue.

Now all links clicked in an external application (Excel, Word, desktop URL shortcuts etc) go to this URL:

http://mantis.my.domain.com/mantis//mantis/view.php?id=123

instead to

http://mantis.my.domain.com/mantis/view.php?id=123

Can you help?
Thanks in advance.

Lapinkiller

Lapinkiller

2011-11-22 08:48

reporter   ~0030262

Last edited: 2011-11-22 09:03

@rombert, as i said on another bug, i cannot do easily pull request due to the proxy

@funta222 it's seems, there is a bug when mantis is not installed at the root of the domain... my patch use mantis core functions et variable... it just use the variable $f_return instead of go ignoring it and go to home page...

i have reproduced the problem and i have found a solution :

EDIT 1 :

in login_page.php, on lines

if($f_return !== ''){//If return URL is specified
print_header_redirect( $f_return );
}else{

=> replace with
if($f_return !== ''){//If return URL is specified
print_header_redirect( $f_return, false, false, true );
}else{

i will submit a new patch ;)

EDIT 2 :
patch return-parameter-is-ignored-when-already-auth.patch-2.txt
I hope this second patch file is working

funta222

funta222

2011-11-24 09:28

reporter   ~0030331

Hi Lapinkiller,
return-parameter-is-ignored-when-already-auth.patch-2.txt
works fine with 1.2.8

Thanks!

Finally i can use this
0013559: Provide a Link to the issue in Summary field
http://www.mantisbt.org/bugs/view.php?id=13559

dregad

dregad

2011-11-24 18:05

developer   ~0030336

I was not able to reproduce the error you describe myself, but I'll take your word for it, considering that it was confirmed by other users.

Many thanks for the patch ! I have applied it with some minor changes to 1.2.x and master

grangeway

grangeway

2013-04-05 17:57

reporter   ~0036327

Marking as 'acknowledged' not resolved/closed to track that change gets ported to master-2.0.x branch

Related Changesets

MantisBT: master 6a9adc66

2011-06-10 00:23

Lapinkiller


Details Diff
login_page.php return param is ignored when already logged in

This prevents proper behavior when links to bugs are used from an
external application after the initial authentication

Fixes 0013060

Aligned form variables initialization for better code readability

Signed-off-by: Damien Regad <damien.regad@merckgroup.com>
Affected Issues
0013060
mod - login_page.php Diff File

MantisBT: master-1.2.x bbebc4e3

2011-06-10 00:23

Lapinkiller


Details Diff
login_page.php return param is ignored when already logged in

This prevents proper behavior when links to bugs are used from an
external application after the initial authentication

Fixes 0013060

Aligned form variables initialization for better code readability

Signed-off-by: Damien Regad <damien.regad@merckgroup.com>
Affected Issues
0013060
mod - login_page.php Diff File

MantisBT: master 453e7d8f

2011-11-24 10:16

dregad


Details Diff
Fix syntax error

Introduced in 6a9adc66ba7c27f0f68d02922bd59cfa1a8763f9, forgot to git
add before commit...

Fixes 0013060
Affected Issues
0013060
mod - login_page.php Diff File

MantisBT: master-1.2.x 5d1febbe

2011-11-24 10:16

dregad


Details Diff
Fix syntax error

Introduced in bbebc4e3666eabe91938bcd9251933568a7aa031, forgot to git
add before commit...

Fixes 0013060
Affected Issues
0013060
mod - login_page.php Diff File