summaryrefslogtreecommitdiff
path: root/httemplate/elements
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2017-09-12 17:12:03 -0700
committerIvan Kohler <ivan@freeside.biz>2017-09-12 17:12:03 -0700
commit6f94e176aa7b143eb9f1fa5c3a1cdd362361636f (patch)
tree0de771be82c64a3e14aec511c589df720fc6284f /httemplate/elements
parent2f0ad153c1481f9fbe257834319919008c45a275 (diff)
parent3e46323fb8c43b5a226251299a993befc896b71f (diff)
Merge branch 'master' of git.freeside.biz:/home/git/freeside
Diffstat (limited to 'httemplate/elements')
-rw-r--r--httemplate/elements/change_password.html15
-rw-r--r--httemplate/elements/validate_password.html11
2 files changed, 22 insertions, 4 deletions
diff --git a/httemplate/elements/change_password.html b/httemplate/elements/change_password.html
index 463384f2f..7d95e19dc 100644
--- a/httemplate/elements/change_password.html
+++ b/httemplate/elements/change_password.html
@@ -13,7 +13,7 @@
% }
<DIV ID="<%$pre%>form" CLASS="passwordbox">
% if (!$opt{'noformtag'}) {
- <FORM METHOD="POST" ACTION="<%$fsurl%>misc/process/change-password.html">
+ <FORM METHOD="POST" ACTION="<%$fsurl%>misc/process/change-password.html" onsubmit="return checkPasswordValidation()">
% }
<% $change_id_input %>
@@ -33,9 +33,6 @@
'contactnum' => $opt{'contact_num'},
'submitid' => $change_button_id,
&>
-% if ( $error ) {
- <BR><SPAN STYLE="color: #ff0000"><% $error |h %></SPAN>
-% }
% if (!$opt{'noformtag'}) {
</FORM>
@@ -58,6 +55,16 @@ function <%$pre%>toggle(toggle, clear) {
toggle ? 'none' : 'inline';
% }
}
+
+function checkPasswordValidation() {
+ var validationResult = document.getElementById('<%$pre%>password_result').innerHTML;
+ if (validationResult.match(/Password valid!/)) {
+ return true;
+ }
+ else {
+ return false;
+ }
+}
</SCRIPT>
<%init>
my %opt = @_;
diff --git a/httemplate/elements/validate_password.html b/httemplate/elements/validate_password.html
index 3d23a552c..4057f5d3f 100644
--- a/httemplate/elements/validate_password.html
+++ b/httemplate/elements/validate_password.html
@@ -22,6 +22,17 @@ should be the input id plus '_result'.
<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();
+ return check;
+ }
+ }
inputfield.onkeyup = function () {
var fieldid = this.id+'_result';
var resultfield = document.getElementById(fieldid);