Commit 0ea4f6ff authored by Cédric Le Ninivin's avatar Cédric Le Ninivin

erp5_officejs: Fix dropbox redirect in bootloader

parent eed03565
Pipeline #18508 failed with stage
in 0 seconds
...@@ -72,7 +72,8 @@ var repair = false; ...@@ -72,7 +72,8 @@ var repair = false;
.ready(function (gadget) { .ready(function (gadget) {
var i, var i,
element_list = element_list =
gadget.element.querySelectorAll('[data-install-configuration]'); gadget.element.querySelectorAll('[data-install-configuration]'),
hash_properties;
gadget.props = {}; gadget.props = {};
for (i = 0; i < element_list.length; i += 1) { for (i = 0; i < element_list.length; i += 1) {
...@@ -83,12 +84,19 @@ var repair = false; ...@@ -83,12 +84,19 @@ var repair = false;
gadget.props.redirect_url = new URL(window.location); gadget.props.redirect_url = new URL(window.location);
gadget.props.redirect_url.pathname += gadget.props.version_url; gadget.props.redirect_url.pathname += gadget.props.version_url;
if (gadget.props.redirect_url.hash) { if (gadget.props.redirect_url.hash) {
if (gadget.props.redirect_url.hash.startsWith('#access_token')) { hash_properties = gadget.props.redirect_url.hash
.substr(1).split('&').reduce(function (res, item) {
var parts = item.split('=');
res[parts[0]] = parts[1];
return res;
},
{});
if (hash_properties.hasOwnProperty('access_token')) {
// This is a bad hack to support dropbox. // This is a bad hack to support dropbox.
gadget.props.redirect_url.hash = gadget.props.redirect_url.hash =
gadget.props.redirect_url.hash.replace( gadget.props.redirect_url.hash.replace("#", "#/?").replace(
'#access_token', 'access_token',
'#/?page=ojs_dropbox_configurator&access_token' 'page=ojs_dropbox_configurator&access_token'
); );
} else if (gadget.props.redirect_url.hash } else if (gadget.props.redirect_url.hash
.startsWith('#page=settings_configurator')) { .startsWith('#page=settings_configurator')) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment