Start refinement of CREST utilities:

* Add preference page which gives option of implicit grant or user client details
* Improve CREST service
* Changes in pycrest which make things a little easier
This commit is contained in:
blitzmann
2015-10-21 23:10:06 -04:00
parent 69a4e42ab0
commit e0f99ee133
10 changed files with 176 additions and 95 deletions

30
service/html.py Normal file
View File

@@ -0,0 +1,30 @@
# HTML is stored here as frankly I'm not sure how loading a file would work with
# our current zipfile packaging (and I'm too lazy to find out)
HTML = '''
<!DOCTYPE html>
<html>
<body>
Done. Please close this window.
(will put more interesting messages here later)
<script type="text/javascript">
function extractFromHash(name, hash) {
var match = hash.match(new RegExp(name + "=([^&]+)"));
return !!match && match[1];
}
var hash = window.location.hash;
var token = extractFromHash("access_token", hash);
if (token){
var redirect = window.location.origin.concat('/?', window.location.hash.substr(1));
window.location = redirect;
}
else {
console.log("do nothing");
}
</script>
</body>
</html>
'''