diff --git a/client/blocks/login/continue-as-user.scss b/client/blocks/login/continue-as-user.scss index b4a71d4d1c08..9ee21fb7a818 100644 --- a/client/blocks/login/continue-as-user.scss +++ b/client/blocks/login/continue-as-user.scss @@ -55,3 +55,12 @@ width: 100%; } } + +.is-white-login { + .continue-as-user { + height: auto; + } + .continue-as-user__not-you { + position: static; + } +} \ No newline at end of file diff --git a/client/blocks/login/index.jsx b/client/blocks/login/index.jsx index 1d9b56967627..41e8e06869e8 100644 --- a/client/blocks/login/index.jsx +++ b/client/blocks/login/index.jsx @@ -1,34 +1,24 @@ -import config from '@automattic/calypso-config'; import page from '@automattic/calypso-router'; import { localizeUrl } from '@automattic/i18n-utils'; import clsx from 'clsx'; import emailValidator from 'email-validator'; import { localize } from 'i18n-calypso'; -import { capitalize, get, isEmpty, startsWith } from 'lodash'; +import { get, isEmpty, startsWith } from 'lodash'; import PropTypes from 'prop-types'; import { Component, Fragment } from 'react'; import { connect } from 'react-redux'; -import A4APlusWpComLogo from 'calypso/a8c-for-agencies/components/a4a-plus-wpcom-logo'; -import VisitSite from 'calypso/blocks/visit-site'; import AsyncLoad from 'calypso/components/async-load'; -import GravatarLoginLogo from 'calypso/components/gravatar-login-logo'; -import JetpackPlusWpComLogo from 'calypso/components/jetpack-plus-wpcom-logo'; import Notice from 'calypso/components/notice'; -import WooCommerceConnectCartHeader from 'calypso/components/woocommerce-connect-cart-header'; -import WPCloudLogo from 'calypso/components/wp-cloud-logo'; import wooDnaConfig from 'calypso/jetpack-connect/woo-dna-config'; import isAkismetRedirect from 'calypso/lib/akismet/is-akismet-redirect'; -import { preventWidows } from 'calypso/lib/formatting'; import getGravatarOAuth2Flow from 'calypso/lib/get-gravatar-oauth2-flow'; -import { getPluginTitle, getSignupUrl } from 'calypso/lib/login'; +import { getSignupUrl } from 'calypso/lib/login'; import { - isCrowdsignalOAuth2Client, isJetpackCloudOAuth2Client, isA4AOAuth2Client, isBlazeProOAuth2Client, isGravatarFlowOAuth2Client, isGravatarOAuth2Client, - isPartnerPortalOAuth2Client, } from 'calypso/lib/oauth2-clients'; import { login } from 'calypso/lib/paths'; import { isWebAuthnSupported } from 'calypso/lib/webauthn'; @@ -66,6 +56,7 @@ import isWooJPCFlow from 'calypso/state/selectors/is-woo-jpc-flow'; import ContinueAsUser from './continue-as-user'; import ErrorNotice from './error-notice'; import LoginForm from './login-form'; +import { LoginHeader } from './login-header'; import './style.scss'; @@ -337,413 +328,20 @@ class Login extends Component { return getSignupUrl( currentQuery, currentRoute, oauth2Client, locale, pathname ); }; - renderHeader() { - const { - action, - currentQuery, - fromSite, - isFromAkismet, - isFromMigrationPlugin, - isFromAutomatticForAgenciesPlugin, - isGravPoweredClient, - isGravPoweredLoginPage, - isJetpack, - isManualRenewalImmediateLoginAttempt, - isSignupExistingAccount, - isSocialFirst, - isWhiteLogin, - isWCCOM, - linkingSocialService, - oauth2Client, - socialConnect, - translate, - twoStepNonce, - wccomFrom, - isWooJPC, - twoFactorAuthType, - } = this.props; - - let headerText = translate( 'Log in to your account' ); - let preHeader = null; - let headerElement = null; - let postHeader = null; - const signupLink = this.getSignupLinkComponent(); - - if ( isSocialFirst ) { - headerText = translate( 'Log in to WordPress.com' ); - } - - if ( 'authenticator' === twoFactorAuthType ) { - headerText = translate( 'Continue with an authentication code' ); - } - - if ( 'push' === twoFactorAuthType ) { - headerText = translate( 'Continue with the Jetpack app' ); - } - - if ( 'backup' === twoFactorAuthType ) { - headerText = translate( 'Continue with a backup code' ); - } - - if ( isManualRenewalImmediateLoginAttempt ) { - headerText = translate( 'Log in to update your payment details and renew your subscription' ); - } - - if ( twoStepNonce ) { - headerText = translate( 'Two-Step Authentication' ); - } else if ( socialConnect ) { - headerText = translate( 'Connect your %(service)s account', { - args: { - service: capitalize( linkingSocialService ), - }, - } ); - } else if ( action === 'lostpassword' ) { - headerText =

{ translate( 'Forgot your password?' ) }

; - postHeader = ( -

- { translate( - 'It happens to the best of us. Enter the email address associated with your WordPress.com account and we’ll send you a link to reset your password.' - ) } - { isWooJPC && ( - -
- { translate( 'Don’t have an account? {{signupLink}}Sign up{{/signupLink}}', { - components: { - signupLink, - }, - } ) } -
- ) } -

- ); - if ( this.props.isBlazePro ) { - postHeader = ( -

- { translate( - 'It happens to the best of us. Enter the email address associated with your Blaze Pro account and we’ll send you a link to reset your password.' - ) } -

- ); - } - } else if ( oauth2Client ) { - headerText = translate( 'Howdy! Log in to %(clientTitle)s with your WordPress.com account.', { - args: { - clientTitle: oauth2Client.title, - }, - comment: - "'clientTitle' is the name of the app that uses WordPress.com authentication (e.g. 'Akismet' or 'VaultPress')", - } ); - - if ( isWCCOM ) { - if ( wccomFrom === 'cart' ) { - preHeader = ; - headerText = translate( 'Log in with a WordPress.com account' ); - postHeader = ( -

- { translate( - 'Log in to WooCommerce.com with your WordPress.com account to connect your store and manage your extensions' - ) } -

- ); - } else if ( this.props.twoFactorEnabled ) { - headerText =

{ translate( 'Authenticate your login' ) }

; - } else if ( currentQuery.lostpassword_flow ) { - headerText =

{ translate( 'Log in to your account' ) }

; - postHeader = ( -

- { translate( - "Your password reset confirmation is on its way to your email address – please check your junk folder if it's not in your inbox! Once you've reset your password, head back to this page to log in to your account." - ) } -

- ); - } else if ( this.showContinueAsUser() ) { - headerText = ( -

- { wccomFrom === 'nux' - ? translate( 'Get started in minutes' ) - : translate( 'Log in to your account' ) } -

- ); - postHeader = ( -

- { wccomFrom === 'nux' - ? translate( 'First, select the account you’d like to use.' ) - : translate( 'Select the account you’d like to use.' ) } -

- ); - } else { - headerText =

{ translate( 'Log in to your account' ) }

; - const poweredByWpCom = ( - <> - { translate( 'Log in with your WordPress.com account.' ) }{ ' ' } -
- - ); - - postHeader = ( -

- { poweredByWpCom } - { translate( "Don't have an account? {{signupLink}}Sign up{{/signupLink}}", { - components: { - signupLink, - br:
, - }, - } ) } -

- ); - } - } - - if ( isJetpackCloudOAuth2Client( oauth2Client ) ) { - headerText = translate( 'Howdy! Log in to Jetpack.com with your WordPress.com account.' ); - preHeader = ( -
- -
- ); - } - - if ( isA4AOAuth2Client( oauth2Client ) ) { - headerText = translate( - 'Howdy! Log in to Automattic for Agencies with your WordPress.com{{nbsp/}}account.', + renderLoginFormSignupNotice() { + return ( + + { this.props.translate( + 'This email address is already associated with an account. Please consider {{returnToSignup}}using another one{{/returnToSignup}} or log in.', { - components: { nbsp: <>  }, - comment: 'The {{nbsp/}} is a non-breaking space', + components: { + returnToSignup: ( + + ), + }, } - ); - preHeader = ( -
- -
- ); - } - - if ( isPartnerPortalOAuth2Client( oauth2Client ) ) { - if ( document.location.search?.includes( 'wpcloud' ) ) { - headerText = translate( 'Log in to WP Cloud with WordPress.com' ); - preHeader = ( -
- -
- ); - } else if ( document.location.search?.includes( 'jetpack' ) ) { - headerText = translate( - 'Howdy! Log into the Jetpack Partner Portal with your WordPress.com account.' - ); - preHeader = ( -
- -
- ); - } else { - headerText = translate( - 'Howdy! Log into the Automattic Partner Portal with your WordPress.com account.' - ); - } - } - - if ( isJetpackCloudOAuth2Client( oauth2Client ) || isA4AOAuth2Client( oauth2Client ) ) { - // If users arrived here from the lost password flow, show them a specific message about it - postHeader = currentQuery.lostpassword_flow && ( -

- { translate( - 'Check your e-mail address linked to the account for the confirmation link, including the spam or junk folder.' - ) } -

- ); - } - - if ( isCrowdsignalOAuth2Client( oauth2Client ) ) { - headerText = translate( 'Sign in to %(clientTitle)s', { - args: { - clientTitle: oauth2Client.title, - }, - } ); - } - - if ( isGravPoweredClient ) { - headerText = translate( 'Login to %(clientTitle)s', { - args: { clientTitle: oauth2Client.title }, - } ); - - if ( isGravPoweredLoginPage ) { - const isFromGravatar3rdPartyApp = - isGravatarOAuth2Client( oauth2Client ) && currentQuery?.gravatar_from === '3rd-party'; - const isFromGravatarQuickEditor = - isGravatarOAuth2Client( oauth2Client ) && - currentQuery?.gravatar_from === 'quick-editor'; - const isGravatarFlowWithEmail = !! ( - isGravatarFlowOAuth2Client( oauth2Client ) && currentQuery?.email_address - ); - - postHeader = ( -

- { isFromGravatar3rdPartyApp || isFromGravatarQuickEditor || isGravatarFlowWithEmail - ? translate( 'Please log in with your email and password.' ) - : translate( - 'If you prefer logging in with a password, or a social media account, choose below:' - ) } -

- ); - } - } - - if ( isBlazeProOAuth2Client( oauth2Client ) ) { - headerText =

{ translate( 'Log in to your Blaze Pro account' ) }

; - - postHeader = ( -

- { translate( "Don't have an account? {{signupLink}}Sign up here{{/signupLink}}", { - components: { signupLink }, - } ) } -

- ); - - if ( this.showContinueAsUser() ) { - postHeader = ( -

- { translate( 'Select the account you’d like to use' ) } -

- ); - } - } - } else if ( isWooJPC ) { - const isLostPasswordFlow = currentQuery.lostpassword_flow === 'true'; - const isTwoFactorAuthFlow = this.props.twoFactorEnabled; - const pluginName = getPluginTitle( - new URLSearchParams( this.props.initialQuery?.redirect_to ).get( 'plugin_name' ), - translate - ); - let subtitle = null; - - switch ( true ) { - case isLostPasswordFlow: - headerText =

{ translate( "You've got mail" ) }

; - - subtitle = translate( - "Your password reset confirmation is on its way to your email address – please check your junk folder if it's not in your inbox! Once you've reset your password, head back to this page to log in to your account." - ); - break; - case isTwoFactorAuthFlow: - headerText =

{ translate( 'Authenticate your login' ) }

; - break; - default: - headerText =

{ translate( 'Log in to your account' ) }

; - // pluginName is already translated with an "in" prefix in getPluginTitle. - subtitle = translate( - 'To access all of the features and functionality %(pluginName)s, you’ll first need to connect your store to a WordPress.com account. Log in now, or {{signupLink}}create a new account{{/signupLink}}. For more information, please {{doc}}review our documentation{{/doc}}.', - { - components: { - signupLink, - br:
, - doc: ( -
- ), - }, - args: { pluginName }, - } - ); - } - preHeader = null; - postHeader =

{ subtitle }

; - } else if ( isFromMigrationPlugin ) { - headerText = translate( 'Log in to your account' ); - } else if ( isJetpack && ! isFromAutomatticForAgenciesPlugin ) { - const isJetpackMagicLinkSignUpFlow = config.isEnabled( 'jetpack/magic-link-signup' ); - headerText = isJetpackMagicLinkSignUpFlow - ? translate( - 'Log in or create a WordPress.com account to supercharge your site with powerful growth, performance, and security tools.' - ) - : translate( 'Log in or create a WordPress.com account to set up Jetpack' ); - preHeader =

{ translate( 'Log in or sign up' ) }

; - headerElement =

{ headerText }

; - } else if ( fromSite ) { - // if redirected from Calypso URL with a site slug, offer a link to that site's frontend - postHeader = ; - } else if ( isSignupExistingAccount ) { - headerText = preventWidows( translate( 'Log in to your existing account' ) ); - } - - if ( - isWhiteLogin && - ! isBlazeProOAuth2Client( oauth2Client ) && - ! isPartnerPortalOAuth2Client( oauth2Client ) - ) { - preHeader = ( -
- -
- ); - } - - if ( isFromAkismet ) { - headerText = translate( 'Log in to Akismet with WordPress.com' ); - } - - if ( isFromAutomatticForAgenciesPlugin ) { - headerText = translate( 'Log in to Automattic for Agencies' ); - preHeader = ( - - - - - - - - - - - - - ); - } - - return ( -
- { isGravPoweredClient && ( - ) } - { ! isWhiteLogin && preHeader } - { headerElement ? headerElement :
{ headerText }
} - { postHeader } -
+
); } @@ -754,7 +352,7 @@ class Login extends Component { } const tos = translate( - 'Just a little reminder that by continuing with any of the options below, you agree to our {{tosLink}}Terms of Service{{/tosLink}} and have read our {{privacyLink}}Privacy Policy{{/privacyLink}}.', + 'By continuing you agree to our {{tosLink}}Terms of Service{{/tosLink}} and have read our {{privacyLink}}Privacy Policy{{/privacyLink}}.', { components: { tosLink: ( @@ -813,7 +411,6 @@ class Login extends Component { action, currentQuery, isGravPoweredClient, - isSignupExistingAccount, isSocialFirst, isFromAutomatticForAgenciesPlugin, currentUser, @@ -970,7 +567,6 @@ class Login extends Component { handleUsernameChange={ handleUsernameChange } signupUrl={ signupUrl } hideSignupLink={ isGravPoweredClient || isBlazePro } - isSignupExistingAccount={ isSignupExistingAccount } sendMagicLoginLink={ this.sendMagicLoginLink } isFromAkismet={ this.props.isFromAkismet } isSendingEmail={ this.props.isSendingEmail } @@ -998,6 +594,27 @@ class Login extends Component { locale, isWCCOM, isFromAutomatticForAgenciesPlugin, + action, + currentQuery, + fromSite, + isFromMigrationPlugin, + isGravPoweredClient, + isGravPoweredLoginPage, + isManualRenewalImmediateLoginAttempt, + isSignupExistingAccount, + isSocialFirst, + isWhiteLogin, + isBlazePro, + linkingSocialService, + socialConnect, + translate, + twoStepNonce, + wccomFrom, + isWooJPC, + twoFactorAuthType, + twoFactorEnabled, + initialQuery, + partnerSlug, } = this.props; return ( @@ -1010,18 +627,52 @@ class Login extends Component { 'is-a4a': isA4AOAuth2Client( oauth2Client ), } ) } > - { this.renderHeader() } + { ! isWhiteLogin && ( + + ) } + + { isSignupExistingAccount && this.renderLoginFormSignupNotice() } { /* For Woo, we render the ErrrorNotice component in login-form.jsx */ } { ! isWCCOM && } { this.renderNotice() } - { this.renderToS() } + { ! isWhiteLogin && this.renderToS() } { this.renderContent() } { this.renderFooter() } + + { isWhiteLogin && this.renderToS() } ); } diff --git a/client/blocks/login/login-form.jsx b/client/blocks/login/login-form.jsx index 6570203b8e40..333be7a4780c 100644 --- a/client/blocks/login/login-form.jsx +++ b/client/blocks/login/login-form.jsx @@ -100,7 +100,6 @@ export class LoginForm extends Component { showSocialLoginFormOnly: PropTypes.bool, currentQuery: PropTypes.object, hideSignupLink: PropTypes.bool, - isSignupExistingAccount: PropTypes.bool, sendMagicLoginLink: PropTypes.func, isSendingEmail: PropTypes.bool, cancelSocialAccountConnectLinking: PropTypes.func, @@ -352,23 +351,6 @@ export class LoginForm extends Component { ); } - renderLoginFromSignupNotice() { - return ( - - { this.props.translate( - 'This email address is already associated with an account. Please consider {{returnToSignup}}using another one{{/returnToSignup}} or log in.', - { - components: { - returnToSignup: ( - - ), - }, - } - ) } - - ); - } - onWooCommerceSocialSuccess = ( ...args ) => { this.recordWooCommerceLoginTracks( 'social' ); this.props.onSuccess( args ); @@ -778,7 +760,6 @@ export class LoginForm extends Component { isWoo, isBlazePro, hideSignupLink, - isSignupExistingAccount, isSendingEmail, isSocialFirst, isJetpack, @@ -876,8 +857,6 @@ export class LoginForm extends Component {

) } - { isSignupExistingAccount && this.renderLoginFromSignupNotice() } - { this.renderUsernameorEmailLabel() } ; + fromSite: string | null; + isFromAkismet: boolean; + isFromMigrationPlugin: boolean; + isFromAutomatticForAgenciesPlugin: boolean; + isGravPoweredClient: boolean; + isGravPoweredLoginPage: boolean; + isJetpack: boolean; + isManualRenewalImmediateLoginAttempt: boolean; + isSignupExistingAccount: boolean; + isSocialFirst: boolean; + isWhiteLogin: boolean; + isWCCOM: boolean; + isBlazePro: boolean; + linkingSocialService: string; + oauth2Client: { + title: string; + icon: string; + } | null; + socialConnect: boolean; + twoStepNonce: string | null; + wccomFrom: string; + isWooJPC: boolean; + twoFactorAuthType: string; + twoFactorEnabled: boolean; + initialQuery: { 'client-id': string; redirect_to: string } | null; + getSignupLinkComponent: () => JSX.Element; + showContinueAsUser: boolean; +} + +export function getHeaderText( + isSocialFirst: boolean, + twoFactorAuthType: string | null, + isManualRenewalImmediateLoginAttempt: boolean, + socialConnect: boolean, + linkingSocialService: string, + action: string, + oauth2Client: { title: string; icon: string } | null, + isWooJPC: boolean, + isFromMigrationPlugin: boolean, + isJetpack: boolean, + isWCCOM: boolean, + isFromAkismet: boolean, + isFromAutomatticForAgenciesPlugin: boolean, + isGravPoweredClient: boolean, + wccomFrom: string, + twoFactorEnabled: boolean, + currentQuery: Record< string, string >, + translate: ( arg0: string, arg1?: object ) => TranslateResult, + showContinueAsUser: boolean = false, + twoStepNonce: string | null = null +): TranslateResult { + let headerText = translate( 'Log in to your account' ); + + if ( isSocialFirst ) { + headerText = translate( 'Log in to WordPress.com' ); + } + + if ( twoFactorAuthType === 'authenticator' ) { + headerText = translate( 'Continue with an authentication code' ); + } + + if ( twoFactorAuthType === 'push' ) { + headerText = translate( 'Continue with the Jetpack app' ); + } else if ( twoFactorAuthType === 'backup' ) { + headerText = translate( 'Continue with a backup code' ); + } + + if ( isManualRenewalImmediateLoginAttempt ) { + headerText = translate( 'Log in to update your payment details and renew your subscription' ); + } + + if ( twoStepNonce ) { + headerText = translate( 'Two-Step Authentication' ); + } + + if ( socialConnect ) { + headerText = translate( 'Connect your %(service)s account', { + args: { + service: capitalize( linkingSocialService ), + }, + } ); + } + + if ( action === 'lostpassword' ) { + headerText = translate( 'Forgot your password?' ); + } + + if ( oauth2Client ) { + if ( isWCCOM ) { + if ( wccomFrom === 'cart' ) { + headerText = translate( 'Log in with a WordPress.com account' ); + } else if ( twoFactorEnabled ) { + headerText = translate( 'Authenticate your login' ); + } else if ( currentQuery.lostpassword_flow ) { + headerText = translate( 'Log in to your account' ); + } else if ( showContinueAsUser ) { + headerText = ( + <> + { wccomFrom === 'nux' + ? translate( 'Get started in minutes' ) + : translate( 'Log in to your account' ) } + + ); + } + headerText = translate( 'Log in to your account' ); + } + + if ( isJetpackCloudOAuth2Client( oauth2Client ) ) { + headerText = translate( 'Howdy! Log in to Jetpack.com with your WordPress.com account.' ); + } + + if ( isA4AOAuth2Client( oauth2Client ) ) { + headerText = translate( + 'Howdy! Log in to Automattic for Agencies with your WordPress.com{{nbsp/}}account.', + { + components: { nbsp: <>  }, + comment: 'The {{nbsp/}} is a non-breaking space', + } + ); + } + + if ( isPartnerPortalOAuth2Client( oauth2Client ) ) { + if ( document.location.search?.includes( 'wpcloud' ) ) { + headerText = translate( 'Log in to WP Cloud with WordPress.com' ); + } else if ( document.location.search?.includes( 'jetpack' ) ) { + headerText = translate( + 'Howdy! Log into the Jetpack Partner Portal with your WordPress.com account.' + ); + } else { + headerText = translate( + 'Howdy! Log into the Automattic Partner Portal with your WordPress.com account.' + ); + } + } + + if ( isCrowdsignalOAuth2Client( oauth2Client ) ) { + headerText = translate( 'Sign in to %(clientTitle)s', { + args: { + clientTitle: oauth2Client.title, + }, + } ); + } + + if ( isGravPoweredClient ) { + headerText = translate( 'Login to %(clientTitle)s', { + args: { clientTitle: oauth2Client.title }, + } ); + } + + if ( isBlazeProOAuth2Client( oauth2Client ) ) { + headerText = translate( 'Log in to your Blaze Pro account' ); + } + } + + if ( isWooJPC ) { + const isLostPasswordFlow = currentQuery.lostpassword_flow === 'true'; + switch ( true ) { + case isLostPasswordFlow: + headerText = translate( "You've got mail" ); + case twoFactorEnabled: + headerText = translate( 'Authenticate your login' ); + default: + headerText = translate( 'Log in to your account' ); + } + } + + if ( isFromMigrationPlugin ) { + headerText = translate( 'Log in to your account' ); + } + + if ( isJetpack && ! isFromAutomatticForAgenciesPlugin ) { + const isJetpackMagicLinkSignUpFlow = config.isEnabled( 'jetpack/magic-link-signup' ); + headerText = isJetpackMagicLinkSignUpFlow + ? translate( + 'Log in or create a WordPress.com account to supercharge your site with powerful growth, performance, and security tools.' + ) + : translate( 'Log in or create a WordPress.com account to set up Jetpack' ); + } + + if ( isFromAkismet ) { + headerText = translate( 'Log in to Akismet with WordPress.com' ); + } + + if ( isFromAutomatticForAgenciesPlugin ) { + headerText = translate( 'Log in to Automattic for Agencies' ); + } + + return headerText; +} + +export function LoginHeader( { + action, + currentQuery, + fromSite, + isFromAkismet, + isFromMigrationPlugin, + isFromAutomatticForAgenciesPlugin, + isGravPoweredClient, + isGravPoweredLoginPage, + isJetpack, + isManualRenewalImmediateLoginAttempt, + isSocialFirst, + isWhiteLogin, + isWCCOM, + isBlazePro, + linkingSocialService, + oauth2Client, + socialConnect, + twoStepNonce, + wccomFrom, + isWooJPC, + twoFactorAuthType, + twoFactorEnabled, + initialQuery, + getSignupLinkComponent, + showContinueAsUser, +}: LoginHeaderProps ) { + const translate = useTranslate(); + + const headerText = getHeaderText( + isSocialFirst, + twoFactorAuthType, + isManualRenewalImmediateLoginAttempt, + socialConnect, + linkingSocialService, + action, + oauth2Client, + isWooJPC, + isFromMigrationPlugin, + isJetpack, + isWCCOM, + isFromAkismet, + isFromAutomatticForAgenciesPlugin, + isGravPoweredClient, + wccomFrom, + twoFactorEnabled, + currentQuery, + translate, + showContinueAsUser, + twoStepNonce + ); + + let preHeader = null; + let header = null; + let postHeader = null; + const signupLink = getSignupLinkComponent(); + + if ( action === 'lostpassword' ) { + header =

{ headerText }

; + postHeader = ( +

+ { translate( + 'It happens to the best of us. Enter the email address associated with your WordPress.com account and we’ll send you a link to reset your password.' + ) } + { isWooJPC && ( + +
+ { translate( 'Don’t have an account? {{signupLink}}Sign up{{/signupLink}}', { + components: { + signupLink, + }, + } ) } +
+ ) } +

+ ); + if ( isBlazePro ) { + postHeader = ( +

+ { translate( + 'It happens to the best of us. Enter the email address associated with your Blaze Pro account and we’ll send you a link to reset your password.' + ) } +

+ ); + } + } else if ( oauth2Client ) { + if ( isWCCOM ) { + if ( wccomFrom === 'cart' ) { + preHeader = ; + postHeader = ( +

+ { translate( + 'Log in to WooCommerce.com with your WordPress.com account to connect your store and manage your extensions' + ) } +

+ ); + } else if ( twoFactorEnabled ) { + header =

{ headerText }

; + } else if ( currentQuery.lostpassword_flow ) { + header =

{ headerText }

; + postHeader = ( +

+ { translate( + "Your password reset confirmation is on its way to your email address – please check your junk folder if it's not in your inbox! Once you've reset your password, head back to this page to log in to your account." + ) } +

+ ); + } else if ( showContinueAsUser ) { + header =

{ headerText }

; + postHeader = ( +

+ { wccomFrom === 'nux' + ? translate( 'First, select the account you’d like to use.' ) + : translate( 'Select the account you’d like to use.' ) } +

+ ); + } else { + header =

{ headerText }

; + const poweredByWpCom = ( + <> + { translate( 'Log in with your WordPress.com account.' ) }{ ' ' } +
+ + ); + + postHeader = ( +

+ { poweredByWpCom } + { translate( "Don't have an account? {{signupLink}}Sign up{{/signupLink}}", { + components: { + signupLink, + br:
, + }, + } ) } +

+ ); + } + } + + if ( isJetpackCloudOAuth2Client( oauth2Client ) ) { + preHeader = ( +
+ +
+ ); + } + + if ( isA4AOAuth2Client( oauth2Client ) ) { + preHeader = ( +
+ +
+ ); + } + + if ( isPartnerPortalOAuth2Client( oauth2Client ) ) { + if ( document.location.search?.includes( 'wpcloud' ) ) { + preHeader = ( +
+ +
+ ); + } else if ( document.location.search?.includes( 'jetpack' ) ) { + preHeader = ( +
+ +
+ ); + } + } + + if ( isJetpackCloudOAuth2Client( oauth2Client ) || isA4AOAuth2Client( oauth2Client ) ) { + // If users arrived here from the lost password flow, show them a specific message about it + postHeader = currentQuery.lostpassword_flow && ( +

+ { translate( + 'Check your e-mail address linked to the account for the confirmation link, including the spam or junk folder.' + ) } +

+ ); + } + + if ( isGravPoweredClient ) { + if ( isGravPoweredLoginPage ) { + const isFromGravatar3rdPartyApp = + isGravatarOAuth2Client( oauth2Client ) && currentQuery?.gravatar_from === '3rd-party'; + const isFromGravatarQuickEditor = + isGravatarOAuth2Client( oauth2Client ) && currentQuery?.gravatar_from === 'quick-editor'; + const isGravatarFlowWithEmail = !! ( + isGravatarFlowOAuth2Client( oauth2Client ) && currentQuery?.email_address + ); + + postHeader = ( +

+ { isFromGravatar3rdPartyApp || isFromGravatarQuickEditor || isGravatarFlowWithEmail + ? translate( 'Please log in with your email and password.' ) + : translate( + 'If you prefer logging in with a password, or a social media account, choose below:' + ) } +

+ ); + } + } + + if ( isBlazeProOAuth2Client( oauth2Client ) ) { + header =

{ headerText }

; + + postHeader = ( +

+ { translate( "Don't have an account? {{signupLink}}Sign up here{{/signupLink}}", { + components: { signupLink }, + } ) } +

+ ); + + if ( showContinueAsUser ) { + postHeader = ( +

+ { translate( 'Select the account you’d like to use' ) } +

+ ); + } + } + } else if ( isWooJPC ) { + const isLostPasswordFlow = currentQuery.lostpassword_flow === 'true'; + const isTwoFactorAuthFlow = twoFactorEnabled; + const pluginName = getPluginTitle( + new URLSearchParams( initialQuery?.redirect_to ).get( 'plugin_name' ), + translate + ); + let subtitle = null; + + switch ( true ) { + case isLostPasswordFlow: + header =

{ headerText }

; + + subtitle = translate( + "Your password reset confirmation is on its way to your email address – please check your junk folder if it's not in your inbox! Once you've reset your password, head back to this page to log in to your account." + ); + break; + case isTwoFactorAuthFlow: + header =

{ headerText }

; + break; + default: + header =

{ headerText }

; + subtitle = translate( + 'To access all of the features and functionality %(pluginName)s, you’ll first need to connect your store to a WordPress.com account. Log in now, or {{signupLink}}create a new account{{/signupLink}}. For more information, please {{doc}}review our documentation{{/doc}}.', + { + components: { + signupLink, + br:
, + doc: ( +
+ ), + }, + args: { pluginName }, + } + ); + } + preHeader = null; + postHeader =

{ subtitle }

; + } else if ( isJetpack && ! isFromAutomatticForAgenciesPlugin ) { + preHeader =

{ translate( 'Log in or sign up' ) }

; + header =

{ headerText }

; + } else if ( fromSite ) { + // if redirected from Calypso URL with a site slug, offer a link to that site's frontend + postHeader = ; + } + if ( isFromAutomatticForAgenciesPlugin ) { + preHeader = ( + + + + + + + + + + + + + ); + } + + return ( +
+ { isGravPoweredClient && ( + + ) } + { ! isWhiteLogin && preHeader } +
{ header || headerText }
+ { postHeader } +
+ ); +} diff --git a/client/blocks/login/style.scss b/client/blocks/login/style.scss index 3f9d57797a01..f2992b5bb332 100644 --- a/client/blocks/login/style.scss +++ b/client/blocks/login/style.scss @@ -348,8 +348,7 @@ $breakpoint-mobile: 782px; //Mobile size. } .login__jetpack-plus-wpcom-logo, -.login__a4a-plus-wpcom-logo, -.login__wpcloud-logo { +.login__a4a-plus-wpcom-logo { margin: 40px 0 16px; } diff --git a/client/layout/logged-out.jsx b/client/layout/logged-out.jsx index 902cd463f834..c7c676abc8b2 100644 --- a/client/layout/logged-out.jsx +++ b/client/layout/logged-out.jsx @@ -351,7 +351,7 @@ export default withCurrentRoute( ! isJetpackLogin && Boolean( currentQuery?.client_id ) === false; const isPartnerPortal = isPartnerPortalOAuth2Client( oauth2Client ); - const isWhiteLogin = isWPComLogin || isGravatar || isGravPoweredClient || isPartnerPortal; + const isWhiteLogin = isWPComLogin || isPartnerPortal; const noMasterbarForRoute = isJetpackLogin || ( isWhiteLogin && ! isBlazePro ) || diff --git a/client/login/controller.js b/client/login/controller.js index a3c63f7062ed..6f04693e3750 100644 --- a/client/login/controller.js +++ b/client/login/controller.js @@ -65,7 +65,6 @@ const enhanceContextWithLogin = ( context ) => { const isWhiteLogin = ( ! isJetpackLogin && Boolean( clientId ) === false && Boolean( oauth2ClientId ) === false ) || - isGravPoweredClient || isPartnerPortalClient; context.primary = ( diff --git a/client/login/magic-login/index.jsx b/client/login/magic-login/index.jsx index 53874afa92b3..f92516c0b30a 100644 --- a/client/login/magic-login/index.jsx +++ b/client/login/magic-login/index.jsx @@ -1355,6 +1355,11 @@ class MagicLogin extends Component { ); } + const isWhiteLogin = + ! this.props.isWCCOM && + ! this.props.isFromAutomatticForAgenciesPlugin && + ! this.props.isJetpackLogin; + // If this is part of the Jetpack login flow and the `jetpack/magic-link-signup` feature // flag is enabled, some steps will display a different UI const requestLoginEmailFormProps = { @@ -1364,7 +1369,11 @@ class MagicLogin extends Component { }; return ( -
+
{ this.renderGutenboardingLogo() } { this.props.isFromAutomatticForAgenciesPlugin && ( diff --git a/client/login/wp-login/index.jsx b/client/login/wp-login/index.jsx index a5580ee065e2..39e91e9d6945 100644 --- a/client/login/wp-login/index.jsx +++ b/client/login/wp-login/index.jsx @@ -10,11 +10,13 @@ import PropTypes from 'prop-types'; import { Component } from 'react'; import { connect } from 'react-redux'; import LoginBlock from 'calypso/blocks/login'; +import { getHeaderText } from 'calypso/blocks/login/login-header'; import AutomatticLogo from 'calypso/components/automattic-logo'; import DocumentHead from 'calypso/components/data/document-head'; import LocaleSuggestions from 'calypso/components/locale-suggestions'; import LoggedOutFormBackLink from 'calypso/components/logged-out-form/back-link'; import Main from 'calypso/components/main'; +import WPCloudLogo from 'calypso/components/wp-cloud-logo'; import isAkismetRedirect from 'calypso/lib/akismet/is-akismet-redirect'; import { getSignupUrl, pathWithLeadingSlash } from 'calypso/lib/login'; import { @@ -26,6 +28,7 @@ import { isGravPoweredOAuth2Client, isBlazeProOAuth2Client, isWooOAuth2Client, + isPartnerPortalOAuth2Client, } from 'calypso/lib/oauth2-clients'; import { login, lostPassword } from 'calypso/lib/paths'; import { addQueryArgs } from 'calypso/lib/url'; @@ -34,6 +37,7 @@ import { recordTracksEventWithClientId as recordTracksEvent, enhanceWithSiteType, } from 'calypso/state/analytics/actions'; +import { wasManualRenewalImmediateLoginAttempted } from 'calypso/state/immediate-login/selectors'; import { getRedirectToOriginal } from 'calypso/state/login/selectors'; import { getCurrentOAuth2Client } from 'calypso/state/oauth2-clients/ui/selectors'; import getCurrentLocaleSlug from 'calypso/state/selectors/get-current-locale-slug'; @@ -524,13 +528,39 @@ export class Login extends Component { ); } - renderTopBar( isSocialFirst ) { - const { isFromAkismet, isJetpack, isWooJPC } = this.props; + render() { + const { + locale, + translate, + isFromMigrationPlugin, + isGenericOauth, + isGravPoweredClient, + isWoo, + isBlazePro, + isWhiteLogin, + isJetpack, + isFromAkismet, + twoFactorAuthType, + isManualRenewalImmediateLoginAttempt, + socialConnect, + linkingSocialService, + action, + oauth2Client, + isWooJPC, + isWCCOM, + isFromAutomatticForAgenciesPlugin, + currentQuery, + wccomFrom, + twoFactorEnabled, + } = this.props; - if ( isWooJPC ) { - // The Woo flow already displays the Woo logo in the header. - return null; - } + const canonicalUrl = localizeUrl( 'https://wordpress.com/log-in', locale ); + const isSocialFirst = + config.isEnabled( 'login/social-first' ) && + isWhiteLogin && + ! isGravPoweredClient && + ! isWoo && + ! isBlazePro; const akismetLogo = ( ); - if ( isJetpack && ! this.props.isFromAutomatticForAgenciesPlugin ) { - return jetpackLogo; - } - - if ( isSocialFirst ) { - return ( - + { this.renderI18nSuggestions() } + + - ); - } - return null; - } +
{ this.renderContent( isSocialFirst ) }
+
+ ); - render() { - const { - locale, - translate, + const headerText = getHeaderText( + isSocialFirst, + twoFactorAuthType, + isManualRenewalImmediateLoginAttempt, + socialConnect, + linkingSocialService, + action, + oauth2Client, + isWooJPC, isFromMigrationPlugin, - isGenericOauth, - isGravPoweredClient, - isWoo, - isBlazePro, - isWhiteLogin, isJetpack, - } = this.props; - const canonicalUrl = localizeUrl( 'https://wordpress.com/log-in', locale ); - const isSocialFirst = - config.isEnabled( 'login/social-first' ) && - isWhiteLogin && - ! isGravPoweredClient && - ! isWoo && - ! isBlazePro; + isWCCOM, + isFromAkismet, + isFromAutomatticForAgenciesPlugin, + isGravPoweredClient, + wccomFrom, + twoFactorEnabled, + currentQuery, + translate + ); - return ( - <> - { this.renderTopBar( isSocialFirst ) } -
- { this.renderI18nSuggestions() } - - + let brandLogo; -
{ this.renderContent( isSocialFirst ) }
-
+ if ( isFromAkismet ) { + brandLogo = akismetLogo; + } else if ( + isPartnerPortalOAuth2Client( oauth2Client ) && + document.location.search?.includes( 'wpcloud' ) + ) { + brandLogo = ; + } + return ( + <> + { isWhiteLogin && ( + + } + heading={ } + verticalAlign="center" + > + { mainContent } + + ) } + { ! isWooJPC && isJetpack && ! this.props.isFromAutomatticForAgenciesPlugin && jetpackLogo } + { ! isWhiteLogin && mainContent } { this.renderFooter() } ); @@ -679,6 +720,7 @@ export default connect( 'automattic-for-agencies-client' === get( getCurrentQueryArguments( state ), 'from' ) || 'automattic-for-agencies-client' === new URLSearchParams( getRedirectToOriginal( state )?.split( '?' )[ 1 ] ).get( 'from' ), + isManualRenewalImmediateLoginAttempt: wasManualRenewalImmediateLoginAttempted( state ), }; }, { diff --git a/client/login/wp-login/style.scss b/client/login/wp-login/style.scss index 84b8e183f913..4633f4c9915b 100644 --- a/client/login/wp-login/style.scss +++ b/client/login/wp-login/style.scss @@ -10,10 +10,16 @@ $image-height: 47px; .layout.is-section-login { - padding-bottom: $image-height; position: relative; - min-height: calc(100% - #{$image-height}); + min-height: 100%; // Needed for any screen not yet using a StepContainerV2 wireframe (e.g. magic login). + // This adjustment is only necessary when rendering the Jetpack colophon. + // isWhiteLogin screens don't need it. + &:where(:not(.is-white-login)) { + padding-bottom: $image-height; + min-height: calc(100% - #{$image-height}); + } + .layout__content { position: static; } @@ -437,14 +443,7 @@ $image-height: 47px; } .wp-login__main.is-social-first { - max-width: 758px; - margin-top: 24px; - padding-left: 20px; - padding-right: 20px; - - @include break-medium { - margin-top: 20.5vh; - } + max-width: none; .wp-login__header-navigation { align-items: center; @@ -496,11 +495,6 @@ $image-height: 47px; text-align: center; text-decoration: underline; text-underline-offset: 5px; - margin-top: 24px; - - @include break-mobile { - margin-top: 40px; - } } } @@ -617,10 +611,6 @@ $image-height: 47px; } } - .login__form-gutenboarding-wordpress-logo { - display: none; - } - .layout__content { padding: 0; } @@ -684,6 +674,7 @@ $image-height: 47px; > .card { padding: 0; border: 0; + box-shadow: none; } } @@ -731,6 +722,8 @@ $image-height: 47px; .login__form-terms { color: rgba(#00101c, 0.6); margin: 24px 0 0; + font-size: 0.875rem; + text-align: left; } button.form-button.is-primary, @@ -935,26 +928,3 @@ $image-height: 47px; --login-form-column-max-width: 327px; } -@include break-mobile { - :root { - --login-form-column-max-width: 600px; - } -} - -@include break-small { - :root { - --login-form-column-max-width: 327px; - } -} - -@include break-medium { - :root { - --login-form-column-max-width: 350px; - } -} - -@include break-large { - :root { - --login-form-column-max-width: 327px; - } -}