mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
a simple approach to fix #2657
This commit is contained in:
parent
e5d579c1bb
commit
f917212d67
@ -33,8 +33,8 @@ RED.settings = (function () {
|
|||||||
if (!hasLocalStorage()) {
|
if (!hasLocalStorage()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (key === "auth-tokens") {
|
if (key.startsWith("auth-tokens")) {
|
||||||
localStorage.setItem(key, JSON.stringify(value));
|
localStorage.setItem(key+this.authTokensSuffix, JSON.stringify(value));
|
||||||
} else {
|
} else {
|
||||||
RED.utils.setMessageProperty(userSettings,key,value);
|
RED.utils.setMessageProperty(userSettings,key,value);
|
||||||
saveUserSettings();
|
saveUserSettings();
|
||||||
@ -52,8 +52,8 @@ RED.settings = (function () {
|
|||||||
if (!hasLocalStorage()) {
|
if (!hasLocalStorage()) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
if (key === "auth-tokens") {
|
if (key.startsWith("auth-tokens")) {
|
||||||
return JSON.parse(localStorage.getItem(key));
|
return JSON.parse(localStorage.getItem(key+this.authTokensSuffix));
|
||||||
} else {
|
} else {
|
||||||
var v;
|
var v;
|
||||||
try { v = RED.utils.getMessageProperty(userSettings,key); } catch(err) {}
|
try { v = RED.utils.getMessageProperty(userSettings,key); } catch(err) {}
|
||||||
@ -71,8 +71,8 @@ RED.settings = (function () {
|
|||||||
if (!hasLocalStorage()) {
|
if (!hasLocalStorage()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (key === "auth-tokens") {
|
if (key.startsWith("auth-tokens")) {
|
||||||
localStorage.removeItem(key);
|
localStorage.removeItem(key+this.authTokensSuffix);
|
||||||
} else {
|
} else {
|
||||||
delete userSettings[key];
|
delete userSettings[key];
|
||||||
saveUserSettings();
|
saveUserSettings();
|
||||||
@ -99,6 +99,8 @@ RED.settings = (function () {
|
|||||||
|
|
||||||
var init = function (options, done) {
|
var init = function (options, done) {
|
||||||
var accessTokenMatch = /[?&]access_token=(.*?)(?:$|&)/.exec(window.location.search);
|
var accessTokenMatch = /[?&]access_token=(.*?)(?:$|&)/.exec(window.location.search);
|
||||||
|
var path=window.location.pathname.slice(0,-1);
|
||||||
|
RED.settings.authTokensSuffix=path.replaceAll('/', '-');
|
||||||
if (accessTokenMatch) {
|
if (accessTokenMatch) {
|
||||||
var accessToken = accessTokenMatch[1];
|
var accessToken = accessTokenMatch[1];
|
||||||
RED.settings.set("auth-tokens",{access_token: accessToken});
|
RED.settings.set("auth-tokens",{access_token: accessToken});
|
||||||
|
Loading…
Reference in New Issue
Block a user