[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /auth lonauth.pm

raeburn raeburn at source.lon-capa.org
Fri Dec 20 10:03:55 EST 2013


raeburn		Fri Dec 20 15:03:55 2013 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom/auth	lonauth.pm 
  Log:
  - For 2.11
    - Backport 1.128, 1.129
  
  
Index: loncom/auth/lonauth.pm
diff -u loncom/auth/lonauth.pm:1.121.2.6 loncom/auth/lonauth.pm:1.121.2.7
--- loncom/auth/lonauth.pm:1.121.2.6	Sun Sep 29 19:31:03 2013
+++ loncom/auth/lonauth.pm	Fri Dec 20 15:03:55 2013
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # User Authentication Module
 #
-# $Id: lonauth.pm,v 1.121.2.6 2013/09/29 19:31:03 raeburn Exp $
+# $Id: lonauth.pm,v 1.121.2.7 2013/12/20 15:03:55 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -171,19 +171,42 @@
 
 sub failed {
     my ($r,$message,$form) = @_;
-    my $start_page = &Apache::loncommon::start_page('Unsuccessful Login',undef);
-    my $retry = '/adm/login?username='.$form->{'uname'}.
-                '&domain='.$form->{'udom'};
+    (undef,undef,undef,my $clientmathml,my $clientunicode) =
+        &Apache::loncommon::decode_user_agent();
+    my $args = {};
+    if ($clientunicode && !$clientmathml) {
+        $args = {'browser.unicode' => 1};
+    }
+
+    my $start_page = &Apache::loncommon::start_page('Unsuccessful Login',undef,$args);
+    my $uname = &Apache::loncommon::cleanup_html($form->{'uname'});
+    my $udom = &Apache::loncommon::cleanup_html($form->{'udom'});
+    if (&Apache::lonnet::domain($udom,'description') eq '') {
+        undef($udom);
+    }
+    my $retry = '/adm/login';
+    if ($uname eq $form->{'uname'}) {
+        $retry .= '?username='.$uname;
+    }
+    if ($udom) {
+        $retry .= (($retry=~/\?/)?'&':'?').'domain='.$udom;
+    }
     if (exists($form->{role})) {
-        $retry .= '&role='.$form->{role};
+        my $role = &Apache::loncommon::cleanup_html($form->{role});
+        if ($role ne '') {
+            $retry .= (($retry=~/\?/)?'&':'?').'role='.$role;
+        }
     }
     if (exists($form->{symb})) {
-        $retry .= '&symb='.$form->{symb};
+        my $symb = &Apache::loncommon::cleanup_html($form->{symb});
+        if ($symb ne '') {
+            $retry .= (($retry=~/\?/)?'&':'?').'symb='.$symb;
+        }
     }
-    my $end_page   = &Apache::loncommon::end_page();
+    my $end_page = &Apache::loncommon::end_page();
     &Apache::loncommon::content_type($r,'text/html');
     $r->send_http_header;
-    my $loginhelp = &loginhelpdisplay($form->{'udom'});
+    my $loginhelp = &loginhelpdisplay($udom);
     if ($loginhelp) {
         $loginhelp = '<p><a href="'.$loginhelp.'">'.&mt('Login problems?').'</a></p>';
     }
@@ -293,6 +316,7 @@
 
     my $tmpinfo=Apache::lonnet::reply('tmpget:'.$form{'logtoken'},
                                       $form{'serverid'});
+
     my %sessiondata;
     if ($form{'iptoken'}) {
         %sessiondata = &Apache::lonnet::tmpget($form{'iptoken'});




More information about the LON-CAPA-cvs mailing list