diff options
author | Christopher Burger <burgerc@freeside.biz> | 2019-05-07 12:02:22 -0400 |
---|---|---|
committer | Christopher Burger <burgerc@freeside.biz> | 2019-05-07 12:04:50 -0400 |
commit | 590301adce46a6f8237b5bdfb134d68285fb01de (patch) | |
tree | 4a37748615cea33bf308e483a87f3950b5ef104f /FS/FS/ClientAPI | |
parent | 231831c3aa77729fb0cf75557099659ab0082259 (diff) |
RT# 82132 - updated password reset by mail to use username-uppercase config
Diffstat (limited to 'FS/FS/ClientAPI')
-rw-r--r-- | FS/FS/ClientAPI/MyAccount.pm | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm index 3154545..91248a5 100644 --- a/FS/FS/ClientAPI/MyAccount.pm +++ b/FS/FS/ClientAPI/MyAccount.pm @@ -3306,13 +3306,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'}); |