From 2479a34c56ed34cf42dc2e219ab156902fbd289c Mon Sep 17 00:00:00 2001 From: barisusakli Date: Mon, 16 Jun 2014 14:13:50 -0400 Subject: [PATCH] closes #1710, closes #1700 --- public/language/en_GB/notifications.json | 2 +- src/controllers/api.js | 1 + src/user.js | 15 +++++++++++---- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/public/language/en_GB/notifications.json b/public/language/en_GB/notifications.json index 10f56b6cfc..c6e16c9f55 100644 --- a/public/language/en_GB/notifications.json +++ b/public/language/en_GB/notifications.json @@ -3,7 +3,7 @@ "no_notifs": "You have no new notifications", "see_all": "See all Notifications", - "back_to_home": "Back to NodeBB", + "back_to_home": "Back to %1", "outgoing_link": "Outgoing Link", "outgoing_link_message": "You are now leaving", "continue_to": "Continue to", diff --git a/src/controllers/api.js b/src/controllers/api.js index ef355cbd51..78140bae9d 100644 --- a/src/controllers/api.js +++ b/src/controllers/api.js @@ -13,6 +13,7 @@ apiController.getConfig = function(req, res, next) { var config = {}; config.relative_path = serverConfig.relative_path; config.version = pkg.version; + config.siteTitle = meta.config.title || meta.config.browserTitle || 'NodeBB'; config.postDelay = meta.config.postDelay; config.minimumTitleLength = meta.config.minimumTitleLength; config.maximumTitleLength = meta.config.maximumTitleLength; diff --git a/src/user.js b/src/user.js index e751b5b69e..36e6e9e862 100644 --- a/src/user.js +++ b/src/user.js @@ -155,22 +155,29 @@ var bcrypt = require('bcryptjs'), }, exists: function(next) { db.exists('user:' + uid, next); + }, + isAdmin: function(next) { + User.isAdministrator(uid, next); } }, function(err, results) { if (err) { return callback(err); } + if (!results.exists) { + return callback(new Error('[[error:no-user]]')); + } + + if (results.isAdmin) { + return callback(); + } + var userData = results.userData; if (parseInt(userData.banned, 10) === 1) { return callback(new Error('[[error:user-banned]]')); } - if (!results.exists) { - return callback(new Error('[[error:no-user]]')); - } - if (userData.email && parseInt(meta.config.requireEmailConfirmation, 10) === 1 && parseInt(userData['email:confirmed'], 10) !== 1) { return callback(new Error('[[error:email-not-confirmed]]')); }