Skip to content

Commit

Permalink
prettier style
Browse files Browse the repository at this point in the history
  • Loading branch information
NikkiWines committed Sep 29, 2023
1 parent 4b08ced commit 4308871
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 27 deletions.
2 changes: 1 addition & 1 deletion src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ const CONST = {
CUSTOM_STATUS: 'customStatus',
NEW_DOT_CATEGORIES: 'newDotCategories',
NEW_DOT_TAGS: 'newDotTags',
NEW_DOT_SAML: 'newDotSAML'
NEW_DOT_SAML: 'newDotSAML',
},
BUTTON_STATES: {
DEFAULT: 'default',
Expand Down
2 changes: 1 addition & 1 deletion src/SCREENS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ export default {
SIGN_IN_WITH_APPLE_DESKTOP: 'AppleSignInDesktop',
SIGN_IN_WITH_GOOGLE_DESKTOP: 'GoogleSignInDesktop',
DESKTOP_SIGN_IN_REDIRECT: 'DesktopSignInRedirect',
SAML_SIGN_IN: 'SAMLSignIN'
SAML_SIGN_IN: 'SAMLSignIN',
} as const;
2 changes: 1 addition & 1 deletion src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ export default {
useSingleSignOn: 'Use single sign-on',
useMagicCode: 'Use magic code',
launching: 'Launching...',
oneMoment: 'One moment while we redirect you to your company\'s single sign-on portal.',
oneMoment: "One moment while we redirect you to your company's single sign-on portal.",
},
reportActionCompose: {
addAction: 'Actions',
Expand Down
2 changes: 1 addition & 1 deletion src/pages/signin/SAMLEnabledForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const defaultProps = {
account: {},
};

function SAMLEnabledForm (props) {
function SAMLEnabledForm(props) {
return (
<>
<View>
Expand Down
7 changes: 3 additions & 4 deletions src/pages/signin/SAMLSignInPage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,14 @@ const propTypes = {
login: PropTypes.string,
}),
...withLocalizePropTypes,
}
};
const defaultProps = {
credentials: {},
};

function SAMLSignInPage(props) {
useEffect(() => {
window.open(`${CONFIG.EXPENSIFY.SAML_URL}?email=${props.credentials.login}&referer=${CONFIG.EXPENSIFY.EXPENSIFY_CASH_REFERER}`, '_self')

window.open(`${CONFIG.EXPENSIFY.SAML_URL}?email=${props.credentials.login}&referer=${CONFIG.EXPENSIFY.EXPENSIFY_CASH_REFERER}`, '_self');
}, [props.credentials.login]);

return (
Expand Down Expand Up @@ -61,7 +60,7 @@ function SAMLSignInPage(props) {
SAMLSignInPage.propTypes = propTypes;
SAMLSignInPage.defaultProps = defaultProps;

export default compose (
export default compose(
withLocalize,
withOnyx({
credentials: {key: ONYXKEYS.CREDENTIALS},
Expand Down
39 changes: 21 additions & 18 deletions src/pages/signin/SignInPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,19 +129,26 @@ function SignInPage({credentials, account, isInModal}) {
App.setLocale(Localize.getDevicePreferredLocale());
}, []);

const {shouldShowLoginForm, shouldShowEmailDeliveryFailurePage, shouldShowUnlinkLoginForm, shouldShowValidateCodeForm, shouldShowSAMLEnabledForm, shouldInitiateSAMLLogin, shouldShowWelcomeHeader, shouldShowWelcomeText} = getRenderOptions(
{
hasLogin: Boolean(credentials.login),
hasValidateCode: Boolean(credentials.validateCode),
hasAccount: !_.isEmpty(account),
isPrimaryLogin: !account.primaryLogin || account.primaryLogin === credentials.login,
isAccountValidated: Boolean(account.validated),
isSAMLEnabled: Boolean(account.isSAMLEnabled),
isSAMLRequired: Boolean(account.isSAMLRequired),
isUsingSAMLLogin,
hasEmailDeliveryFailure: Boolean(account.hasEmailDeliveryFailure),
},
);
const {
shouldShowLoginForm,
shouldShowEmailDeliveryFailurePage,
shouldShowUnlinkLoginForm,
shouldShowValidateCodeForm,
shouldShowSAMLEnabledForm,
shouldInitiateSAMLLogin,
shouldShowWelcomeHeader,
shouldShowWelcomeText,
} = getRenderOptions({
hasLogin: Boolean(credentials.login),
hasValidateCode: Boolean(credentials.validateCode),
hasAccount: !_.isEmpty(account),
isPrimaryLogin: !account.primaryLogin || account.primaryLogin === credentials.login,
isAccountValidated: Boolean(account.validated),
isSAMLEnabled: Boolean(account.isSAMLEnabled),
isSAMLRequired: Boolean(account.isSAMLRequired),
isUsingSAMLLogin,
hasEmailDeliveryFailure: Boolean(account.hasEmailDeliveryFailure),
});

// If the user has SAML required and we're not already loading their account
// bypass the rest of the sign in logic and open up their SSO provider login page
Expand Down Expand Up @@ -215,11 +222,7 @@ function SignInPage({credentials, account, isInModal}) {
/>
)}
{shouldShowUnlinkLoginForm && <UnlinkLoginForm />}
{shouldShowSAMLEnabledForm && (
<SAMLEnabledForm
setIsUsingSAMLLogin={setIsUsingSAMLLogin}
/>
)}
{shouldShowSAMLEnabledForm && <SAMLEnabledForm setIsUsingSAMLLogin={setIsUsingSAMLLogin} />}
{shouldShowEmailDeliveryFailurePage && <EmailDeliveryFailurePage />}
</SignInPageLayout>
</View>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/signin/ValidateCodeForm/BaseValidateCodeForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ function BaseValidateCodeForm(props) {
*/
const clearSignInData = () => {
// Reset the user's preference for signing in with SAML
props.setIsUsingSAMLLogin(props.account.isSAMLEnabled || props.account.isSAMLRequired)
props.setIsUsingSAMLLogin(props.account.isSAMLEnabled || props.account.isSAMLRequired);
clearLocalSignInData();
Session.clearSignInData();
};
Expand Down

0 comments on commit 4308871

Please sign in to comment.