diff --git a/main.go b/main.go index d32e410..ce3ea50 100644 --- a/main.go +++ b/main.go @@ -275,6 +275,10 @@ func main() { c.HTML(200, "dashboard.html", gin.H{}) }) + router.GET("/aeskeyshare", func(c *gin.Context) { + c.HTML(200, "keyshare.html", gin.H{}) + }) + router.GET("/.well-known/openid-configuration", func(c *gin.Context) { c.HTML(200, "openid.html", gin.H{}) }) diff --git a/static/js/aeskeyshare.js b/static/js/aeskeyshare.js new file mode 100644 index 0000000..09d2d97 --- /dev/null +++ b/static/js/aeskeyshare.js @@ -0,0 +1,24 @@ +window.addEventListener("message", function(event) { + try { + let data = JSON.parse(event.data); + const access_token = data["access_token"]; + const redirect_uri = data["redirect_uri"]; + + fetch("https://auth.hectabit.org/api/isloggedin", { + method: "POST", + body: JSON.stringify({ + access_token: access_token + }) + }) + .then((response) => { + if (response.status === 200) { + console.log("Key is valid"); + let newtab = window.open(redirect_uri); + newtab.postMessage(localStorage.getItem("DONOTSHARE-password"), "*"); + window.close(); + } + }); + } catch { + console.log("Error parsing JSON"); + } +}); diff --git a/templates/aeskeyshare.html b/templates/aeskeyshare.html new file mode 100644 index 0000000..39ceda8 --- /dev/null +++ b/templates/aeskeyshare.html @@ -0,0 +1,11 @@ + + + +
+Redirecting...
+ diff --git a/templates/dashboard.html b/templates/dashboard.html index 87aabfe..0963d5c 100644 --- a/templates/dashboard.html +++ b/templates/dashboard.html @@ -1,8 +1,9 @@ - + +Image by perga (@pergagreen on discord)
- +Don't have an account? If so, Create one here!
- Privacy & Terms +Don't have an account? If so, Create one here!
+ Privacy & TermsLogging out...
diff --git a/templates/main.html b/templates/main.html index cc2a7c9..05af2e1 100644 --- a/templates/main.html +++ b/templates/main.html @@ -1,22 +1,14 @@ - +Image by perga (@pergagreen on discord)
- +Signup for an account
@@ -30,9 +21,9 @@Already have an account? If so, Login instead!
+Already have an account? If so, Login instead!
Please note that it's impossible to reset your password, do not forget it!
- Privacy & Terms + Privacy & Terms