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