X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2FClientAPI%2FMyAccount.pm;h=5577f5778f098b909a47563a1e02083a9b4512ff;hb=dc83512c36dc6bea2585abada4f88d714c600e55;hp=4e2eb1b3129f4fb6fc877519d5e9d28bcade730b;hpb=6dcc5cc9c8bdeb5635f122761e2ce2d3f52885b6;p=freeside.git diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm index 4e2eb1b31..5577f5778 100644 --- a/FS/FS/ClientAPI/MyAccount.pm +++ b/FS/FS/ClientAPI/MyAccount.pm @@ -252,7 +252,7 @@ sub login { else { push @cust_contact, $customer; } } - return { error => 'Email '.$p->{email}.' not found!'} + return { error => 'Username '.$p->{email}.' not found!'} unless @cust_contact; return { error => 'Incorrect contact password.' } @@ -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'});