This commit is contained in:
Julian Lam
2016-05-09 11:40:42 -04:00
parent fb9c97e2c8
commit d8c21cc09d
6 changed files with 29 additions and 10 deletions

View File

@@ -102,13 +102,18 @@ Controllers.login = function(req, res, next) {
var allowLoginWith = (meta.config.allowLoginWith || 'username-email');
var errorText;
if (req.query.error === 'csrf-invalid') {
errorText = '[[error:csrf-invalid]]';
}
data.alternate_logins = loginStrategies.length > 0;
data.authentication = loginStrategies;
data.allowLocalLogin = parseInt(meta.config.allowLocalLogin, 10) === 1 || parseInt(req.query.local, 10) === 1;
data.allowRegistration = registrationType === 'normal' || registrationType === 'admin-approval';
data.allowLoginWith = '[[login:' + allowLoginWith + ']]';
data.breadcrumbs = helpers.buildBreadcrumbs([{text: '[[global:login]]'}]);
data.error = req.flash('error')[0];
data.error = req.flash('error')[0] || errorText;
data.title = '[[pages:login]]';
if (!data.allowLocalLogin && !data.allowRegistration && data.alternate_logins && data.authentication.length === 1) {
@@ -137,6 +142,11 @@ Controllers.register = function(req, res, next) {
return next();
}
var errorText;
if (req.query.error === 'csrf-invalid') {
errorText = '[[error:csrf-invalid]]';
}
async.waterfall([
function(next) {
if (registrationType === 'invite-only' || registrationType === 'admin-invite-only') {
@@ -166,7 +176,7 @@ Controllers.register = function(req, res, next) {
data.termsOfUse = termsOfUse.postData.content;
data.breadcrumbs = helpers.buildBreadcrumbs([{text: '[[register:register]]'}]);
data.regFormEntry = [];
data.error = req.flash('error')[0];
data.error = req.flash('error')[0] || errorText;
data.title = '[[pages:register]]';
res.render('register', data);