|
@@ -34,7 +34,7 @@ module.exports = function(crowi, app) {
|
|
|
* @param {*} res
|
|
* @param {*} res
|
|
|
*/
|
|
*/
|
|
|
const loginFailureHandler = (req, res, message) => {
|
|
const loginFailureHandler = (req, res, message) => {
|
|
|
- req.flash('errorMessage', message || 'Sign in failure.');
|
|
|
|
|
|
|
+ req.flash('errorMessage', message || req.t('message.sign_in_failure'));
|
|
|
return res.redirect('/login');
|
|
return res.redirect('/login');
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -44,7 +44,7 @@ module.exports = function(crowi, app) {
|
|
|
* @param {*} res
|
|
* @param {*} res
|
|
|
*/
|
|
*/
|
|
|
const loginFailure = (req, res) => {
|
|
const loginFailure = (req, res) => {
|
|
|
- return loginFailureHandler(req, res, 'Sign in failure.');
|
|
|
|
|
|
|
+ return loginFailureHandler(req, res, req.t('message.sign_in_failure'));
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -142,7 +142,7 @@ module.exports = function(crowi, app) {
|
|
|
debug('LdapStrategy has not been set up');
|
|
debug('LdapStrategy has not been set up');
|
|
|
return res.json(ApiResponse.success({
|
|
return res.json(ApiResponse.success({
|
|
|
status: 'warning',
|
|
status: 'warning',
|
|
|
- message: 'LdapStrategy has not been set up',
|
|
|
|
|
|
|
+ message: req.t('message.strategy_has_not_been_set_up', { strategy: 'LdapStrategy' }),
|
|
|
}));
|
|
}));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -196,7 +196,7 @@ module.exports = function(crowi, app) {
|
|
|
const loginWithLocal = (req, res, next) => {
|
|
const loginWithLocal = (req, res, next) => {
|
|
|
if (!passportService.isLocalStrategySetup) {
|
|
if (!passportService.isLocalStrategySetup) {
|
|
|
debug('LocalStrategy has not been set up');
|
|
debug('LocalStrategy has not been set up');
|
|
|
- req.flash('warningMessage', 'LocalStrategy has not been set up');
|
|
|
|
|
|
|
+ req.flash('warningMessage', req.t('message.strategy_has_not_been_set_up', { strategy: 'LocalStrategy' }));
|
|
|
return next();
|
|
return next();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -212,7 +212,7 @@ module.exports = function(crowi, app) {
|
|
|
|
|
|
|
|
if (err) { // DB Error
|
|
if (err) { // DB Error
|
|
|
logger.error('Database Server Error: ', err);
|
|
logger.error('Database Server Error: ', err);
|
|
|
- req.flash('warningMessage', 'Database Server Error occured.');
|
|
|
|
|
|
|
+ req.flash('warningMessage', req.t('message.database_error'));
|
|
|
return next(); // pass and the flash message is displayed when all of authentications are failed.
|
|
return next(); // pass and the flash message is displayed when all of authentications are failed.
|
|
|
}
|
|
}
|
|
|
if (!user) { return next() }
|
|
if (!user) { return next() }
|
|
@@ -227,7 +227,7 @@ module.exports = function(crowi, app) {
|
|
|
const loginWithGoogle = function(req, res, next) {
|
|
const loginWithGoogle = function(req, res, next) {
|
|
|
if (!passportService.isGoogleStrategySetup) {
|
|
if (!passportService.isGoogleStrategySetup) {
|
|
|
debug('GoogleStrategy has not been set up');
|
|
debug('GoogleStrategy has not been set up');
|
|
|
- req.flash('warningMessage', 'GoogleStrategy has not been set up');
|
|
|
|
|
|
|
+ req.flash('warningMessage', req.t('message.strategy_has_not_been_set_up', { strategy: 'GoogleStrategy' }));
|
|
|
return next();
|
|
return next();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -296,7 +296,7 @@ module.exports = function(crowi, app) {
|
|
|
const loginWithGitHub = function(req, res, next) {
|
|
const loginWithGitHub = function(req, res, next) {
|
|
|
if (!passportService.isGitHubStrategySetup) {
|
|
if (!passportService.isGitHubStrategySetup) {
|
|
|
debug('GitHubStrategy has not been set up');
|
|
debug('GitHubStrategy has not been set up');
|
|
|
- req.flash('warningMessage', 'GitHubStrategy has not been set up');
|
|
|
|
|
|
|
+ req.flash('warningMessage', req.t('message.strategy_has_not_been_set_up', { strategy: 'GitHubStrategy' }));
|
|
|
return next();
|
|
return next();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -338,7 +338,7 @@ module.exports = function(crowi, app) {
|
|
|
const loginWithTwitter = function(req, res, next) {
|
|
const loginWithTwitter = function(req, res, next) {
|
|
|
if (!passportService.isTwitterStrategySetup) {
|
|
if (!passportService.isTwitterStrategySetup) {
|
|
|
debug('TwitterStrategy has not been set up');
|
|
debug('TwitterStrategy has not been set up');
|
|
|
- req.flash('warningMessage', 'TwitterStrategy has not been set up');
|
|
|
|
|
|
|
+ req.flash('warningMessage', req.t('message.strategy_has_not_been_set_up', { strategy: 'TwitterStrategy' }));
|
|
|
return next();
|
|
return next();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -380,7 +380,7 @@ module.exports = function(crowi, app) {
|
|
|
const loginWithOidc = function(req, res, next) {
|
|
const loginWithOidc = function(req, res, next) {
|
|
|
if (!passportService.isOidcStrategySetup) {
|
|
if (!passportService.isOidcStrategySetup) {
|
|
|
debug('OidcStrategy has not been set up');
|
|
debug('OidcStrategy has not been set up');
|
|
|
- req.flash('warningMessage', 'OidcStrategy has not been set up');
|
|
|
|
|
|
|
+ req.flash('warningMessage', req.t('message.strategy_has_not_been_set_up', { strategy: 'OidcStrategy' }));
|
|
|
return next();
|
|
return next();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -428,7 +428,7 @@ module.exports = function(crowi, app) {
|
|
|
const loginWithSaml = function(req, res, next) {
|
|
const loginWithSaml = function(req, res, next) {
|
|
|
if (!passportService.isSamlStrategySetup) {
|
|
if (!passportService.isSamlStrategySetup) {
|
|
|
debug('SamlStrategy has not been set up');
|
|
debug('SamlStrategy has not been set up');
|
|
|
- req.flash('warningMessage', 'SamlStrategy has not been set up');
|
|
|
|
|
|
|
+ req.flash('warningMessage', req.t('message.strategy_has_not_been_set_up', { strategy: 'SamlStrategy' }));
|
|
|
return next();
|
|
return next();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -496,7 +496,7 @@ module.exports = function(crowi, app) {
|
|
|
const loginWithBasic = async(req, res, next) => {
|
|
const loginWithBasic = async(req, res, next) => {
|
|
|
if (!passportService.isBasicStrategySetup) {
|
|
if (!passportService.isBasicStrategySetup) {
|
|
|
debug('BasicStrategy has not been set up');
|
|
debug('BasicStrategy has not been set up');
|
|
|
- req.flash('warningMessage', 'Basic has not been set up');
|
|
|
|
|
|
|
+ req.flash('warningMessage', req.t('message.strategy_has_not_been_set_up', { strategy: 'Basic' }));
|
|
|
return next();
|
|
return next();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -587,7 +587,7 @@ module.exports = function(crowi, app) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
else if (err.name === 'UserUpperLimitException') {
|
|
else if (err.name === 'UserUpperLimitException') {
|
|
|
- req.flash('warningMessage', 'Can not register more than the maximum number of users.');
|
|
|
|
|
|
|
+ req.flash('warningMessage', req.t('message.maximum_number_of_users'));
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
/* eslint-enable no-else-return */
|
|
/* eslint-enable no-else-return */
|