--- loncom/auth/lonauth.pm 2008/07/10 00:26:40 1.93
+++ loncom/auth/lonauth.pm 2010/03/17 17:51:06 1.103
@@ -1,7 +1,7 @@
# The LearningOnline Network
# User Authentication Module
#
-# $Id: lonauth.pm,v 1.93 2008/07/10 00:26:40 raeburn Exp $
+# $Id: lonauth.pm,v 1.103 2010/03/17 17:51:06 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -40,6 +40,7 @@ use Apache::lonmenu();
use Apache::createaccount;
use Fcntl qw(:flock);
use Apache::lonlocal;
+use HTML::Entities;
# ------------------------------------------------------------ Successful login
sub success {
@@ -73,21 +74,54 @@ sub success {
# ------------------------------------------------------------ Get cookie ready
$cookie="lonID=$cookie; path=/";
# -------------------------------------------------------- Menu script and info
- my $windowinfo=&Apache::lonmenu::open($env{'browser.os'});
- my $startupremote=&Apache::lonmenu::startupremote($lowerurl);
- my $remoteinfo=&Apache::lonmenu::load_remote_msg($lowerurl);
- my $setflags=&Apache::lonmenu::setflags();
- my $maincall=&Apache::lonmenu::maincall();
+ my $destination = $lowerurl;
+
+ if (defined($form->{role})) {
+ my $envkey = 'user.role.'.$form->{role};
+ my $now=time;
+ my $then=$env{'user.login.time'};
+ my $refresh=$env{'user.refresh.time'};
+ if (exists($env{$envkey})) {
+ my ($role,$where,$trolecode,$tstart,$tend,$tremark,$tstatus);
+ &Apache::lonnet::role_status($envkey,$then,$refresh,$now,\$role,\$where,
+ \$trolecode,\$tstatus,\$tstart,\$tend);
+ if ($tstatus eq 'is') {
+ $destination .= ($destination =~ /\?/) ? '&' : '?';
+ my $newrole = &HTML::Entities::encode($form->{role},'"<>&');
+ $destination .= 'selectrole=1&'.$newrole.'=1';
+ }
+ }
+ }
+ if (defined($form->{symb})) {
+ my $destsymb = $form->{symb};
+ $destination .= ($destination =~ /\?/) ? '&' : '?';
+ if ($destsymb =~ /___/) {
+ # FIXME Need to deal with encrypted symbs and urls as needed.
+ my ($map,$resid,$desturl)=split(/___/,$destsymb);
+ unless ($desturl=~/^(adm|uploaded|editupload|public)/) {
+ $desturl = &Apache::lonnet::clutter($desturl);
+ }
+ $desturl = &HTML::Entities::encode($desturl,'"<>&');
+ $destsymb = &HTML::Entities::encode($destsymb,'"<>&');
+ $destination .= '&destinationurl='.$desturl.
+ '&destsymb='.$destsymb;
+ } else {
+ $destsymb = &HTML::Entities::encode($destsymb,'"<>&');
+ $destination .= '&destinationurl='.$destsymb;
+ }
+ }
+
+ my $windowinfo = Apache::lonhtmlcommon::scripttag('self.name="loncapaclient";');
+ my $header = '';
+ my $brcrum = [{'href' => '',
+ 'text' => 'Successful Login'},];
my $start_page=&Apache::loncommon::start_page('Successful Login',
- $startupremote,
- {'no_inline_link' => 1,});
+ $header,
+ {'no_inline_link' => 1,
+ 'bread_crumbs' => $brcrum,});
my $end_page =&Apache::loncommon::end_page();
- my $continuelink;
- if (($env{'browser.interface'} eq 'textual') ||
- ($env{'environment.remote'} eq 'off')) {
- $continuelink="".&mt('Continue')."";
- }
+ my $continuelink=''.&mt('Continue').'';
# ------------------------------------------------- Output for successful login
&Apache::loncommon::content_type($r,'text/html');
@@ -102,13 +136,10 @@ sub success {
);
$r->print(< '.&mt($message).' '.&mt('Please [_1]log in again[_2].'
- ,"{'uname'}&domain=$form->{'udom'}\">",'')
+ .' '.&mt($message).' '.&mt('Please [_1]log in again[_2].','','')
.' '.&mt('Please either [_1]continue the current session[_2] or [_3]logout[_4].'
+ &Apache::lonnet::transfer_profile_to_env($lonidsdir,$handle);
+ &Apache::loncommon::content_type($r,'text/html');
+ $r->send_http_header;
+ my $start_page =
+ &Apache::loncommon::start_page('Already logged in');
+ my $end_page =
+ &Apache::loncommon::end_page();
+ $r->print(
+ $start_page
+ .' '.&mt('Please either [_1]continue the current session[_2] or [_3]log out[_4].'
,'','','','')
- .''.&mt('Sorry ...').'
'
- .''.&mt('You are already logged in!').'
'
- .''.&mt('You are already logged in!').'
'
+ .'