mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-30 02:25:55 +01:00
fixes #4593
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user