version 1.139, 2016/02/17 19:15:40
|
version 1.142, 2017/02/17 14:34:21
|
Line 29
|
Line 29
|
package Apache::lonauth;
|
package Apache::lonauth;
|
|
|
use strict;
|
use strict;
|
use LONCAPA;
|
use LONCAPA qw(:DEFAULT :match);
|
use Apache::Constants qw(:common);
|
use Apache::Constants qw(:common);
|
use CGI qw(:standard);
|
use CGI qw(:standard);
|
use DynaLoader; # for Crypt::DES version
|
use DynaLoader; # for Crypt::DES version
|
Line 73 sub success {
|
Line 73 sub success {
|
}
|
}
|
|
|
# ------------------------------------------------------------ Get cookie ready
|
# ------------------------------------------------------------ Get cookie ready
|
$cookie="lonID=$cookie; path=/";
|
$cookie="lonID=$cookie; path=/; HttpOnly";
|
# -------------------------------------------------------- Menu script and info
|
# -------------------------------------------------------- Menu script and info
|
my $destination = $lowerurl;
|
my $destination = $lowerurl;
|
|
|
Line 122 sub success {
|
Line 122 sub success {
|
my $header = '<meta HTTP-EQUIV="Refresh" CONTENT="0; url='.$destination.'" />';
|
my $header = '<meta HTTP-EQUIV="Refresh" CONTENT="0; url='.$destination.'" />';
|
my $brcrum = [{'href' => '',
|
my $brcrum = [{'href' => '',
|
'text' => 'Successful Login'},];
|
'text' => 'Successful Login'},];
|
|
my $args = {'bread_crumbs' => $brcrum,};
|
|
unless ((defined($form->{role})) || (defined($form->{symb}))) {
|
|
my $update=$env{'user.update.time'};
|
|
if (!$update) {
|
|
$update = $env{'user.login.time'};
|
|
}
|
|
my %roles_in_env;
|
|
my $showcount = &Apache::lonroles::roles_from_env(\%roles_in_env,$update);
|
|
if ($showcount == 1) {
|
|
foreach my $rolecode (keys(%roles_in_env)) {
|
|
my ($cid) = ($rolecode =~ m{^\Quser.role.st./\E($match_domain/$match_courseid)(?:/|$)});
|
|
if ($cid) {
|
|
my %coursedescription =
|
|
&Apache::lonnet::coursedescription($cid,{'one_time' => '1'});
|
|
if ($coursedescription{'type'} eq 'Placement') {
|
|
$args->{'crstype'} = 'Placement';
|
|
}
|
|
last;
|
|
}
|
|
}
|
|
}
|
|
}
|
my $start_page=&Apache::loncommon::start_page('Successful Login',
|
my $start_page=&Apache::loncommon::start_page('Successful Login',
|
$header,
|
$header,$args);
|
{'bread_crumbs' => $brcrum,});
|
|
my $end_page =&Apache::loncommon::end_page();
|
my $end_page =&Apache::loncommon::end_page();
|
|
|
my $continuelink='<a href="'.$destination.'">'.&mt('Continue').'</a>';
|
my $continuelink='<a href="'.$destination.'">'.&mt('Continue').'</a>';
|
Line 228 sub reroute {
|
Line 249 sub reroute {
|
sub handler {
|
sub handler {
|
my $r = shift;
|
my $r = shift;
|
my $londocroot = $r->dir_config('lonDocRoot');
|
my $londocroot = $r->dir_config('lonDocRoot');
|
my $form;
|
|
# Are we re-routing?
|
# Are we re-routing?
|
if (-e "$londocroot/lon-status/reroute.txt") {
|
if (-e "$londocroot/lon-status/reroute.txt") {
|
&reroute($r);
|
&reroute($r);
|
Line 445 sub handler {
|
Line 465 sub handler {
|
|
|
unless ($hosthere) {
|
unless ($hosthere) {
|
($is_balancer,$otherserver) =
|
($is_balancer,$otherserver) =
|
&Apache::lonnet::check_loadbalancing($form{'uname'},$form{'udom'});
|
&Apache::lonnet::check_loadbalancing($form{'uname'},$form{'udom'},'login');
|
|
if ($is_balancer) {
|
|
if ($otherserver eq '') {
|
|
my $lowest_load;
|
|
($otherserver,undef,undef,undef,$lowest_load) = &Apache::lonnet::choose_server($form{'udom'});
|
|
if ($lowest_load > 100) {
|
|
$otherserver = &Apache::lonnet::spareserver($lowest_load,$lowest_load,1,$form{'udom'});
|
|
}
|
|
}
|
|
if ($otherserver ne '') {
|
|
my @hosts = &Apache::lonnet::current_machine_ids();
|
|
if (grep(/^\Q$otherserver\E$/,@hosts)) {
|
|
$hosthere = $otherserver;
|
|
}
|
|
}
|
|
}
|
}
|
}
|
|
|
if ($is_balancer) {
|
if (($is_balancer) && (!$hosthere)) {
|
if (!$otherserver) {
|
|
($otherserver) = &Apache::lonnet::choose_server($form{'udom'});
|
|
}
|
|
if ($otherserver) {
|
if ($otherserver) {
|
&success($r,$form{'uname'},$form{'udom'},$authhost,'noredirect',undef,
|
&success($r,$form{'uname'},$form{'udom'},$authhost,'noredirect',undef,
|
\%form);
|
\%form);
|
Line 519 sub handler {
|
Line 551 sub handler {
|
return OK;
|
return OK;
|
}
|
}
|
}
|
}
|
|
if (($is_balancer) && ($hosthere)) {
|
|
$form{'noloadbalance'} = $hosthere;
|
|
}
|
&success($r,$form{'uname'},$form{'udom'},$authhost,$firsturl,undef,
|
&success($r,$form{'uname'},$form{'udom'},$authhost,$firsturl,undef,
|
\%form);
|
\%form);
|
return OK;
|
return OK;
|