summaryrefslogtreecommitdiff
path: root/httemplate/elements/validate_password.html
diff options
context:
space:
mode:
authorChristopher Burger <burgerc@freeside.biz>2018-09-04 08:30:35 -0400
committerChristopher Burger <burgerc@freeside.biz>2018-09-04 08:30:35 -0400
commit8ca45ec1f1ab960ee1e262ee764f05d214728d05 (patch)
tree38bb540c1140d39395a342722929ad0afca67420 /httemplate/elements/validate_password.html
parent5e2b0a5efb81642e86f7704a528767c2ea2961ca (diff)
RT# 75817 - Added password change link to cust main page
Diffstat (limited to 'httemplate/elements/validate_password.html')
-rw-r--r--httemplate/elements/validate_password.html55
1 files changed, 3 insertions, 52 deletions
diff --git a/httemplate/elements/validate_password.html b/httemplate/elements/validate_password.html
index 73c0db281..6aada2fee 100644
--- a/httemplate/elements/validate_password.html
+++ b/httemplate/elements/validate_password.html
@@ -14,59 +14,10 @@ should be the input id plus '_result'.
</%doc>
-<& '/elements/xmlhttp.html',
- 'url' => $p.'misc/xmlhttp-validate_password.html',
- 'subs' => [ 'validate_password' ],
- 'method' => 'POST', # important not to put passwords in url
-&>
-<SCRIPT>
-function add_password_validation (fieldid, submitid) {
- var inputfield = document.getElementById(fieldid);
- inputfield.onkeydown = function(e) {
- var key;
- if (window.event) { key = window.event.keyCode; }
- else { key = e.which; } // for ff browsers
- // some browsers allow the enter key to submit a form even if the submit button is disabled
- // below prevents enter key from submiting form if password has not been validated.
- if (key == '13') {
- var check = checkPasswordValidation(fieldid);
- return check;
- }
- }
- inputfield.onkeyup = function () {
- var fieldid = this.id+'_result';
- var resultfield = document.getElementById(fieldid);
- if (this.value) {
- resultfield.innerHTML = '<SPAN STYLE="color: blue;">Validating password...</SPAN>';
- validate_password('fieldid',fieldid,'svcnum','<% $opt{'svcnum'} %>','contactnum','<% $opt{'contactnum'} %>','password',this.value,
- function (result) {
- result = JSON.parse(result);
- var resultfield = document.getElementById(result.fieldid);
- if (resultfield) {
- var errorimg = '<IMG SRC="<% $p %>images/error.png" style="width: 1em; display: inline-block; padding-right: .5em">';
- var validimg = '<IMG SRC="<% $p %>images/tick.png" style="width: 1em; display: inline-block; padding-right: .5em">';
- if (result.valid) {
- resultfield.innerHTML = validimg+'<SPAN STYLE="color: green;">Password valid!</SPAN>';
- if (submitid){ document.getElementById(submitid).disabled = false; }
- } else if (result.error) {
- resultfield.innerHTML = errorimg+'<SPAN STYLE="color: red;">'+result.error+'</SPAN>';
- if (submitid){ document.getElementById(submitid).disabled = true; }
- } else {
- result.syserror = result.syserror || 'Server error';
- resultfield.innerHTML = errorimg+'<SPAN STYLE="color: red;">'+result.syserror+'</SPAN>';
- if (submitid){ document.getElementById(submitid).disabled = true; }
- }
- }
- }
- );
- } else {
- resultfield.innerHTML = '';
- if (submitid){ document.getElementById(submitid).disabled = false; }
- }
- };
-}
+<& '/elements/validate_password_js.html', %opt &>
-add_password_validation('<% $opt{'fieldid'} %>', '<% $opt{'submitid'} %>');
+<SCRIPT>
+ add_password_validation('<% $opt{'fieldid'} %>', '<% $opt{'submitid'} %>', '<% $opt{'svcnum'} %>', '<% $opt{'contactnum'} %>');
</SCRIPT>
<%init>