diff --git a/editor/js/user.js b/editor/js/user.js index 084662552..93c7f4349 100644 --- a/editor/js/user.js +++ b/editor/js/user.js @@ -159,9 +159,13 @@ RED.user = (function() { url: "auth/revoke", type: "POST", data: {token:RED.settings.get("auth-tokens").access_token}, - success: function() { + success: function(data) { RED.settings.remove("auth-tokens"); - document.location.reload(true); + if (data && data.redirect) { + document.location.href = data.redirect; + } else { + document.location.reload(true); + } } }) } diff --git a/red/api/auth/index.js b/red/api/auth/index.js index d1858599d..17041ac53 100644 --- a/red/api/auth/index.js +++ b/red/api/auth/index.js @@ -110,7 +110,11 @@ function revoke(req,res) { // TODO: audit log Tokens.revoke(token).then(function() { log.audit({event: "auth.login.revoke"},req); - res.status(200).end(); + if (settings.editorTheme && settings.editorTheme.logout && settings.editorTheme.logout.redirect) { + res.json({redirect:settings.editorTheme.logout.redirect}); + } else { + res.status(200).end(); + } }); }