Project

General

Profile

« Previous | Next » 

Revision 8369

always return the metacat logout form when calling the perl registry logout action, even when there is no perl session to invalidate -- needed for metacatui.

View differences:

src/perl/register-dataset.cgi
3587 3587

  
3588 3588
	# Check if the session exists
3589 3589
	debug("Stage is logout");
3590
	my $uname;
3590 3591
	my $session = CGI::Session->load();
3591 3592
	if ( $session->is_empty || $session->is_expired ) {
3592 3593

  
3593 3594
		# no session found ... send back to index.html page ...
3594 3595
		debug("Session empty or not found");
3595
		my $url = "/";
3596
		redirect($url);
3596
		# just show the logout form without other info
3597
		#my $url = "/";
3598
		#redirect($url);
3597 3599

  
3598
		# should logout request be sent to metacat???
3599 3600
	}
3600 3601
	else {
3601 3602

  
3602 3603
		# get the user name and delete the session
3603 3604
		debug("Session found");
3604
		my $uname = $session->param("username");
3605
		$uname = $session->param("username");
3605 3606
		$session->delete();
3606

  
3607
		# send redirect to metacat and action = login
3608
		my $html = "<html><head>";
3609
		$html .= "</head><body onload=\"document.loginForm.submit()\">";
3610
		$html .= "<form name=\"loginForm\" method=\"post\" action=\""
3611
		  . $metacatUrl . "\">";
3612
		$html .= "<input type=\"hidden\" name=\"action\" value=\"logout\" />";
3613
		$html .= "<input type=\"hidden\" name=\"username\" value=\"" 
3614
		  . $uname . "\" />";
3615
		$html .= "<input type=\"hidden\" name=\"qformat\" value=\""
3616
		  . $skinName . "\" />";
3617
		$html .= "</form></body></html>";
3618
		print($html);
3619 3607
	}
3608
	
3609
	# send redirect form to metacat and action = logout
3610
	my $html = "<html><head>";
3611
	$html .= "</head><body onload=\"document.loginForm.submit()\">";
3612
	$html .= "<form name=\"loginForm\" method=\"post\" action=\""
3613
	  . $metacatUrl . "\">";
3614
	$html .= "<input type=\"hidden\" name=\"action\" value=\"logout\" />";
3615
	$html .= "<input type=\"hidden\" name=\"username\" value=\"" 
3616
	  . $uname . "\" />";
3617
	$html .= "<input type=\"hidden\" name=\"qformat\" value=\""
3618
	  . $skinName . "\" />";
3619
	$html .= "</form></body></html>";
3620
	print($html);
3620 3621
}
3621 3622

  
3622 3623
################################################################################

Also available in: Unified diff