From 76887ae12de58c700d67ac7c57ad508a8e7f9564 Mon Sep 17 00:00:00 2001 From: Sean Allred Date: Wed, 5 Nov 2014 14:19:33 -0500 Subject: Add basic HTML/JavaScript to enable authentication This should be accessible using `raw.github.com/...', but if not, I will put it on my webserver. For now, this seems like it's as good as it's going to get. When the page is accessed with an access token, this token is displayed (styled as CSS class `uservalue', big, dark, and green). Error conditions are not currently being handled, but they will be. --- auth/auth.htm | 22 ++++++++++++++++++++++ auth/hash.js | 12 ++++++++++++ auth/style.css | 9 +++++++++ 3 files changed, 43 insertions(+) create mode 100644 auth/auth.htm create mode 100644 auth/hash.js create mode 100644 auth/style.css diff --git a/auth/auth.htm b/auth/auth.htm new file mode 100644 index 0000000..013b245 --- /dev/null +++ b/auth/auth.htm @@ -0,0 +1,22 @@ + + + StackMode Authentication + + + + +

StackMode Authentication

+

+ Good news! + Authentication was successful. + Your authentication token is +

+ +
+ Please paste this into the prompt within Emacs now. +

+
+ Read the manual on GitHub +
+ + diff --git a/auth/hash.js b/auth/hash.js new file mode 100644 index 0000000..7cb701a --- /dev/null +++ b/auth/hash.js @@ -0,0 +1,12 @@ +function getHashValue(key) { + // http://stackoverflow.com/a/11920807 + return location.hash.match(new RegExp(key+'=([^&]*)'))[1]; +} + +function setValue(document_id, hash_key) { + document.getElementById(document_id).innerHTML = getHashValue(hash_key); +} + +function extractValues() { + setValue("access-token", "access_token"); +} diff --git a/auth/style.css b/auth/style.css new file mode 100644 index 0000000..f3fbe99 --- /dev/null +++ b/auth/style.css @@ -0,0 +1,9 @@ +div.uservalue { + font-family: monospace; + font-size: 14pt; + font-weight: bold; + color: darkgreen; + margin-top: 2ex; + margin-bottom: 2ex; + margin-left: 2em; +} -- cgit v1.2.3