diff options
author | Mark Wells <mark@freeside.biz> | 2016-02-08 16:09:28 -0800 |
---|---|---|
committer | Mark Wells <mark@freeside.biz> | 2016-02-08 16:11:02 -0800 |
commit | a19a04f0b684c64039c03216d398af534c858bf9 (patch) | |
tree | 2ede1cb36cfb029d888616a37ac8af6f8028a762 /httemplate/misc | |
parent | 169c72822ed292c03b61e536f1028830fdea9dbc (diff) |
make password-insecure option work when adding a new svc_acct, #40236
Diffstat (limited to 'httemplate/misc')
-rw-r--r-- | httemplate/misc/xmlhttp-validate_password.html | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/httemplate/misc/xmlhttp-validate_password.html b/httemplate/misc/xmlhttp-validate_password.html index 28dbf6460..1efb4aaa3 100644 --- a/httemplate/misc/xmlhttp-validate_password.html +++ b/httemplate/misc/xmlhttp-validate_password.html @@ -1,13 +1,14 @@ <%doc> -Requires cgi params 'password' (plaintext) and 'sub' ('validate_password' is only -acceptable value.) Also accepts 'svcnum' (for svc_acct, will otherwise create an -empty dummy svc_acct) and 'fieldid' (for html post-processing, passed along in -results for convenience.) - -Returns a json-encoded hashref with keys of 'valid' (set to 1 if object is valid), -'error' (error text if password is invalid) or 'syserror' (error text if password -could not be validated.) Only one of these keys will be set. Will also set -'fieldid' if it was passed. +Requires cgi params 'password' (plaintext) and 'sub' ('validate_password' is +only acceptable value.) Also accepts 'svcnum' (for svc_acct, will otherwise +create an empty dummy svc_acct), 'pkgnum' (for when the svc_acct isn't yet +inserted), and 'fieldid' (for html post-processing, passed along in results +for convenience.) + +Returns a json-encoded hashref with keys of 'valid' (set to 1 if object is +valid), 'error' (error text if password is invalid) or 'syserror' (error text +if password could not be validated.) Only one of these keys will be set. +Will also set 'fieldid' if it was passed. </%doc> <% encode_json($result) %> @@ -32,9 +33,13 @@ my $validate_password = sub { $result{'syserror'} = 'Invalid svcnum' unless $svcnum =~ /^\d*$/; return \%result if $result{'syserror'}; + my $pkgnum = $arg{'pkgnum'}; + $result{'syserror'} = 'Invalid pkgnum' unless $pkgnum =~ /^\d*$/; + return \%result if $result{'syserror'}; + my $svc_acct = $svcnum ? qsearchs('svc_acct',{'svcnum' => $svcnum}) - : (new FS::svc_acct {}); + : FS::svc_acct->new({ 'pkgnum' => $pkgnum }); $result{'syserror'} = 'Could not find service' unless $svc_acct; return \%result if $result{'syserror'}; |