mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
parent
df9e50445e
commit
e9c1216d5c
@ -155,17 +155,24 @@ RED.user = (function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function logout() {
|
function logout() {
|
||||||
|
var tokens = RED.settings.get("auth-tokens");
|
||||||
|
var token = tokens?tokens.access_token:"";
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "auth/revoke",
|
url: "auth/revoke",
|
||||||
type: "POST",
|
type: "POST",
|
||||||
data: {token:RED.settings.get("auth-tokens").access_token},
|
data: {token:token}
|
||||||
success: function(data) {
|
}).done(function(data,textStatus,xhr) {
|
||||||
RED.settings.remove("auth-tokens");
|
RED.settings.remove("auth-tokens");
|
||||||
if (data && data.redirect) {
|
if (data && data.redirect) {
|
||||||
document.location.href = data.redirect;
|
document.location.href = data.redirect;
|
||||||
} else {
|
} else {
|
||||||
document.location.reload(true);
|
document.location.reload(true);
|
||||||
}
|
}
|
||||||
|
}).fail(function(jqXHR,textStatus,errorThrown) {
|
||||||
|
if (jqXHR.status === 401) {
|
||||||
|
document.location.reload(true);
|
||||||
|
} else {
|
||||||
|
console.log(textStatus);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user