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() {
|
||||
var tokens = RED.settings.get("auth-tokens");
|
||||
var token = tokens?tokens.access_token:"";
|
||||
$.ajax({
|
||||
url: "auth/revoke",
|
||||
type: "POST",
|
||||
data: {token:RED.settings.get("auth-tokens").access_token},
|
||||
success: function(data) {
|
||||
data: {token:token}
|
||||
}).done(function(data,textStatus,xhr) {
|
||||
RED.settings.remove("auth-tokens");
|
||||
if (data && data.redirect) {
|
||||
document.location.href = data.redirect;
|
||||
} else {
|
||||
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