From 30a16d0bc1917bdf40e3fd17ed202761914eb2e9 Mon Sep 17 00:00:00 2001 From: Elias Nahum Date: Wed, 30 Mar 2022 12:13:37 -0300 Subject: [PATCH] [v1] Skip LoginOptions if only one SSO method is enabled (#6097) * Skip LoginOptions if only one SSO method is enabled * feedback review --- app/constants/index.js | 2 + app/constants/sso.ts | 21 ++++++++++ app/screens/login_options/login_options.js | 15 ++++--- .../login_options/login_options.test.js | 14 +------ app/screens/select_server/select_server.js | 40 +++++++++++++------ app/screens/sso/index.tsx | 21 ++++------ app/screens/sso/sso.test.tsx | 33 +-------------- app/screens/sso/sso_with_redirect_url.tsx | 9 +++-- package-lock.json | 26 ++++++------ test/setup.js | 4 +- 10 files changed, 89 insertions(+), 96 deletions(-) create mode 100644 app/constants/sso.ts diff --git a/app/constants/index.js b/app/constants/index.js index 4b5351208..d245bb192 100644 --- a/app/constants/index.js +++ b/app/constants/index.js @@ -9,6 +9,7 @@ import DeepLinkTypes from './deep_linking'; import DeviceTypes from './device'; import ListTypes from './list'; import NavigationTypes from './navigation'; +import Sso from './sso'; import Types from './types'; import ViewTypes from './view'; import WebsocketEvents from './websocket'; @@ -21,6 +22,7 @@ export { DateTypes, ListTypes, NavigationTypes, + Sso, Types, ViewTypes, WebsocketEvents, diff --git a/app/constants/sso.ts b/app/constants/sso.ts new file mode 100644 index 000000000..249b608d3 --- /dev/null +++ b/app/constants/sso.ts @@ -0,0 +1,21 @@ +// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +import keyMirror from '@mm-redux/utils/key_mirror'; + +export const REDIRECT_URL_SCHEME = 'mmauth://'; +export const REDIRECT_URL_SCHEME_DEV = 'mmauthbeta://'; + +const constants = keyMirror({ + SAML: null, + GITLAB: null, + GOOGLE: null, + OFFICE365: null, + OPENID: null, +}); + +export default { + ...constants, + REDIRECT_URL_SCHEME, + REDIRECT_URL_SCHEME_DEV, +}; diff --git a/app/screens/login_options/login_options.js b/app/screens/login_options/login_options.js index 0b6e2f176..9d0638681 100644 --- a/app/screens/login_options/login_options.js +++ b/app/screens/login_options/login_options.js @@ -20,9 +20,8 @@ import gitlab from '@assets/images/gitlab.png'; import google from '@assets/images/google.png'; import FormattedText from '@components/formatted_text'; import StatusBar from '@components/status_bar'; -import {ViewTypes} from '@constants'; +import {Sso} from '@constants'; import globalEventHandler from '@init/global_event_handler'; -import {isMinimumServerVersion} from '@mm-redux/utils/helpers'; import {preventDoubleTap} from '@utils/tap'; import {GlobalStyles} from 'app/styles'; @@ -172,7 +171,7 @@ export default class LoginOptions extends PureComponent { return (