First stages of SessionKey storage implemented
[PHPCredLocker.git] / Resources / main.js
blob:a/Resources/main.js -> blob:b/Resources/main.js
--- a/Resources/main.js
+++ b/Resources/main.js
@@ -12,7 +12,7 @@
 */
 
 
-var counter=false, cancel='', dispcred, interval;
+var counter=false, cancel='', dispcred, interval,terms;
 
 
 
@@ -1090,11 +1090,24 @@
 
 
 function getDivider(){
+  
+    if(typeof(Storage)!=="undefined" && sessionStorage.Delimiter){
+	return sessionStorage.getItem('Delimiter');
+  }
+  
  return getDelimiter(); 
 }
 
 
 function getTerms(a){
+  
+  if(typeof(Storage)!=="undefined"){
+	if (!terms){
+      terms = JSON.parse(sessionStorage.getItem('Terminology'))
+	}
+      return Base64.decode(terms[a.toString()]);
+  }
+  
   return Base64.decode(getTerminology(a));
 }
 
@@ -1143,7 +1156,7 @@
 function checkKeyAvailable(){
  
   
- if(typeof getKey != 'function') {
+ if(!getKey && typeof getTLSKey != 'function') {
    
    if (confirm("Key retrieval failed - Attempting to rectify, Click OK to continue - Screen may refresh")){
    
@@ -1156,7 +1169,7 @@
    
    removeCurrKey();
    
-    if(typeof getKey == 'function') {
+    if(typeof getTLSKey == 'function') {
       alert("Keys retrieved successfully");
       return true;
       
@@ -1173,7 +1186,32 @@
   
 }
 
-
+function getKey(){ 
+  
+ if(typeof(Storage)!=="undefined" && sessionStorage.key){
+    return sessionStorage.getItem('key');
+  }else{
+    if(typeof getTLSKey != 'function'){
+     return false; 
+    }
+   return getTLSKey(); 
+  }
+    
+}
+
+function enabledEncryption(){
+  
+   if(typeof(Storage)!=="undefined" && sessionStorage.CryptEnabled){
+    return sessionStorage.getItem('CryptEnabled');
+  }else{
+    if(typeof enabledTLSEncryption != 'function'){
+     return false; 
+    }
+   return enabledTLSEncryption(); 
+  }
+  
+
+}