diff --git a/client/js/controllers/auth_controller.js b/client/js/controllers/auth_controller.js index 9db2a001..01c01431 100644 --- a/client/js/controllers/auth_controller.js +++ b/client/js/controllers/auth_controller.js @@ -24,6 +24,7 @@ class AuthController { } loginRoute() { + api.forget(); topNavController.activate('login'); this.loginView.render({ login: (name, password, doRemember) => { diff --git a/client/js/main.js b/client/js/main.js index 468386c7..0245e5e6 100644 --- a/client/js/main.js +++ b/client/js/main.js @@ -30,8 +30,13 @@ const api = require('./api.js'); api.loginFromCookies().then(() => { page(); }).catch(errorMessage => { - page('/'); - events.notify( - events.Error, - 'An error happened while trying to log you in: ' + errorMessage); + if (window.location.href.indexOf('login') !== -1) { + api.forget(); + page(); + } else { + page('/'); + events.notify( + events.Error, + 'An error happened while trying to log you in: ' + errorMessage); + } });