bolt / users

Bolt users extension.
MIT License
8 stars 7 forks source link

Add logout route/feature. #14

Open enthus1ast opened 3 years ago

enthus1ast commented 3 years ago

Add a logout route that logs a user out and redirects to a given url

enthus1ast commented 3 years ago

as a workaround i use a logout link that does a ajax call to the backends logout route:

<!-- In my menu.twig -->
<a class="nav-link" href="#" onclick="logout()">logout({{user.username}})</a>
function logout() {
  var xhttp = new XMLHttpRequest();
  xhttp.onreadystatechange = function() {
    if (this.status == 200) {
      window.location.reload();
    }
  };
  xhttp.open("GET", "/bolt/logout", true);
  xhttp.send();
}
crim3hound commented 3 years ago

Perhaps related to Issue #11 @I-Valchev? Could also check the chain of PRs made, particularly PR #10.