From 3390b7d7f6e9b4f6bd5f0bc6a5d554c21eb2b9ff Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Wed, 13 Apr 2016 11:58:14 -0400 Subject: [PATCH] closes #4516 --- public/src/ajaxify.js | 13 +++++++------ src/controllers/index.js | 6 ++++++ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/public/src/ajaxify.js b/public/src/ajaxify.js index b72447a980..e31786294b 100644 --- a/public/src/ajaxify.js +++ b/public/src/ajaxify.js @@ -70,6 +70,13 @@ $(document).ready(function() { if (err) { return onAjaxError(err, url, callback, quiet); } + + if (window.history && window.history.pushState) { + window.history[!quiet ? 'pushState' : 'replaceState']({ + url: url + }, url, RELATIVE_PATH + '/' + url); + } + retry = true; app.template = data.template.name; @@ -104,12 +111,6 @@ $(document).ready(function() { } ajaxify.currentPage = url.split(/[?#]/)[0]; - - if (window.history && window.history.pushState) { - window.history[!quiet ? 'pushState' : 'replaceState']({ - url: url - }, url, RELATIVE_PATH + '/' + url); - } return url; }; diff --git a/src/controllers/index.js b/src/controllers/index.js index fa35523c2b..d0cc1fe83e 100644 --- a/src/controllers/index.js +++ b/src/controllers/index.js @@ -108,6 +108,12 @@ Controllers.login = function(req, res, next) { data.error = req.flash('error')[0]; data.title = '[[pages:login]]'; + if (!data.allowLocalLogin && !data.allowRegistration && data.alternate_logins && data.authentication.length === 1) { + return helpers.redirect(res, { + external: data.authentication[0].url + }); + } + res.render('login', data); };