Commit 412284cd authored by Christophe Maudoux's avatar Christophe Maudoux 🐛

WIP - Fix JS error (#1430)

parent 34c9fb80
......@@ -142,13 +142,17 @@ print "<meta http-equiv=\"cache-control\" content=\"no-cache\" />\n";
print
"<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n";
print
"<link href=\"$portal_url/static/bwr/bootstrap/dist/css/bootstrap.css\" rel=\"stylesheet\">\n";
"<link href=\"$portal_url/static/bwr/bootstrap/dist/css/bootstrap.css\" type=\"text/css\" rel=\"stylesheet\">\n";
print
"<link href=\"$portal_url/static/bwr/bootstrap/dist/css/bootstrap-theme.css\" rel=\"stylesheet\">\n";
"<link href=\"$portal_url/static/bwr/bootstrap/dist/css/bootstrap-theme.css\" type=\"text/css\" rel=\"stylesheet\">\n";
print "<style>\n";
print "$css\n";
print "</style>\n";
print
"<script type=\"text/javascript\" src=\"$portal_url/static/bwr/crypto-js/sha256.js\"></script>\n";
print
"<script type=\"text/javascript\" src=\"$portal_url/static/bwr/crypto-js/enc-base64.js\"></script>\n";
print
"<script type=\"text/javascript\" src=\"$portal_url/static/bwr/jquery/dist/jquery.js\"></script>\n";
print
"<script type=\"text/javascript\" src=\"$portal_url/static/bwr/jquery-ui/jquery-ui.js\"></script>\n";
......
......@@ -7,6 +7,7 @@ $(document).ready ->
tmp = JSON.parse $(this).text()
for k of tmp
values[k] = tmp[k]
console.log 'values=', values[k]
catch e
console.log 'Parsing error', e
# Initialize JS communication channel
......@@ -19,7 +20,9 @@ $(document).ready ->
console.log 'session_state=', session_state
salt = decodeURIComponent session_state.split('.')[1]
console.log 'salt=', salt
ss = at_hash.toString(CryptoJS.enc.Base64) + '.' + salt
# hash ??????
#ss = hash.toString(CryptoJS.enc.Base64) + '.' + salt
ss = btoa(client_id + ' ' + e.origin + ' ' + salt) + '.' + salt
if session_state == ss
stat = 'unchanged'
else
......
......@@ -11,7 +11,8 @@
tmp = JSON.parse($(this).text());
results = [];
for (k in tmp) {
results.push(values[k] = tmp[k]);
values[k] = tmp[k];
results.push(console.log('values=', values[k]));
}
return results;
} catch (error) {
......@@ -29,7 +30,7 @@
console.log('session_state=', session_state);
salt = decodeURIComponent(session_state.split('.')[1]);
console.log('salt=', salt);
ss = at_hash.toString(CryptoJS.enc.Base64) + '.' + salt;
ss = btoa(client_id + ' ' + e.origin + ' ' + salt) + '.' + salt;
if (session_state === ss) {
stat = 'unchanged';
} else {
......
(function(){var values;values={};$(document).ready(function(){$("script[type='application/init']").each(function(){var e,k,results,tmp;try{tmp=JSON.parse($(this).text());results=[];for(k in tmp){results.push(values[k]=tmp[k])}return results}catch(error){e=error;return console.log("Parsing error",e)}});return window.addEventListener("message",function(e){var client_id,message,salt,session_state,ss,stat;message=e.data;console.log("message=",message);client_id=decodeURIComponent(message.split(" ")[0]);console.log("client_id=",client_id);session_state=decodeURIComponent(message.split(" ")[1]);console.log("session_state=",session_state);salt=decodeURIComponent(session_state.split(".")[1]);console.log("salt=",salt);ss=at_hash.toString(CryptoJS.enc.Base64)+"."+salt;if(session_state===ss){stat="unchanged"}else{stat="changed"}return e.source.postMessage(stat,e.origin)},false)})}).call(this);
(function(){var values;values={};$(document).ready(function(){$("script[type='application/init']").each(function(){var e,k,results,tmp;try{tmp=JSON.parse($(this).text());results=[];for(k in tmp){values[k]=tmp[k];results.push(console.log("values=",values[k]))}return results}catch(error){e=error;return console.log("Parsing error",e)}});return window.addEventListener("message",function(e){var client_id,message,salt,session_state,ss,stat;message=e.data;console.log("message=",message);client_id=decodeURIComponent(message.split(" ")[0]);console.log("client_id=",client_id);session_state=decodeURIComponent(message.split(" ")[1]);console.log("session_state=",session_state);salt=decodeURIComponent(session_state.split(".")[1]);console.log("salt=",salt);ss=btoa(client_id+" "+e.origin+" "+salt)+"."+salt;if(session_state===ss){stat="unchanged"}else{stat="changed"}return e.source.postMessage(stat,e.origin)},false)})}).call(this);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment