1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Add editorTheme.logout.redirect to allow redirect on logout

Closes #1213
This commit is contained in:
Nick O'Leary 2017-04-12 21:40:30 +01:00
parent 05878d3176
commit 5cb37148c6
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
2 changed files with 11 additions and 3 deletions

View File

@ -159,10 +159,14 @@ RED.user = (function() {
url: "auth/revoke", url: "auth/revoke",
type: "POST", type: "POST",
data: {token:RED.settings.get("auth-tokens").access_token}, data: {token:RED.settings.get("auth-tokens").access_token},
success: function() { success: function(data) {
RED.settings.remove("auth-tokens"); RED.settings.remove("auth-tokens");
if (data && data.redirect) {
document.location.href = data.redirect;
} else {
document.location.reload(true); document.location.reload(true);
} }
}
}) })
} }

View File

@ -110,7 +110,11 @@ function revoke(req,res) {
// TODO: audit log // TODO: audit log
Tokens.revoke(token).then(function() { Tokens.revoke(token).then(function() {
log.audit({event: "auth.login.revoke"},req); log.audit({event: "auth.login.revoke"},req);
if (settings.editorTheme && settings.editorTheme.logout && settings.editorTheme.logout.redirect) {
res.json({redirect:settings.editorTheme.logout.redirect});
} else {
res.status(200).end(); res.status(200).end();
}
}); });
} }