From de769976d336d42fb14c2aaa768d7414dabfef06 Mon Sep 17 00:00:00 2001 From: Mathias Biilmann Christensen Date: Sat, 2 Sep 2017 18:55:39 -0700 Subject: Really primitive invite acceptance --- src/js/app.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src') 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 :(")) + } +} -- cgit v1.3