Created
July 22, 2023 02:33
-
-
Save fisherds/645cfd2cabb702c2df55660518f918ad to your computer and use it in GitHub Desktop.
A file for using the Rosefire api for Rose-Hulman login
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
! function (e) { | |
var n = function (e) { | |
var n = e.split(".")[1]; | |
if (n = JSON.parse(atob(n)), n.d) n = n.d; | |
else { | |
var r = n.uid; | |
n = n.claims, n.uid = r | |
} | |
return { | |
token: e, | |
name: n.name, | |
group: n.group, | |
email: n.email, | |
username: n.uid | |
} | |
}, | |
r = function (e, r) { | |
var o = encodeURIComponent(e), | |
i = encodeURIComponent(location.origin), | |
a = window.open("https://rosefire.csse.rose-hulman.edu/webview/login?platform=web®istryToken=" + o + "&referrer=" + i, "_blank"), | |
l = setInterval(function () { | |
a.closed && (clearInterval(l), r && (r(new Error("Login cancelled")), r = null)) | |
}, 500); | |
window.addEventListener("message", function (e) { | |
var o = e.origin || e.originalEvent.origin; | |
if ("https://rosefire.csse.rose-hulman.edu" !== o) return void console.error("Invalid origin:" + o); | |
var i = r; | |
r = null, clearInterval(l), e.source.close(), i && i(null, n(e.data)) | |
}) | |
}; | |
e.Rosefire = {}, e.Rosefire.signIn = r | |
}(this); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment