[LON-CAPA-cvs] cvs: loncom(GCI_2) /interface resetpw.pm

raeburn raeburn@source.lon-capa.org
Thu, 01 Oct 2009 21:05:12 -0000


raeburn		Thu Oct  1 21:05:12 2009 EDT

  Modified files:              (Branch: GCI_2)
    /loncom/interface	resetpw.pm 
  Log:
  - Backport 1.18, 1.19
  - Custom GCI phrases on reset password page. 
  
  
Index: loncom/interface/resetpw.pm
diff -u loncom/interface/resetpw.pm:1.17.10.1 loncom/interface/resetpw.pm:1.17.10.2
--- loncom/interface/resetpw.pm:1.17.10.1	Wed Sep 23 20:17:53 2009
+++ loncom/interface/resetpw.pm	Thu Oct  1 21:05:12 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Allow access to password changing via a token sent to user's e-mail. 
 #
-# $Id: resetpw.pm,v 1.17.10.1 2009/09/23 20:17:53 gci Exp $
+# $Id: resetpw.pm,v 1.17.10.2 2009/10/01 21:05:12 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -46,7 +46,7 @@
     my $contact_name = &mt('LON-CAPA helpdesk');
     my $contact_email =  $r->dir_config('lonSupportEMail');
     my $server = $r->dir_config('lonHostID');
-    my $defdom = $r->dir_config('lonDefDomain');
+    my $defdom = &Apache::lonnet::default_login_domain();
     &Apache::lonacc::get_posted_cgi($r);
     &Apache::lonlocal::get_language_handle($r);
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['token']);
@@ -76,18 +76,26 @@
                 my %userinfo = 
 		    &Apache::lonnet::get('environment',\@emailtypes,
 					 $udom,$uname);
-                my $email = '';
-                my $emailtarget;
+                my @allemails;
                 foreach my $type (@emailtypes) {
-                    $email = $userinfo{$type};
-                    if ($email =~ /[^\@]+\@[^\@]+/) {
-                        $emailtarget = $type; 
-                        last;
+                    my $email = $userinfo{$type};
+                    my @items;
+                    if ($email =~ /,/) {
+                        @items = split(',',$userinfo{$type});
+                    } else {
+                        @items = ($email);
+                    }
+                    foreach my $item (@items) {
+                        if ($item =~ /^[^\@]+\@[^\@]+\.[^\@\.]+$/) {
+                            unless(grep(/^\Q$item\E$/,@allemails)) {
+                                push(@allemails,$item);
+                            }
+                        }
                     }
                 }
-                if ($email =~ /^[^\@]+\@[^\@]+\.[^\@\.]+$/) {
-                    if ($useremail eq $email) {
-                        $output = &send_token($uname,$udom,$email,$server,
+                if (@allemails > 0) {
+                    if (grep(/^\Q$useremail\E$/,@allemails)) {
+                        $output = &send_token($uname,$udom,$useremail,$server,
                                               $domdesc,$contact_name,
                                               $contact_email);
                     } else {
@@ -118,8 +126,8 @@
 sub get_uname {
     my ($defdom) = @_;
     my %lt = &Apache::lonlocal::texthash(
-                                         unam => 'username',
-                                         udom => 'domain',
+                                         unam => 'LON-CAPA username',
+                                         udom => 'LON-CAPA domain',
                                          uemail => 'E-mail address in LON-CAPA',
                                          proc => 'Proceed');
 
@@ -133,9 +141,9 @@
 <form name="forgotpw" method="post">
 <table>
 <tr><td>
-<tr><td align="left">GCI WebCenter $lt{'unam'}:                      </td>
+<tr><td align="left">$lt{'unam'}:</td>
     <td><input type="text" name="uname" size="15" /></td></tr>
-<tr><td align="left">GCI WebCenter $lt{'udom'}:                      </td>
+<tr><td align="left">$lt{'udom'}:</td>
     <td>|;
     $msg .= &Apache::loncommon::select_dom_form($defdom,'udom');
     $msg .= qq|</td></tr>