From dcdd41c7cec7f2306a54d1fb7c3529eea640dbe3 Mon Sep 17 00:00:00 2001 From: Andrew Rodrigues Date: Tue, 19 Mar 2019 14:23:53 -0400 Subject: [PATCH 01/15] fix: #7454 --- public/src/admin/modules/colorpicker.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/public/src/admin/modules/colorpicker.js b/public/src/admin/modules/colorpicker.js index c219df634f..6000c416d6 100644 --- a/public/src/admin/modules/colorpicker.js +++ b/public/src/admin/modules/colorpicker.js @@ -20,6 +20,10 @@ define('admin/modules/colorpicker', function () { $(colpkr).css('z-index', 1051); }, }); + + $(window).one('action:ajaxify.start', function () { + $this.ColorPickerHide(); + }); }); }; From c37b2f2ed3ed488cc6ff3b058e2599612cca3543 Mon Sep 17 00:00:00 2001 From: Andrew Rodrigues Date: Tue, 19 Mar 2019 14:56:31 -0400 Subject: [PATCH 02/15] fix: #7378 --- public/src/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/src/app.js b/public/src/app.js index 7bf56166b6..05945d0cf3 100644 --- a/public/src/app.js +++ b/public/src/app.js @@ -134,9 +134,9 @@ app.cacheBuster = null; // Re-render top bar menu var toRender = { + 'slideout-menu': $('.slideout-menu'), menu: $('#header-menu .container'), 'chats-menu': $('#chats-menu'), - 'slideout-menu': $('.slideout-menu'), }; Promise.all(Object.keys(toRender).map(function (tpl) { return Benchpress.render('partials/' + tpl, data.header).then(function (render) { From c289b904e69cad24c1079b5164261ee6163b9e2c Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Tue, 19 Mar 2019 15:42:33 -0400 Subject: [PATCH 03/15] fix: #7473 --- public/src/admin/settings/email.js | 14 ++++++++------ src/socket.io/meta.js | 7 ++++++- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/public/src/admin/settings/email.js b/public/src/admin/settings/email.js index 336abf34fa..3e3fdc1280 100644 --- a/public/src/admin/settings/email.js +++ b/public/src/admin/settings/email.js @@ -87,18 +87,20 @@ define('admin/settings/email', ['ace/ace', 'admin/settings'], function (ace) { return app.alertError(err.message); } - now = new Date(now); + var date = new Date(now.timestamp); + var offset = (new Date().getTimezoneOffset() - now.offset) / 60; + date.setHours(date.getHours() + offset); - $('#serverTime').text(now.toString()); + $('#serverTime').text(date.toLocaleTimeString()); - now.setHours(parseInt(hour, 10), 0, 0, 0); + date.setHours(parseInt(hour, 10) - offset, 0, 0, 0); // If adjusted time is in the past, move to next day - if (now.getTime() < Date.now()) { - now.setDate(now.getDate() + 1); + if (date.getTime() < Date.now()) { + date.setDate(date.getDate() + 1); } - $('#nextDigestTime').text(now.toString()); + $('#nextDigestTime').text(date.toLocaleString()); }); } diff --git a/src/socket.io/meta.js b/src/socket.io/meta.js index 398bf249f5..e9cd3f00e4 100644 --- a/src/socket.io/meta.js +++ b/src/socket.io/meta.js @@ -62,7 +62,12 @@ function leaveCurrentRoom(socket) { SocketMeta.getServerTime = function (socket, data, callback) { // Returns server time in milliseconds - callback(null, Date.now()); + const now = new Date(); + + callback(null, { + timestamp: now.getTime(), + offset: now.getTimezoneOffset(), + }); }; module.exports = SocketMeta; From 1f4db132d5231608ef190696c9809ae572a1fdb1 Mon Sep 17 00:00:00 2001 From: Andrew Rodrigues Date: Tue, 19 Mar 2019 16:12:29 -0400 Subject: [PATCH 04/15] chore: bump persona --- install/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install/package.json b/install/package.json index 2b6221eafd..f6ae36e60d 100644 --- a/install/package.json +++ b/install/package.json @@ -90,7 +90,7 @@ "nodebb-plugin-spam-be-gone": "0.6.1", "nodebb-rewards-essentials": "0.0.13", "nodebb-theme-lavender": "5.0.9", - "nodebb-theme-persona": "9.1.27", + "nodebb-theme-persona": "9.1.28", "nodebb-theme-slick": "1.2.23", "nodebb-theme-vanilla": "10.1.25", "nodebb-widget-essentials": "4.0.14", @@ -171,4 +171,4 @@ "url": "https://github.com/barisusakli" } ] -} \ No newline at end of file +} From 240f563ab0b86ab446fa8a6c62e1f1087f77a9b4 Mon Sep 17 00:00:00 2001 From: Andrew Rodrigues Date: Wed, 20 Mar 2019 16:30:33 -0400 Subject: [PATCH 05/15] fix: #7477 --- src/controllers/authentication.js | 11 +++++++++-- src/controllers/index.js | 7 ++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/controllers/authentication.js b/src/controllers/authentication.js index 56f7f12287..eda407de46 100644 --- a/src/controllers/authentication.js +++ b/src/controllers/authentication.js @@ -273,13 +273,20 @@ function continueLogin(req, res, next) { if (passwordExpiry && passwordExpiry < Date.now()) { winston.verbose('[auth] Triggering password reset for uid ' + userData.uid + ' due to password policy'); req.session.passwordExpired = true; - user.reset.generate(userData.uid, function (err, code) { + + async.series({ + code: async.apply(user.reset.generate, userData.uid), + buildHeader: async.apply(middleware.buildHeader, req, res), + header: async.apply(middleware.generateHeader, req, res, {}), + }, function (err, payload) { if (err) { return helpers.noScriptErrors(req, res, err.message, 403); } res.status(200).send({ - next: nconf.get('relative_path') + '/reset/' + code, + next: nconf.get('relative_path') + '/reset/' + payload.code, + header: payload.header, + config: res.locals.config, }); }); } else { diff --git a/src/controllers/index.js b/src/controllers/index.js index 494b0e9f02..b074072258 100644 --- a/src/controllers/index.js +++ b/src/controllers/index.js @@ -62,10 +62,11 @@ Controllers.reset = function (req, res, next) { }; if (req.params.code) { - // Save to session and redirect + // Save to session req.session.reset_code = req.params.code; - res.redirect(nconf.get('relative_path') + '/reset'); - } else if (req.session.reset_code) { + } + + if (req.session.reset_code) { // Validate and save to local variable before removing from session user.reset.validate(req.session.reset_code, function (err, valid) { if (err) { From 24dcae21932e8d01c5df072ea5a6b3330e5a8b39 Mon Sep 17 00:00:00 2001 From: Andrew Rodrigues Date: Wed, 20 Mar 2019 16:34:22 -0400 Subject: [PATCH 06/15] feat: manual password expiry. closes #7471 --- public/language/en-GB/admin/manage/users.json | 3 +++ public/src/admin/manage/users.js | 13 +++++++++++++ src/socket.io/admin/user.js | 19 +++++++++++++++++++ src/views/admin/manage/users.tpl | 1 + 4 files changed, 36 insertions(+) diff --git a/public/language/en-GB/admin/manage/users.json b/public/language/en-GB/admin/manage/users.json index 6a17cbf016..05fc3f043f 100644 --- a/public/language/en-GB/admin/manage/users.json +++ b/public/language/en-GB/admin/manage/users.json @@ -6,6 +6,7 @@ "validate-email": "Validate Email", "send-validation-email": "Send Validation Email", "password-reset-email": "Send Password Reset Email", + "force-password-reset": "Force Password Reset & Log User Out", "ban": "Ban User(s)", "temp-ban": "Ban User(s) Temporarily", "unban": "Unban User(s)", @@ -81,7 +82,9 @@ "alerts.confirm-remove-moderator": "Do you really want to remove this moderator?", "alerts.remove-moderator-success": "User is no longer moderator.", "alerts.confirm-validate-email": "Do you want to validate email(s) of these user(s)?", + "alerts.confirm-force-password-reset": "Are you sure you want to force the password reset and log out these user(s)?", "alerts.validate-email-success": "Emails validated", + "alerts.validate-force-password-reset-success": "User(s) passwords have been reset and their existing sessions have been revoked.", "alerts.password-reset-confirm": "Do you want to send password reset email(s) to these user(s)?", "alerts.confirm-delete": "Warning!
Do you really want to delete user(s)?
This action is not reversable! Only the user account will be deleted, their posts and topics will remain.", "alerts.delete-success": "User(s) Deleted!", diff --git a/public/src/admin/manage/users.js b/public/src/admin/manage/users.js index 9efb1807be..73e33b391b 100644 --- a/public/src/admin/manage/users.js +++ b/public/src/admin/manage/users.js @@ -175,6 +175,19 @@ define('admin/manage/users', ['translator', 'benchpress'], function (translator, }); }); + $('.force-password-reset').on('click', function () { + var uids = getSelectedUids(); + if (!uids.length) { + return; + } + + bootbox.confirm('[[admin/manage/users:alerts.confirm-force-password-reset]]', function (confirm) { + if (confirm) { + socket.emit('admin.user.forcePasswordReset', uids, done('[[admin/manage/users:alerts.validate-force-password-reset-success]]')); + } + }); + }); + $('.delete-user').on('click', function () { var uids = getSelectedUids(); if (!uids.length) { diff --git a/src/socket.io/admin/user.js b/src/socket.io/admin/user.js index efd193ede0..02ade56a89 100644 --- a/src/socket.io/admin/user.js +++ b/src/socket.io/admin/user.js @@ -126,6 +126,25 @@ User.sendPasswordResetEmail = function (socket, uids, callback) { }, callback); }; +User.forcePasswordReset = function (socket, uids, callback) { + if (!Array.isArray(uids)) { + return callback(new Error('[[error:invalid-data]]')); + } + + uids = uids.filter(uid => parseInt(uid, 10)); + + async.each(uids, function (uid, next) { + async.waterfall([ + function (next) { + user.setUserField(uid, 'passwordExpiry', Date.now(), next); + }, + function (next) { + user.auth.revokeAllSessions(uid, next); + }, + ], next); + }, callback); +}; + User.deleteUsers = function (socket, uids, callback) { deleteUsers(socket, uids, function (uid, next) { user.deleteAccount(uid, next); diff --git a/src/views/admin/manage/users.tpl b/src/views/admin/manage/users.tpl index 1490c8b1c4..4b65102352 100644 --- a/src/views/admin/manage/users.tpl +++ b/src/views/admin/manage/users.tpl @@ -11,6 +11,7 @@
  • [[admin/manage/users:validate-email]]
  • [[admin/manage/users:send-validation-email]]
  • [[admin/manage/users:password-reset-email]]
  • +
  • [[admin/manage/users:force-password-reset]]
  • [[admin/manage/users:ban]]
  • [[admin/manage/users:temp-ban]]
  • From 6bed51ef1cab2fe675c159dd7bca6234c937e163 Mon Sep 17 00:00:00 2001 From: Andrew Rodrigues Date: Wed, 20 Mar 2019 21:12:34 -0400 Subject: [PATCH 07/15] chore: comment cleanup --- src/controllers/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/controllers/index.js b/src/controllers/index.js index b074072258..f4d082067a 100644 --- a/src/controllers/index.js +++ b/src/controllers/index.js @@ -62,7 +62,6 @@ Controllers.reset = function (req, res, next) { }; if (req.params.code) { - // Save to session req.session.reset_code = req.params.code; } From 148ccb6165516344f2273bda3075e9599f6648f8 Mon Sep 17 00:00:00 2001 From: "Misty (Bot)" Date: Fri, 22 Mar 2019 09:27:47 +0000 Subject: [PATCH 08/15] Latest translations and fallbacks --- .../language/ja/admin/manage/privileges.json | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/public/language/ja/admin/manage/privileges.json b/public/language/ja/admin/manage/privileges.json index 5e6d451b67..0db45acc4b 100644 --- a/public/language/ja/admin/manage/privileges.json +++ b/public/language/ja/admin/manage/privileges.json @@ -1,26 +1,26 @@ { - "global": "Global", - "global.no-users": "No user-specific global privileges.", + "global": "グローバル", + "global.no-users": "ユーザー固有のグローバル特権はありません。", - "chat": "Chat", - "upload-images": "Upload Images", - "upload-files": "Upload Files", - "signature": "Signature", + "chat": "チャット", + "upload-images": "画像をアップロード", + "upload-files": "ファイルをアップロード", + "signature": "署名", "ban": "Ban", - "search-content": "Search Content", - "search-users": "Search Users", - "search-tags": "Search Tags", - "view-users": "View Users", - "view-tags": "View Tags", - "view-groups": "View Groups", - "allow-local-login": "Local Login", - "allow-group-creation": "Group Create", + "search-content": "コンテンツを検索", + "search-users": "ユーザー検索", + "search-tags": "タグ検索", + "view-users": "ユーザーを表示", + "view-tags": "タグを表示", + "view-groups": "グループを表示", + "allow-local-login": "ローカルログイン", + "allow-group-creation": "グループを作成", - "find-category": "Find Category", - "access-category": "Access Category", - "access-topics": "Access Topics", - "create-topics": "Create Topics", - "reply-to-topics": "Reply to Topics", + "find-category": "カテゴリを検索", + "access-category": "カテゴリにアクセス", + "access-topics": "トピックスにアクセス", + "create-topics": "トピックスを作成", + "reply-to-topics": "トピックスに返信", "tag-topics": "Tag Topics", "edit-posts": "Edit Posts", "view-edit-history": "View Edit History", From cead89f0ba818168cc00590944ada2a9e9719ce9 Mon Sep 17 00:00:00 2001 From: Andrew Rodrigues Date: Fri, 22 Mar 2019 13:01:16 -0400 Subject: [PATCH 09/15] fix: #7342 --- src/views/admin/extend/plugins.tpl | 53 +++++++++++++++--------------- 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/src/views/admin/extend/plugins.tpl b/src/views/admin/extend/plugins.tpl index cbf44febf8..795c404656 100644 --- a/src/views/admin/extend/plugins.tpl +++ b/src/views/admin/extend/plugins.tpl @@ -20,7 +20,32 @@
    -
    +
    +
    +
    [[admin/extend/plugins:plugin-search]]
    +
    +
    +
    +
    + +
    +
    [[admin/extend/plugins:reorder-plugins]]
    +
    + +
    +
    + +
    +
    [[admin/extend/plugins:dev-interested]]
    +
    +

    + [[admin/extend/plugins:docs-info]] +

    +
    +
    +
    + +
      @@ -48,32 +73,6 @@
    -
    -
    -
    [[admin/extend/plugins:plugin-search]]
    -
    -
    -
    -
    - -
    -
    [[admin/extend/plugins:reorder-plugins]]
    -
    - -
    -
    - -
    -
    [[admin/extend/plugins:dev-interested]]
    -
    -

    - [[admin/extend/plugins:docs-info]] -

    -
    -
    -
    - -