From e66bb26433e78b219fa27bf44ce23f5230682be4 Mon Sep 17 00:00:00 2001
From: Chris Hallberg <crhallberg@gmail.com>
Date: Tue, 28 Oct 2014 14:35:14 -0400
Subject: [PATCH] Cart action repeat bug fix.

---
 themes/bootstrap/js/cart.js    | 2 +-
 themes/bootstrap/js/common.js  | 8 +++++---
 themes/bootstrap3/js/cart.js   | 2 +-
 themes/bootstrap3/js/common.js | 2 ++
 4 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/themes/bootstrap/js/cart.js b/themes/bootstrap/js/cart.js
index f5149c11b1d..dd21ac7d115 100644
--- a/themes/bootstrap/js/cart.js
+++ b/themes/bootstrap/js/cart.js
@@ -171,7 +171,7 @@ function cartSubmit($form) {
     }
     document.location.href = url;
   } else if ((submit != 'empty' || confirm(vufindString['confirmEmpty']))
-  && (submit != 'delete' || confirm(vufindString['confirmDelete']))) {
+         && (submit != 'delete' || confirm(vufindString['confirmDelete']))) {
     Lightbox.submit($form, Lightbox.changeContent);
   } else {
     $('#modal').find('.icon-spinner').remove();
diff --git a/themes/bootstrap/js/common.js b/themes/bootstrap/js/common.js
index 9e0b893a258..d8ed57c7334 100644
--- a/themes/bootstrap/js/common.js
+++ b/themes/bootstrap/js/common.js
@@ -124,6 +124,8 @@ function registerLightboxEvents() {
   $(modal).find("form input[type=submit]").click(function() {
     // Abort requests triggered by the lightbox
     $('#modal .icon-spinner').remove();
+    // Remove other clicks
+    $(modal).find('input[type="submit"][clicked=true]').attr('clicked', false);
     // Add useful information
     $(this).attr("clicked", "true");
     // Add prettiness
@@ -214,8 +216,9 @@ function ajaxLogin(form) {
         // get the user entered password
         var password = form.password.value;
 
-        // encrypt the password with the salt
-        password = rc4Encrypt(salt, password);
+        // base-64 encode the password (to allow support for Unicode)
+        // and then encrypt the password with the salt
+        password = rc4Encrypt(salt, btoa(unescape(encodeURIComponent(password))));
 
         // hex encode the encrypted password
         password = hexEncode(password);
@@ -349,7 +352,6 @@ $(document).ready(function() {
       }, 500); // Delay request submission
     },
     updater : function(item) { // Submit on update
-      // console.log(this.$element[0].form.submit);
       this.$element[0].value = item;
       this.$element[0].form.submit();
       return item;
diff --git a/themes/bootstrap3/js/cart.js b/themes/bootstrap3/js/cart.js
index 0b53236b774..3843c8c3213 100644
--- a/themes/bootstrap3/js/cart.js
+++ b/themes/bootstrap3/js/cart.js
@@ -171,7 +171,7 @@ function cartSubmit($form) {
     }
     document.location.href = url;
   } else if ((submit != 'empty' || confirm(vufindString['confirmEmpty']))
-  && (submit != 'delete' || confirm(vufindString['confirmDelete']))) {
+         && (submit != 'delete' || confirm(vufindString['confirmDelete']))) {
     Lightbox.submit($form, Lightbox.changeContent);
   } else {
     $('#modal').find('.fa.fa-spinner').remove();
diff --git a/themes/bootstrap3/js/common.js b/themes/bootstrap3/js/common.js
index 56273cf3d41..1bba79911b7 100644
--- a/themes/bootstrap3/js/common.js
+++ b/themes/bootstrap3/js/common.js
@@ -126,6 +126,8 @@ function registerLightboxEvents() {
   $(modal).find("form input[type=submit]").click(function() {
     // Abort requests triggered by the lightbox
     $('#modal .fa-spinner').remove();
+    // Remove other clicks
+    $(modal).find('input[type="submit"][clicked=true]').attr('clicked', false);
     // Add useful information
     $(this).attr("clicked", "true");
     // Add prettiness
-- 
GitLab