RT# 82132 - updated password reset by mail to use username-uppercase config
authorChristopher Burger <burgerc@freeside.biz>
Tue, 7 May 2019 16:02:22 +0000 (12:02 -0400)
committerChristopher Burger <burgerc@freeside.biz>
Tue, 7 May 2019 19:31:37 +0000 (15:31 -0400)
Conflicts:
FS/FS/ClientAPI/MyAccount.pm

FS/FS/ClientAPI/MyAccount.pm

index dae2e19..470d12b 100644 (file)
@@ -3130,7 +3130,11 @@ 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 ($conf->exists('username-uppercase') || $conf->exists('username-uppercase', $contact->cust_main->agentnum)) {
+      $contact = FS::contact->by_selfservice_email_custnum($p->{email}, $contact->custnum);
+    }
 
     $cust_main = $contact->cust_main if $contact;