--- loncom/auth/lonauth.pm 2014/01/05 11:04:27 1.130 +++ loncom/auth/lonauth.pm 2014/01/05 11:17:16 1.131 @@ -1,7 +1,7 @@ # The LearningOnline Network # User Authentication Module # -# $Id: lonauth.pm,v 1.130 2014/01/05 11:04:27 raeburn Exp $ +# $Id: lonauth.pm,v 1.131 2014/01/05 11:17:16 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -471,7 +471,17 @@ sub handler { if ($otherserver) { &success($r,$form{'uname'},$form{'udom'},$authhost,'noredirect',undef, \%form); - $r->internal_redirect('/adm/switchserver?otherserver='.$otherserver.'&origurl='.$firsturl); + my $switchto = '/adm/switchserver?otherserver='.$otherserver; + if (($firsturl) && ($firsturl ne '/adm/switchserver') && ($firsturl ne '/adm/roles')) { + $switchto .= '&origurl='.$firsturl; + } + if ($form{'role'}) { + $switchto .= '&role='.$form{'role'}; + } + if ($form{'symb'}) { + $switchto .= '&symb='.$form{'symb'}; + } + $r->internal_redirect($switchto); } else { $r->print(&noswitch()); } @@ -482,7 +492,17 @@ sub handler { if ($otherserver) { &success($r,$form{'uname'},$form{'udom'},$authhost,'noredirect',undef, \%form); - $r->internal_redirect('/adm/switchserver?otherserver='.$otherserver.'&origurl='.$firsturl); + my $switchto = '/adm/switchserver?otherserver='.$otherserver; + if (($firsturl) && ($firsturl ne '/adm/switchserver') && ($firsturl ne '/adm/roles')) { + $switchto .= '&origurl='.$firsturl; + } + if ($form{'role'}) { + $switchto .= '&role='.$form{'role'}; + } + if ($form{'symb'}) { + $switchto .= '&symb='.$form{'symb'}; + } + $r->internal_redirect($switchto); } else { $r->print(&noswitch()); }