From 7f9875e2eb0036a4ddd97686e634f2f4cd9049fb Mon Sep 17 00:00:00 2001 From: Nikki Wines Date: Tue, 26 Sep 2023 15:25:57 +0800 Subject: [PATCH 01/44] add SAMLEnabledForm --- src/languages/en.ts | 5 ++ src/pages/signin/SAMLEnabledForm.js | 128 ++++++++++++++++++++++++++++ 2 files changed, 133 insertions(+) create mode 100644 src/pages/signin/SAMLEnabledForm.js diff --git a/src/languages/en.ts b/src/languages/en.ts index 1f6ce5c7298c..37f16229016a 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -359,6 +359,11 @@ export default { termsOfService: 'Terms of Service', privacy: 'Privacy', }, + samlSignIn: { + welcomeSAMLEnabled: 'Continue logging in with your company\'s Single Sign-On', + orContinueWithMagicCode: 'Or, optionally, your company allows signing in with a magic code', + useSingleSignOn: 'Use Single Sign-On', + useMagicCode: 'Use Magic Code', reportActionCompose: { addAction: 'Actions', dropToUpload: 'Drop to upload', diff --git a/src/pages/signin/SAMLEnabledForm.js b/src/pages/signin/SAMLEnabledForm.js new file mode 100644 index 000000000000..dad5b6c6dcb0 --- /dev/null +++ b/src/pages/signin/SAMLEnabledForm.js @@ -0,0 +1,128 @@ +import React, { useState } from 'react'; +import _ from 'underscore'; +import {View} from 'react-native'; +import {withOnyx} from 'react-native-onyx'; +import PropTypes from 'prop-types'; +import styles from '../../styles/styles'; +import ONYXKEYS from '../../ONYXKEYS'; +import compose from '../../libs/compose'; +import Text from '../../components/Text'; +import Button from '../../components/Button'; +import {withNetwork} from '../../components/OnyxProvider'; +import networkPropTypes from '../../components/networkPropTypes'; +import withLocalize, {withLocalizePropTypes} from '../../components/withLocalize'; +import withWindowDimensions, {windowDimensionsPropTypes} from '../../components/withWindowDimensions'; +import SAMLSignInPage from './SAMLSignInPage'; +import * as Session from '../../libs/actions/Session'; +import ChangeExpensifyLoginLink from './ChangeExpensifyLoginLink'; +import Terms from './Terms'; +import CONST from '../../CONST'; +import ValidateCodeForm from './ValidateCodeForm'; +import ROUTES from '../../ROUTES'; +import Navigation from '../../libs/Navigation/Navigation'; + +const propTypes = { + /* Onyx Props */ + + /** The credentials of the logged in person */ + credentials: PropTypes.shape({ + /** The email/phone the user logged in with */ + login: PropTypes.string, + }), + + /** The details about the account that the user is signing in with */ + account: PropTypes.shape({ + /** Whether or not a sign on form is loading (being submitted) */ + loading: PropTypes.bool, + }), + + /** Information about the network */ + network: networkPropTypes.isRequired, + + ...withLocalizePropTypes, + + ...windowDimensionsPropTypes, + +}; + +const defaultProps = { + credentials: {}, + account: {}, +}; + +function SAMLEnabledForm (props) { + + const [showSAMLSignInPage, setShowSAMLSignInPage] = useState(false); + const [showValidateCodeForm, setShowValidateCodeForm] = useState(false); + + return ( + <> + {!showSAMLSignInPage && !showValidateCodeForm && ( + <> + + + {props.translate('samlSignIn.welcomeSAMLEnabled')} + +