[LON-CAPA-cvs] cvs: loncom /interface lonpreferences.pm

raeburn raeburn@source.lon-capa.org
Thu, 23 Jun 2011 22:47:56 -0000


raeburn		Thu Jun 23 22:47:56 2011 EDT

  Modified files:              
    /loncom/interface	lonpreferences.pm 
  Log:
  -  Reset forgotten LON-CAPA password form uses user's domain as default selection
     in domain dropdown.
  
  
Index: loncom/interface/lonpreferences.pm
diff -u loncom/interface/lonpreferences.pm:1.192 loncom/interface/lonpreferences.pm:1.193
--- loncom/interface/lonpreferences.pm:1.192	Mon May 16 00:55:53 2011
+++ loncom/interface/lonpreferences.pm	Thu Jun 23 22:47:56 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Preferences
 #
-# $Id: lonpreferences.pm,v 1.192 2011/05/16 00:55:53 raeburn Exp $
+# $Id: lonpreferences.pm,v 1.193 2011/06/23 22:47:56 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1287,7 +1287,7 @@
     # This function is a bit of a mess....
     # Passwords are encrypted using londes.js (DES encryption)
     $errormessage = ($errormessage || '');
-    my ($user,$domain,$currentpass,$defdom);
+    my ($user,$domain,$currentpass);
     &Apache::lonhtmlcommon::add_breadcrumb(
 		{ href => '/adm/preferences?action=changepass',
                   text => 'Change Password'});
@@ -1302,7 +1302,6 @@
             $caller = 'preferences';
         }
     } elsif ($caller eq 'reset_by_email') {
-            $defdom = $r->dir_config('lonDefDomain');
             my %data = &Apache::lonnet::tmpget($mailtoken);
             if (keys(%data) == 0) {
                 $r->print(&mt('Sorry, the URL you provided to complete the reset of your password was invalid. Either the token included in the URL has been deleted or the URL you provided was invalid. Please submit a [_1]new request[_2] for a password reset, and follow the link to the new URL included in the e-mail that will be sent to you, to allow you to enter a new password.'
@@ -1323,7 +1322,10 @@
                 $r->print(&mt('Sorry, the URL generated when you requested reset of your password contained incomplete information.').'<br />');
                 return;
             }
-   } else {
+            if (&Apache::lonnet::domain($domain) eq '') {
+                $domain = $r->dir_config('lonDefDomain');
+            }
+    } else {
         $r->print(&mt('Page requested in unexpected context').'<br />');
         return;
     }
@@ -1367,7 +1369,7 @@
      crappy browser -->
 ENDFORM
     $r->print(&server_form($logtoken,$caller,$mailtoken));
-    $r->print(&client_form($caller,\%hexkey,$currentpass,$defdom));
+    $r->print(&client_form($caller,\%hexkey,$currentpass,$domain));
 
     #
     return;