function LoadString(name) { // nextDay.setTime(now.getTime() + 24 * 60 * 60 * 1000) // document.cookie = name + "=" + value + "; path=/col/$currentRep/doc; expires=" + nextDay.toGMTString() var pattern = name + "=" if (document.cookie.length > 0) { i = document.cookie.indexOf(pattern) if (i != -1) { i += pattern.length end = document.cookie.indexOf(";", i) if (end == -1) end = document.cookie.length return document.cookie.substring(i, end) } } } function StoreString(name, value) { // if below is necessary with xxForm.html since filling the password field is optional if (value != "") { document.cookie = name + "=" + value + "; path=/" } } function CodeKey(value, publicKey) { // string1 -> string2 string1 = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890" string2 = "uYqbALReBN8cEUjfzQWXOJv3Zlmr5s7PSDGoFx9Kg0a2n6CwkHVMi4yT1Idpht" // string2 = publicKey valueLength = value.length newValue = "" for (var i = 0; i < valueLength; i++) { index = string1.indexOf(value.charAt(i)) if (index == -1) { newValue = newValue + value.charAt(i) } else { newValue = newValue + string2.charAt(index) } } return newValue } function ProcessKey(name, value, update, store, restrictedSubmission, currentPassword) { // alert(value) if (update) { // update if (currentPassword) { newValue = CodeKey(value, document.update.publickey.value) document.update.codedpassword1.value = newValue newValue = CodeKey(document.update.password2.value, document.update.publickey.value) document.update.codedpassword2.value = newValue var codedCurrentPassword = LoadString(name) if (codedCurrentPassword == null) { newValue = CodeKey(document.update.currentpassword.value, document.update.publickey.value) document.update.codedcurrentpassword.value = newValue } } else { var codedPassword1 = LoadString(name) if (codedPassword1 == null) { newValue = CodeKey(value, document.update.publickey.value) // codedpassword1 is necessary because some browsers don't accept changing the password field document.update.codedpassword1.value = newValue if (store) {StoreString(name, newValue)} } } } else { // submit if (!restrictedSubmission) { newValue = CodeKey(document.submit.password2.value, document.submit.publickey.value) document.submit.codedpassword2.value = newValue } newValue = CodeKey(value, document.submit.publickey.value) document.submit.codedpassword1.value = newValue if (currentPassword) { newValue = CodeKey(document.submit.currentpassword.value, document.submit.publickey.value) document.submit.codedcurrentpassword.value = newValue // StoreString(name, newValue) var codedCurrentPassword = LoadString(name) if (codedCurrentPassword == null) { document.submit.passwordloaded.value = 'no' // added by GJFB in 2019-01-15 - notice for the server telling that the coded password WAS NOT loaded at submisssion time StoreString(name, newValue) } else { document.submit.passwordloaded.value = 'yes' // added by GJFB in 2019-01-15 - notice for the server telling that the coded password WAS loaded at submisssion time } } else { // added by GJFB in 2019-01-04 in order to store the coded password at submit also var codedPassword1 = LoadString(name) if (codedPassword1 == null) { document.submit.passwordloaded.value = 'no' // added by GJFB in 2019-01-15 - notice for the server telling that the coded password WAS NOT loaded at submisssion time if (store) {StoreString(name, newValue)} } else { document.submit.passwordloaded.value = 'yes' // added by GJFB in 2019-01-15 - notice for the server telling that the coded password WAS loaded at submisssion time } } } // history.back() /* doesn't work */ }