aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMathias Biilmann Christensen <info@mathias-biilmann.net>2017-09-02 18:55:39 -0700
committerMathias Biilmann Christensen <info@mathias-biilmann.net>2017-09-02 18:55:39 -0700
commitde769976d336d42fb14c2aaa768d7414dabfef06 (patch)
tree98e76d39b72807c7c0282f1bd279f540895ecc5e /src
parentfba36a19730cba9d58a00b4ac42c1f5dbc90c423 (diff)
Really primitive invite acceptance
Diffstat (limited to 'src')
-rw-r--r--src/js/app.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/js/app.js b/src/js/app.js
index 6fbb399..951bcf3 100644
--- a/src/js/app.js
+++ b/src/js/app.js
@@ -1 +1,13 @@
// JS Goes here - ES6 supported
+import gotrue from "gotrue-js";
+
+if (document.location.hash) {
+ const m = document.location.hash.match(/invite_token=([^&]+)/);
+ if (m) {
+ document.location.hash = "";
+ const pw = prompt("Please pick a password")
+ gotrue.acceptInvite(m[1], pw)
+ .then(() => { document.location.href = "/admin/"; })
+ .catch((err) => alert("Failed to verify invite token :("))
+ }
+}