Skip to content

Commit eb05fa0

Browse files
committed
https://github.com/NodeBB/NodeBB/issues/13047
1 parent 5af445a commit eb05fa0

File tree

3 files changed

+558
-155
lines changed

3 files changed

+558
-155
lines changed

lib/controllers.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@ const base64url = require('base64url');
1414
const groups = require.main.require('./src/groups');
1515
const user = require.main.require('./src/user');
1616
const meta = require.main.require('./src/meta');
17-
const translator = require.main.require('./src/translator');
1817
const helpers = require.main.require('./src/controllers/helpers');
1918

20-
const Controllers = {};
19+
const Controllers = module.exports;
2120

2221

2322
async function getGroups(set) {
@@ -206,7 +205,6 @@ Controllers.renderSettings = async (req, res) => {
206205
return helpers.notAllowed(req, res);
207206
}
208207

209-
const title = await translator.translate('[[2factor:title]]');
210208
const breadcrumbs = helpers.buildBreadcrumbs([
211209
{
212210
text: username,
@@ -229,7 +227,7 @@ Controllers.renderSettings = async (req, res) => {
229227
const hasAuthn = await parent.hasAuthn(req.user.uid);
230228
res.render('account/2factor', {
231229
...res.locals.userData,
232-
title,
230+
title: '[[2factor:title]]',
233231
breadcrumbs,
234232
forceTfa,
235233
hasTotp,
@@ -250,5 +248,3 @@ Controllers.renderAccessNotificationHelp = (req, res, next) => {
250248
dateString: date.toLocaleDateString(date),
251249
});
252250
};
253-
254-
module.exports = Controllers;

library.js

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ const groups = require.main.require('./src/groups');
1616
const plugins = require.main.require('./src/plugins');
1717
const notifications = require.main.require('./src/notifications');
1818
const utils = require.main.require('./src/utils');
19-
const translator = require.main.require('./src/translator');
2019
const routeHelpers = require.main.require('./src/routes/helpers');
2120
const controllerHelpers = require.main.require('./src/controllers/helpers');
2221
const SocketPlugins = require.main.require('./src/socket.io/plugins');
@@ -195,35 +194,32 @@ plugin.appendConfig = async (config) => {
195194
};
196195

197196
plugin.addAdminNavigation = function (header, callback) {
198-
translator.translate('[[2factor:title]]', (title) => {
199-
header.plugins.push({
200-
route: '/plugins/2factor',
201-
icon: 'fa-lock',
202-
name: title,
203-
});
204-
205-
callback(null, header);
197+
header.plugins.push({
198+
route: '/plugins/2factor',
199+
icon: 'fa-lock',
200+
name: '[[2factor:title]]',
206201
});
202+
203+
callback(null, header);
207204
};
208205

209206
plugin.addProfileItem = function (data, callback) {
210-
translator.translate('[[2factor:title]]', (title) => {
211-
data.links.push({
212-
id: '2factor',
213-
route: '2factor',
214-
icon: 'fa-lock',
215-
name: title,
216-
visibility: {
217-
self: true,
218-
other: false,
219-
moderator: false,
220-
globalMod: false,
221-
admin: false,
222-
},
223-
});
224-
225-
callback(null, data);
207+
data.links.push({
208+
id: '2factor',
209+
route: '2factor',
210+
icon: 'fa-lock',
211+
name: '[[2factor:title]]',
212+
visibility: {
213+
self: true,
214+
other: false,
215+
moderator: false,
216+
globalMod: false,
217+
admin: false,
218+
canViewInfo: false,
219+
},
226220
});
221+
222+
callback(null, data);
227223
};
228224

229225
plugin.get = async uid => db.getObjectField('2factor:uid:key', uid);

0 commit comments

Comments
 (0)