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,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);
}
}
})
}

View File

@ -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();
}
});
}