]> git.proxmox.com Git - proxmox-widget-toolkit.git/commitdiff
utils: add getOpenIDRedirectionAuthorization: to avoid code-duplication
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 2 Jul 2021 11:53:11 +0000 (13:53 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 2 Jul 2021 11:53:11 +0000 (13:53 +0200)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/Utils.js

index bc602dea70e4b2a8b2c256c2dd2264f5d56670f3..7f32f0556b8c32d1d3e9c11824ef5c1d9b2b5678 100644 (file)
@@ -279,6 +279,16 @@ utilities: {
        window.localStorage.removeItem("ProxmoxUser");
     },
 
+    // The End-User gets redirected back here after login on the OpenID auth. portal, and in the
+    // redirection URL the state and auth.code are passed as URL GET params, this helper parses those
+    getOpenIDRedirectionAuthorization: function() {
+       const auth = Ext.Object.fromQueryString(window.location.search);
+       if (auth.state !== undefined && auth.code !== undefined) {
+           return auth;
+       }
+       return undefined;
+    },
+
     // comp.setLoading() is buggy in ExtJS 4.0.7, so we
     // use el.mask() instead
     setErrorMask: function(comp, msg) {