Commit 6032bea6 authored by marcus-tun's avatar marcus-tun
Browse files

More fixes for shorter url to work

parent ae0f7f5b
...@@ -42,16 +42,16 @@ $.get( from, function( assertion, stat ) { ...@@ -42,16 +42,16 @@ $.get( from, function( assertion, stat ) {
console.log ('out: ' + out); console.log ('out: ' + out);
console.log ('enc_ass: ' + enc_assertion); console.log ('enc_ass: ' + enc_assertion);
$.post(to, out, function(data, stat){ $.post(to, out, function(data, stat){ console.log('sending');
console.log('sending'); console.log('buf: ' + buf);
// replace content in the template // replace content in the template
buf = data.split("url="); buf = data.split("&"); url = buf[1].split("=")[1];
url = buf[1]; shorturl = buf[2].split("=")[1]; console.log('url: ' + url);
$("#url2").html('<a href="'+url+'">encrypted assertion</a>'); console.log('shorturl ' + shorturl); $("#url2").html('<a
$("#url").text(url+"?k="+key); href="'+url+'">encrypted assertion</a>');
$("#short_url").text(short_url+"?k="+key); $("#url").text(url+"?k="+key);
$("#stat_post").text(stat) $("#shorturl").text(shorturl+"?k="+key);
}) $("#stat_post").text(stat) })
console.log ('sent encrypted assertion out'); console.log ('sent encrypted assertion out');
$( "#stat_get" ).text("success"); $( "#stat_get" ).text("success");
......
...@@ -61,7 +61,7 @@ def handler(req): ...@@ -61,7 +61,7 @@ def handler(req):
</table> </table>
<br/><p> You can now use this URL as a temporary password:<br/> <br/><p> You can now use this URL as a temporary password:<br/>
<b id="short_url"> Wait </b></p> <b id="shorturl"> Wait </b></p>
<br/><p> You can now use this URL as a temporary password:<br/> <br/><p> You can now use this URL as a temporary password:<br/>
<b id="url"> Wait </b></p> <b id="url"> Wait </b></p>
...@@ -111,14 +111,15 @@ def handler(req): ...@@ -111,14 +111,15 @@ def handler(req):
# create hash # create hash
assertion_hash = str(hashlib.md5(encrypted_assertion).hexdigest())[0:8] assertion_hash = str(hashlib.md5(encrypted_assertion).hexdigest())[0:8]
assertion_short_url = 'https://'+assertion_hash
assertion_url ='https://' + req.hostname + '/assertions/' + assertion_hash assertion_url ='https://' + req.hostname + '/assertions/' + assertion_hash
# Publish encrypted assertion on the web # Publish encrypted assertion on the web
write_var (req, encrypted_assertion, assertion_hash) write_var (req, encrypted_assertion, assertion_hash)
# return the url as key=value FIXME # return the url as key=value FIXME
req.write("url=%s" % assertion_url) req.write("&url=%s" % assertion_url)
req.write("short_url=%s" % 'https://'+assertion_hash) req.write("&shorturl=%s" % assertion_short_url)
#req.write("%s" % assertion_url) #req.write("%s" % assertion_url)
######### #########
......
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