summaryrefslogtreecommitdiff
path: root/FS/FS/ClientAPI/MyAccount.pm
diff options
context:
space:
mode:
authorChristopher Burger <burgerc@freeside.biz>2019-05-07 09:19:57 -0400
committerChristopher Burger <burgerc@freeside.biz>2019-05-07 10:18:11 -0400
commit231831c3aa77729fb0cf75557099659ab0082259 (patch)
tree2d52e7a9c81a31f75ce596676e55e40227c59cc1 /FS/FS/ClientAPI/MyAccount.pm
parent37e986126fa8e061b3e366d855eae067736dda3a (diff)
RT# 82132 - updated selfservice login to use config username-uppercase
Diffstat (limited to 'FS/FS/ClientAPI/MyAccount.pm')
-rw-r--r--FS/FS/ClientAPI/MyAccount.pm19
1 files changed, 16 insertions, 3 deletions
diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm
index 162e6ae..3154545 100644
--- a/FS/FS/ClientAPI/MyAccount.pm
+++ b/FS/FS/ClientAPI/MyAccount.pm
@@ -217,9 +217,9 @@ sub login {
my $p = shift;
my $conf = new FS::Conf;
-
my $svc_x = '';
my $session = {};
+
if ( $p->{'domain'} eq 'svc_phone'
&& $conf->exists('selfservice_server-phone_login') ) {
@@ -238,15 +238,28 @@ sub login {
$svc_x = $svc_phone;
} elsif ( $p->{email}
- && (my $contact = FS::contact->by_selfservice_email($p->{email}))
+ && (my $contact = FS::contact->by_selfservice_email($p->{email},'case_insensitive'))
)
{
+ 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; }
+ }
+
+ return { error => 'Email '.$p->{email}.' not found!'}
+ unless @cust_contact;
+
return { error => 'Incorrect contact password.' }
unless $contact->authenticate_password($p->{'password'});
$session->{'contactnum'} = $contact->contactnum;
- my @cust_contact = grep $_->selfservice_access, $contact->cust_contact;
if ( scalar(@cust_contact) == 1 ) {
$session->{'custnum'} = $cust_contact[0]->custnum;
} elsif ( scalar(@cust_contact) ) {