--- loncom/auth/migrateuser.pm 2016/12/05 00:51:43 1.25 +++ loncom/auth/migrateuser.pm 2020/05/02 17:35:40 1.25.2.2 @@ -1,7 +1,7 @@ # The LearningOnline Network # Starts a user off based of an existing token. # -# $Id: migrateuser.pm,v 1.25 2016/12/05 00:51:43 raeburn Exp $ +# $Id: migrateuser.pm,v 1.25.2.2 2020/05/02 17:35:40 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -171,6 +171,11 @@ sub ip_changed { } } } + unless ($hosthere) { + if (($dataref->{'balancer'}) && ($dataref->{'balcookie'})) { + &Apache::lonnet::delbalcookie($dataref->{'balcookie'},$dataref->{'balancer'}); + } + } } if ($dataref->{'sso.login'}) { $url .= '/adm/roles'; @@ -244,8 +249,15 @@ sub handler { if ($home =~ /(con_lost|no_such_host)/) { return &goto_login($r,$udom); } my $extra_env = &sso_check(\%data); + if (($data{'balancer'}) && ($data{'server'}) && ($data{'balcookie'})) { + if (ref($extra_env) eq 'HASH') { + $extra_env->{'request.balancercookie'} = $data{'server'}.':'.$data{'balcookie'}; + } else { + $extra_env = { 'request.balancercookie' => $data{'server'}.':'.$data{'balcookie'} }; + } + } - my %form; + my (%form,$cid); if ($data{'symb'} ne '') { $form{'symb'} = $data{'symb'}; } @@ -255,8 +267,13 @@ sub handler { if ($data{'noloadbalance'} ne '') { $form{'noloadbalance'} = $data{'noloadbalance'}; } - - if (!$data{'role'}) { + if ($data{'role'}) { + if ($data{'role'} =~ m{\./($match_domain)/($match_courseid)(?:/\w+|$)}) { + unless (&Apache::lonnet::homeserver($2,$1) eq 'no_host') { + $cid = $1.'_'.$2; + } + } + } else { my $handle = &Apache::lonnet::check_for_valid_session($r); if ($handle) { &Apache::lonnet::transfer_profile_to_env($r->dir_config('lonIDsDir'), @@ -286,7 +303,7 @@ sub handler { $next_url .= '&orgurl='.&escape($data{'origurl'}); } &Apache::lonauth::success($r,$data{'username'},$data{'domain'},$home, - $next_url,$extra_env,\%form); + $next_url,$extra_env,\%form,$cid); return OK; }