From 38f89cb1441376da77b35b08158db9405aad738b Mon Sep 17 00:00:00 2001 From: Joram Wilander Date: Fri, 6 Jan 2017 09:00:21 -0500 Subject: Fix MFA enforcement redirect loop (#4991) --- webapp/routes/route_root.jsx | 25 +++---------------------- webapp/routes/route_team.jsx | 5 +++++ webapp/routes/route_utils.jsx | 26 ++++++++++++++++++++++++++ 3 files changed, 34 insertions(+), 22 deletions(-) diff --git a/webapp/routes/route_root.jsx b/webapp/routes/route_root.jsx index f72e35302..cd0cb9a5d 100644 --- a/webapp/routes/route_root.jsx +++ b/webapp/routes/route_root.jsx @@ -13,7 +13,6 @@ import helpRoute from 'routes/route_help.jsx'; import BrowserStore from 'stores/browser_store.jsx'; import ErrorStore from 'stores/error_store.jsx'; -import UserStore from 'stores/user_store.jsx'; import * as UserAgent from 'utils/user_agent.jsx'; import {browserHistory} from 'react-router/es6'; @@ -31,28 +30,10 @@ function preLogin(nextState, replace, callback) { callback(); } -const mfaPaths = [ - '/mfa/setup', - '/mfa/confirm' -]; - -const mfaAuthServices = [ - '', - 'email', - 'ldap' -]; - function preLoggedIn(nextState, replace, callback) { - if (window.mm_license.MFA === 'true' && - window.mm_config.EnableMultifactorAuthentication === 'true' && - window.mm_config.EnforceMultifactorAuthentication === 'true' && - mfaPaths.indexOf(nextState.location.pathname) === -1) { - const user = UserStore.getCurrentUser(); - if (user && !user.mfa_active && - mfaAuthServices.indexOf(user.auth_service) !== -1) { - browserHistory.push('/mfa/setup'); - return; - } + if (RouteUtils.checkIfMFARequired(nextState)) { + browserHistory.push('/mfa/setup'); + return; } ErrorStore.clearLastError(); diff --git a/webapp/routes/route_team.jsx b/webapp/routes/route_team.jsx index 8416b91c0..4cc85c81b 100644 --- a/webapp/routes/route_team.jsx +++ b/webapp/routes/route_team.jsx @@ -61,6 +61,11 @@ function doChannelChange(state, replace, callback) { } function preNeedsTeam(nextState, replace, callback) { + if (RouteUtils.checkIfMFARequired(nextState)) { + browserHistory.push('/mfa/setup'); + return; + } + // First check to make sure you're in the current team // for the current url. const teamName = nextState.params.team; diff --git a/webapp/routes/route_utils.jsx b/webapp/routes/route_utils.jsx index f3a159cbc..f36d7bcd8 100644 --- a/webapp/routes/route_utils.jsx +++ b/webapp/routes/route_utils.jsx @@ -2,6 +2,7 @@ // See License.txt for license information. import * as Utils from 'utils/utils.jsx'; +import UserStore from 'stores/user_store.jsx'; export function importComponentSuccess(callback) { return (comp) => callback(null, comp.default); @@ -18,3 +19,28 @@ export const notFoundParams = { linkmessage: Utils.localizeMessage('error.not_found.link_message', 'Back to Mattermost') }; +const mfaPaths = [ + '/mfa/setup', + '/mfa/confirm' +]; + +const mfaAuthServices = [ + '', + 'email', + 'ldap' +]; + +export function checkIfMFARequired(state) { + if (window.mm_license.MFA === 'true' && + window.mm_config.EnableMultifactorAuthentication === 'true' && + window.mm_config.EnforceMultifactorAuthentication === 'true' && + mfaPaths.indexOf(state.location.pathname) === -1) { + const user = UserStore.getCurrentUser(); + if (user && !user.mfa_active && + mfaAuthServices.indexOf(user.auth_service) !== -1) { + return true; + } + } + + return false; +} -- cgit v1.2.3-1-g7c22 From b79ce19aea91c2846aea2d35487d5ab9a79597e6 Mon Sep 17 00:00:00 2001 From: Joram Wilander Date: Fri, 6 Jan 2017 09:00:30 -0500 Subject: Temporary fix for JS errors when logging out with non-english language (#4990) --- webapp/actions/global_actions.jsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/webapp/actions/global_actions.jsx b/webapp/actions/global_actions.jsx index c6b796983..8542a0c92 100644 --- a/webapp/actions/global_actions.jsx +++ b/webapp/actions/global_actions.jsx @@ -487,10 +487,9 @@ export function clientLogout(redirectTo = '/') { UserStore.clear(); TeamStore.clear(); ChannelStore.clear(); - newLocalizationSelected(global.window.mm_config.DefaultClientLocale); stopPeriodicStatusUpdates(); WebsocketActions.close(); - browserHistory.push(redirectTo); + window.location.href = redirectTo; } export function emitSearchMentionsEvent(user) { -- cgit v1.2.3-1-g7c22 From af01229ed8317225a36a5602e513cb112eafd768 Mon Sep 17 00:00:00 2001 From: enahum Date: Fri, 6 Jan 2017 11:00:37 -0300 Subject: Fix JS error by updating janus client (#4988) --- webapp/non_npm_dependencies/janus/index.js | 32 +++++------------------------- 1 file changed, 5 insertions(+), 27 deletions(-) diff --git a/webapp/non_npm_dependencies/janus/index.js b/webapp/non_npm_dependencies/janus/index.js index 688cfc202..b4b88761b 100644 --- a/webapp/non_npm_dependencies/janus/index.js +++ b/webapp/non_npm_dependencies/janus/index.js @@ -1,30 +1,3 @@ -/* - The MIT License (MIT) - - Copyright (c) 2016 Meetecho - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the "Software"), - to deal in the Software without restriction, including without limitation - the rights to use, copy, modify, merge, publish, distribute, sublicense, - and/or sell copies of the Software, and to permit persons to whom the - Software is furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - OTHER DEALINGS IN THE SOFTWARE. - */ - -var adapter = require('webrtc-adapter'); - -// List of sessions /* The MIT License (MIT) @@ -49,6 +22,8 @@ var adapter = require('webrtc-adapter'); OTHER DEALINGS IN THE SOFTWARE. */ +var adapter = require('webrtc-adapter'); + // List of sessions Janus.sessions = {}; @@ -849,6 +824,7 @@ function Janus(gatewayCallbacks) { callbacks.consentDialog = (typeof callbacks.consentDialog == "function") ? callbacks.consentDialog : Janus.noop; callbacks.mediaState = (typeof callbacks.mediaState == "function") ? callbacks.mediaState : Janus.noop; callbacks.webrtcState = (typeof callbacks.webrtcState == "function") ? callbacks.webrtcState : Janus.noop; + callbacks.slowLink = (typeof callbacks.slowLink == "function") ? callbacks.slowLink : Janus.noop; callbacks.onmessage = (typeof callbacks.onmessage == "function") ? callbacks.onmessage : Janus.noop; callbacks.onlocalstream = (typeof callbacks.onlocalstream == "function") ? callbacks.onlocalstream : Janus.noop; callbacks.onremotestream = (typeof callbacks.onremotestream == "function") ? callbacks.onremotestream : Janus.noop; @@ -929,6 +905,7 @@ function Janus(gatewayCallbacks) { consentDialog : callbacks.consentDialog, mediaState : callbacks.mediaState, webrtcState : callbacks.webrtcState, + slowLink : callbacks.slowLink, onmessage : callbacks.onmessage, createOffer : function(callbacks) { prepareWebrtc(handleId, callbacks); }, createAnswer : function(callbacks) { prepareWebrtc(handleId, callbacks); }, @@ -1010,6 +987,7 @@ function Janus(gatewayCallbacks) { consentDialog : callbacks.consentDialog, mediaState : callbacks.mediaState, webrtcState : callbacks.webrtcState, + slowLink : callbacks.slowLink, onmessage : callbacks.onmessage, createOffer : function(callbacks) { prepareWebrtc(handleId, callbacks); }, createAnswer : function(callbacks) { prepareWebrtc(handleId, callbacks); }, -- cgit v1.2.3-1-g7c22 From bc08cc0ca5638957371aa6184ec0d11c9df16264 Mon Sep 17 00:00:00 2001 From: George Goldberg Date: Fri, 6 Jan 2017 14:02:37 +0000 Subject: PLT-4096 fix error/panic on replying to integrations. (#4968) --- api/post.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/api/post.go b/api/post.go index 354fe35db..e66a51295 100644 --- a/api/post.go +++ b/api/post.go @@ -624,9 +624,10 @@ func sendNotifications(c *Context, post *model.Post, team *model.Team, channel * list := result.Data.(*model.PostList) for _, threadPost := range list.Posts { - profile := profileMap[threadPost.UserId] - if profile.NotifyProps["comments"] == "any" || (profile.NotifyProps["comments"] == "root" && threadPost.Id == list.Order[0]) { - mentionedUserIds[threadPost.UserId] = true + if profile, ok := profileMap[threadPost.UserId]; ok { + if profile.NotifyProps["comments"] == "any" || (profile.NotifyProps["comments"] == "root" && threadPost.Id == list.Order[0]) { + mentionedUserIds[threadPost.UserId] = true + } } } } -- cgit v1.2.3-1-g7c22 From 3076a5c4bde25bb49c4114cb5dcef68cbad3a32c Mon Sep 17 00:00:00 2001 From: George Goldberg Date: Fri, 6 Jan 2017 14:03:02 +0000 Subject: Add missing targets to docs links. (#4978) --- webapp/components/admin_console/policy_settings.jsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/webapp/components/admin_console/policy_settings.jsx b/webapp/components/admin_console/policy_settings.jsx index 50b9d4033..0e224af73 100644 --- a/webapp/components/admin_console/policy_settings.jsx +++ b/webapp/components/admin_console/policy_settings.jsx @@ -146,7 +146,11 @@ export default class PolicySettings extends AdminSettings { defaultMessage='Set policy on who can delete public channels. Deleted channels can be recovered from the database using a {commandLineToolLink}.' values={{ commandLineToolLink: ( - + + Date: Fri, 6 Jan 2017 14:03:11 +0000 Subject: PLT-4614 Fix ordering of channels. (#4980) --- webapp/utils/channel_utils.jsx | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/webapp/utils/channel_utils.jsx b/webapp/utils/channel_utils.jsx index 50573e077..ffc69d7b4 100644 --- a/webapp/utils/channel_utils.jsx +++ b/webapp/utils/channel_utils.jsx @@ -76,10 +76,21 @@ export function completeDirectChannelInfo(channel) { }); } +const defaultPrefix = 'D'; // fallback for future types +const typeToPrefixMap = {[Constants.OPEN_CHANNEL]: 'A', [Constants.PRIVATE_CHANNEL]: 'B', [Constants.DM_CHANNEL]: 'C'}; + export function sortChannelsByDisplayName(a, b) { const locale = LocalizationStore.getLocale(); - return buildDisplayNameAndTypeComparable(a).localeCompare(buildDisplayNameAndTypeComparable(b), locale, {numeric: true}); + if (a.type !== b.type) { + return (typeToPrefixMap[a.type] || defaultPrefix).localeCompare((typeToPrefixMap[b.type] || defaultPrefix), locale); + } + + if (a.display_name !== b.display_name) { + return a.display_name.localeCompare(b.display_name, locale, {numeric: true}); + } + + return a.name.localeCompare(b.name, locale, {numeric: true}); } export function showCreateOption(channelType, isAdmin, isSystemAdmin) { @@ -200,10 +211,3 @@ function not(f) { function andX(...fns) { return (...args) => fns.every((f) => f(...args)); } - -const defaultPrefix = 'D'; // fallback for future types -const typeToPrefixMap = {[Constants.OPEN_CHANNEL]: 'A', [Constants.PRIVATE_CHANNEL]: 'B', [Constants.DM_CHANNEL]: 'C'}; - -function buildDisplayNameAndTypeComparable(channel) { - return (typeToPrefixMap[channel.type] || defaultPrefix) + channel.display_name + channel.name; -} -- cgit v1.2.3-1-g7c22 From 28d07758fc77591a08ebc4f8a0c5696eda8935d5 Mon Sep 17 00:00:00 2001 From: Asaad Mahmood Date: Fri, 6 Jan 2017 19:04:11 +0500 Subject: Bug fixes for search and direct messages (#4986) * PLT-5145 - Fixing search popover on mobile * PLT-5093 - Fixing direct messages list height --- webapp/components/channel_members_modal.jsx | 4 +-- webapp/components/more_channels.jsx | 16 +++++---- webapp/components/more_direct_channels.jsx | 6 ++-- webapp/components/search_bar.jsx | 12 +++---- webapp/components/searchable_channel_list.jsx | 6 ++-- webapp/sass/components/_modal.scss | 51 +++++++++------------------ webapp/sass/components/_popover.scss | 5 ++- webapp/sass/responsive/_mobile.scss | 45 +++++++++++------------ webapp/sass/routes/_admin-console.scss | 51 +++++++++++++-------------- 9 files changed, 93 insertions(+), 103 deletions(-) diff --git a/webapp/components/channel_members_modal.jsx b/webapp/components/channel_members_modal.jsx index 9f6a2a2eb..351efed96 100644 --- a/webapp/components/channel_members_modal.jsx +++ b/webapp/components/channel_members_modal.jsx @@ -168,7 +168,7 @@ export default class ChannelMembersModal extends React.Component { return (