[LON-CAPA-cvs] cvs: loncom /auth migrateuser.pm /interface lonpreferences.pm /lonnet/perl lonnet.pm

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Mon, 24 Mar 2008 04:56:23 -0000


raeburn		Mon Mar 24 00:56:23 2008 EDT

  Modified files:              
    /loncom/lonnet/perl	lonnet.pm 
    /loncom/auth	migrateuser.pm 
    /loncom/interface	lonpreferences.pm 
  Log:
  - exclude errors from hash returned by  &lonnet::tmpget().
  - detect case where hash is empty where lonnet::tmpget() is called by migrateuser.pm and
    lonpreferences.pm
  
  
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.950 loncom/lonnet/perl/lonnet.pm:1.951
--- loncom/lonnet/perl/lonnet.pm:1.950	Sat Mar 22 11:47:41 2008
+++ loncom/lonnet/perl/lonnet.pm	Mon Mar 24 00:55:54 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.950 2008/03/22 15:47:41 raeburn Exp $
+# $Id: lonnet.pm,v 1.951 2008/03/24 04:55:54 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3962,6 +3962,7 @@
     my %returnhash;
     foreach my $item (split(/\&/,$rep)) {
 	my ($key,$value)=split(/=/,$item);
+        next if ($key =~ /^error: 2 /);
 	$returnhash{&unescape($key)}=&thaw_unescape($value);
     }
     return %returnhash;
Index: loncom/auth/migrateuser.pm
diff -u loncom/auth/migrateuser.pm:1.12 loncom/auth/migrateuser.pm:1.13
--- loncom/auth/migrateuser.pm:1.12	Mon Oct  1 17:52:50 2007
+++ loncom/auth/migrateuser.pm	Mon Mar 24 00:56:07 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Starts a user off based of an existing token.
 #
-# $Id: migrateuser.pm,v 1.12 2007/10/01 21:52:50 albertel Exp $
+# $Id: migrateuser.pm,v 1.13 2008/03/24 04:56:07 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -67,6 +67,9 @@
     
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['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'});
 
     &Apache::lonlocal::get_language_handle($r);
Index: loncom/interface/lonpreferences.pm
diff -u loncom/interface/lonpreferences.pm:1.116 loncom/interface/lonpreferences.pm:1.117
--- loncom/interface/lonpreferences.pm:1.116	Tue Mar 11 22:45:07 2008
+++ loncom/interface/lonpreferences.pm	Mon Mar 24 00:56:22 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Preferences
 #
-# $Id: lonpreferences.pm,v 1.116 2008/03/12 02:45:07 raeburn Exp $
+# $Id: lonpreferences.pm,v 1.117 2008/03/24 04:56:22 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1325,6 +1325,13 @@
     #
     if ($caller eq 'reset_by_email') {
         my %data = &Apache::lonnet::tmpget($mailtoken);
+        if (keys(%data) == 0) {
+            &passwordchanger($r,
+                         '<span class="LC_error">'.
+                         &mt('Could not verify current authentication.').'  '.
+                         &mt('Please try again.').'</span>',$caller,$mailtoken);
+            return 1;
+        }
         if ($currentpass ne $data{'temppasswd'}) {
             &passwordchanger($r,
                          '<span class="LC_error">'.