From 2bed7f8cd0a5c3af83e8ea742a00bb03da66edc6 Mon Sep 17 00:00:00 2001 From: kload Date: Sat, 7 Jun 2014 12:51:36 +0000 Subject: [PATCH] [fix] Better login handling --- js/app.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/js/app.js b/js/app.js index 7fd0b6a6..777b25ca 100644 --- a/js/app.js +++ b/js/app.js @@ -201,8 +201,13 @@ app = Sammy('#main', function (sam) { }) .fail(function(xhr) { // console.log('fail');console.log(xhr); - if (xhr.status == 401) { - if (uri !== '/login') { + if (xhr.status == 200) { + // Fail with 200, WTF + callback({}); + } else if (xhr.status == 401) { + if (uri === '/login') { + c.flash('fail', y18n.t('wrong_password')); + } else { c.flash('fail', y18n.t('unauthorized')); c.redirect('#/login'); }