--- loncom/auth/migrateuser.pm 2021/11/03 01:04:02 1.54 +++ loncom/auth/migrateuser.pm 2021/11/17 00:44:47 1.55 @@ -1,7 +1,7 @@ # The LearningOnline Network # Starts a user off based of an existing token. # -# $Id: migrateuser.pm,v 1.54 2021/11/03 01:04:02 raeburn Exp $ +# $Id: migrateuser.pm,v 1.55 2021/11/17 00:44:47 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -703,7 +703,20 @@ sub handler { } } } else { - my $handle = &Apache::lonnet::check_for_valid_session($r); + my ($handle,$expirepub); + $handle = &Apache::lonnet::check_for_valid_session($r); + +# For "public user" - remove any exising "public" cookie so actual user is ogged in. + if ($handle) { + if ($handle=~/^publicuser\_/) { + my $lonidsdir=$r->dir_config('lonIDsDir'); + if ($lonidsdir ne '') { + unlink("$lonidsdir/$handle.id"); + } + undef($handle); + $expirepub = 1; + } + } if ($handle) { &Apache::lonnet::transfer_profile_to_env($r->dir_config('lonIDsDir'), $handle); @@ -945,7 +958,8 @@ sub handler { } } &Apache::lonauth::success($r,$data{'username'},$data{'domain'}, - $home,$desturl,$extra_env,\%form,$skipcritical); + $home,$desturl,$extra_env,\%form,$skipcritical,'', + $expirepub); } return OK; }