mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-29 11:02:28 +08:00
refactor: call logout route via JS
required for csrf-csrf to correctly protect against CSRF, as it required the _csrf cookie AND the x-csrf-token HTTP header, the latter cannot be set via simple Form POST action using "../login" here, because "server" method is automatically prepending all paths with "/api", which we don't want here, as we want "/login"
This commit is contained in:
parent
c36085e580
commit
59ecc614c2
@ -114,11 +114,9 @@ export default class Entrypoints extends Component {
|
||||
utils.reloadFrontendApp();
|
||||
}
|
||||
|
||||
logoutCommand() {
|
||||
const $logoutForm = $('<form action="logout" method="POST">').append($(`<input type='_hidden' name="_csrf" value="${glob.csrfToken}"/>`));
|
||||
|
||||
$("body").append($logoutForm);
|
||||
$logoutForm.trigger("submit");
|
||||
async logoutCommand() {
|
||||
await server.post("../logout");
|
||||
window.location.replace(`/login`);
|
||||
}
|
||||
|
||||
backInNoteHistoryCommand() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user