[freeside-commits] branch master updated. e3d1afe8e108bbdaf019107109d4b9d9f19a6f8b

Christopher Burger burgerc at freeside.biz
Tue May 7 09:02:53 PDT 2019


The branch, master has been updated
       via  e3d1afe8e108bbdaf019107109d4b9d9f19a6f8b (commit)
      from  6dcc5cc9c8bdeb5635f122761e2ce2d3f52885b6 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit e3d1afe8e108bbdaf019107109d4b9d9f19a6f8b
Author: Christopher Burger <burgerc at freeside.biz>
Date:   Tue May 7 12:02:22 2019 -0400

    RT# 82132 - updated password reset by mail to use username-uppercase config

diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm
index 4e2eb1b31..6166a3782 100644
--- a/FS/FS/ClientAPI/MyAccount.pm
+++ b/FS/FS/ClientAPI/MyAccount.pm
@@ -3305,13 +3305,22 @@ sub reset_passwd {
   my $cust_main = '';
   if ( $p->{'email'} ) { #new-style, changes contact and svc_acct
   
-    $contact = FS::contact->by_selfservice_email($p->{'email'});
+    $contact = FS::contact->by_selfservice_email($p->{'email'}, 'case_insensitive');
 
-    if ( $contact ) {
-      my @cust_contact = grep $_->selfservice_access, $contact->cust_contact;
-      $cust_main = $cust_contact[0]->cust_main if scalar(@cust_contact) == 1;
+    my @customers = grep $_->selfservice_access, $contact->cust_contact;
+    my @cust_contact;
+
+    foreach my $customer (@customers) {
+      if ($conf->exists('username-uppercase') || $conf->exists('username-uppercase', $customer->cust_main->agentnum)) {
+        my $check_contact = FS::contact->by_selfservice_email_custnum($p->{email}, $customer->custnum);
+        push @cust_contact, $customer if $check_contact;
+      }
+      else { push @cust_contact, $customer; }
     }
 
+    $contact = '' unless @cust_contact;
+    $cust_main = $cust_contact[0]->cust_main if scalar(@cust_contact) == 1;
+
     #also look for an svc_acct, otherwise it would be super confusing
 
     my($username, $domain) = split('@', $p->{'email'});

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/ClientAPI/MyAccount.pm | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)




More information about the freeside-commits mailing list