aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--auth/auth.htm22
-rw-r--r--auth/hash.js12
-rw-r--r--auth/style.css9
3 files changed, 43 insertions, 0 deletions
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 @@
+<html>
+ <head>
+ <title>StackMode Authentication</title>
+ <script src="hash.js" type="text/javascript"></script>
+ <link rel="stylesheet" type="text/css" href="style.css">
+ </head>
+ <body onLoad="extractValues()">
+ <h1>StackMode Authentication</h1>
+ <p>
+ Good news!
+ Authentication was successful.
+ Your authentication token is
+ <div class="uservalue">
+ <span id="access-token"></span>
+ </div>
+ Please paste this into the prompt within Emacs now.
+ </p>
+ <address>
+ <a href="http://www.github.com/vermiculus/stack-mode">Read the manual on GitHub</a>
+ </address>
+ </body>
+</html>
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;
+}