summaryrefslogtreecommitdiff
path: root/httemplate/misc/xmlhttp-validate_password.html
diff options
context:
space:
mode:
authorChristopher Burger <burgerc@freeside.biz>2017-06-20 09:04:14 -0400
committerChristopher Burger <burgerc@freeside.biz>2017-06-22 16:29:49 -0400
commit6016bc83d369186275044bd8539f66a3cb03c4cb (patch)
tree5ca8dfce37fe72b3701950605c0b894cc7f1d850 /httemplate/misc/xmlhttp-validate_password.html
parentcebbf273c639066cb3fd4997b58efe1fdb7322e4 (diff)
RT# 75817 - Added the ability to set contacts password on the backend
Conflicts: httemplate/elements/validate_password.html httemplate/misc/xmlhttp-validate_password.html
Diffstat (limited to 'httemplate/misc/xmlhttp-validate_password.html')
-rw-r--r--httemplate/misc/xmlhttp-validate_password.html40
1 files changed, 28 insertions, 12 deletions
diff --git a/httemplate/misc/xmlhttp-validate_password.html b/httemplate/misc/xmlhttp-validate_password.html
index 1efb4aaa3..b340170f8 100644
--- a/httemplate/misc/xmlhttp-validate_password.html
+++ b/httemplate/misc/xmlhttp-validate_password.html
@@ -29,21 +29,37 @@ my $validate_password = sub {
$result{'syserror'} = 'Invoked without password' unless $password;
return \%result if $result{'syserror'};
- my $svcnum = $arg{'svcnum'};
- $result{'syserror'} = 'Invalid svcnum' unless $svcnum =~ /^\d*$/;
- return \%result if $result{'syserror'};
+ if ($arg{'contactnum'}) {
+ my $contactnum = $arg{'contactnum'};
+ $result{'syserror'} = 'Invalid contactnum' unless $contactnum =~ /^\d*$/;
+ return \%result if $result{'syserror'};
- my $pkgnum = $arg{'pkgnum'};
- $result{'syserror'} = 'Invalid pkgnum' unless $pkgnum =~ /^\d*$/;
- return \%result if $result{'syserror'};
+ my $contact = $contactnum
+ ? qsearchs('contact',{'contactnum' => $contactnum})
+ : '';
- my $svc_acct = $svcnum
- ? qsearchs('svc_acct',{'svcnum' => $svcnum})
- : FS::svc_acct->new({ 'pkgnum' => $pkgnum });
- $result{'syserror'} = 'Could not find service' unless $svc_acct;
- return \%result if $result{'syserror'};
+ $result{'error'} = $contact->is_password_allowed($password);
+ }
+
+ if ($arg{'svcnum'}) {
+ my $pkgnum = $arg{'pkgnum'};
+ $result{'syserror'} = 'Invalid pkgnum' unless $pkgnum =~ /^\d*$/;
+ return \%result if $result{'syserror'};
+
+ my $svcnum = $arg{'svcnum'};
+ $result{'syserror'} = 'Invalid svcnum' unless $svcnum =~ /^\d*$/;
+ return \%result if $result{'syserror'};
+
+ my $svc_acct = $svcnum
+ ? qsearchs('svc_acct',{'svcnum' => $svcnum})
+ : FS::svc_acct->new({ 'pkgnum' => $pkgnum });
+ $result{'syserror'} = 'Could not find service' unless $svc_acct;
+ return \%result if $result{'syserror'};
+
+ $result{'error'} = $svc_acct->is_password_allowed($password);
+ }
- $result{'error'} = $svc_acct->is_password_allowed($password);
+ # $result{'error'} = $svc_acct->is_password_allowed($password);
$result{'valid'} = 1 unless $result{'error'};
return \%result;
};