version 1.7, 2006/06/02 19:38:21
|
version 1.14, 2008/09/15 19:08:44
|
Line 51 sub goto_login {
|
Line 51 sub goto_login {
|
|
|
sub sso_check { |
sub sso_check { |
my ($data) = @_; |
my ($data) = @_; |
|
my %extra_env; |
if ($data->{'sso.login'}) { |
if ($data->{'sso.login'}) { |
&Apache::lonnet::appenv(('request.sso.login' => |
$extra_env{'request.sso.login'} = $data->{'sso.login'}; |
$data->{'sso.login'} )); |
|
} |
} |
|
if ($data->{'sso.reloginserver'}) { |
|
$extra_env{'request.sso.reloginserver'} = |
|
$data->{'sso.reloginserver'}; |
|
} |
|
return \%extra_env; |
} |
} |
|
|
sub handler { |
sub handler { |
Line 62 sub handler {
|
Line 67 sub handler {
|
|
|
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['token']); |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['token']); |
my %data = &Apache::lonnet::tmpget($env{'form.token'}); |
my %data = &Apache::lonnet::tmpget($env{'form.token'}); |
|
if (keys(%data) == 0) { |
|
return &goto_login($r); |
|
} |
my $delete = &Apache::lonnet::tmpdel($env{'form.token'}); |
my $delete = &Apache::lonnet::tmpdel($env{'form.token'}); |
|
|
&Apache::lonlocal::get_language_handle($r); |
&Apache::lonlocal::get_language_handle($r); |
Line 79 sub handler {
|
Line 87 sub handler {
|
my $home=&Apache::lonnet::homeserver($data{'username'},$data{'domain'}); |
my $home=&Apache::lonnet::homeserver($data{'username'},$data{'domain'}); |
if ($home =~ /(con_lost|no_such_host)/) { return &goto_login($r); } |
if ($home =~ /(con_lost|no_such_host)/) { return &goto_login($r); } |
|
|
|
my $extra_env = &sso_check(\%data); |
|
|
if (!$data{'role'}) { |
if (!$data{'role'}) { |
&Apache::lonauth::success($r,$data{'username'},$data{'domain'}, |
my $handle = &Apache::lonnet::check_for_valid_session($r); |
$home,'/adm/roles'); |
if ($handle) { |
&sso_check(\%data); |
&Apache::lonnet::transfer_profile_to_env($r->dir_config('lonIDsDir'), |
|
$handle); |
|
if ($data{'origurl'} ne '') { |
|
$r->internal_redirect($data{'origurl'}); |
|
} elsif ($env{'request.course.id'}) { |
|
$r->internal_redirect('/adm/navmaps'); |
|
} else { |
|
$r->internal_redirect('/adm/roles'); |
|
} |
|
} else { |
|
my $desturl = '/adm/roles'; |
|
if ($data{'origurl'} ne '') { |
|
$desturl = $data{'origurl'}; |
|
} |
|
&Apache::lonauth::success($r,$data{'username'},$data{'domain'}, |
|
$home,$desturl,$extra_env); |
|
|
|
} |
return OK; |
return OK; |
|
|
} |
} |
|
|
my $next_url='/adm/roles?selectrole=1&'.&escape($data{'role'}).'=1'; |
my $next_url='/adm/roles?selectrole=1&'.&escape($data{'role'}).'=1'; |
|
|
|
|
&Apache::lonauth::success($r,$data{'username'},$data{'domain'},$home, |
&Apache::lonauth::success($r,$data{'username'},$data{'domain'},$home, |
$next_url); |
$next_url,$extra_env); |
&sso_check(\%data); |
|
return OK; |
return OK; |
} |
} |
|
|