diff --git a/src/Routes.js b/src/Routes.js index 261d4578..0fa7ca4f 100644 --- a/src/Routes.js +++ b/src/Routes.js @@ -54,7 +54,7 @@ class RouteComponentRenderer extends Component { render() { const { route, match, location, staticContext, flattenedRoutes } = this.props; - const { component: RouteComponent } = route; + const { component: RouteComponent, authPage = 'SignupPage' } = route; const canShow = this.canShowComponent(); if (!canShow) { staticContext.forbidden = true; @@ -65,7 +65,10 @@ class RouteComponentRenderer extends Component { location={location} flattenedRoutes={flattenedRoutes} /> - : ; + : ; } } diff --git a/src/app.test.js b/src/app.test.js index a34f9162..ee59940a 100644 --- a/src/app.test.js +++ b/src/app.test.js @@ -60,7 +60,9 @@ describe('Application', () => { }); it('server renders redirects for pages that require authentication', () => { - const defaultAuthPath = '/signup'; + const loginPath = '/login'; + const signupPath = '/signup'; + const defaultAuthPath = signupPath; const urlRedirects = { '/l/new': defaultAuthPath, '/l/listing-title-slug/1234/new/description': defaultAuthPath, @@ -80,7 +82,7 @@ describe('Application', () => { '/account/contact-details': defaultAuthPath, '/account/payout-preferences': defaultAuthPath, '/account/security': defaultAuthPath, - '/email_verification': defaultAuthPath, + '/email_verification': loginPath, }; forEach(urlRedirects, (redirectPath, url) => { const context = {}; diff --git a/src/components/SearchMap/SearchMap.js b/src/components/SearchMap/SearchMap.js index 8b3447c0..f433484c 100644 --- a/src/components/SearchMap/SearchMap.js +++ b/src/components/SearchMap/SearchMap.js @@ -45,7 +45,6 @@ const MapWithGoogleMap = withGoogleMap(props => { const { center, listings, listingOpen, onListingClicked, onMapLoad, zoom } = props; const priceLabels = listings.reverse().map(listing => { - // if the listing is open, don't print price label if (listingOpen && listingOpen.id.uuid === listing.id.uuid) { return null; @@ -105,7 +104,6 @@ export class SearchMapComponent extends Component { } onMapClicked(e) { - // Close open listing popup / infobox, unless the click is attached to a price label const labelClicked = hasParentWithClassName(e.nativeEvent.target, PRICE_LABEL_HANDLE); if (this.state.listingOpen != null && !labelClicked) { diff --git a/src/containers/EmailVerificationPage/EmailVerificationPage.js b/src/containers/EmailVerificationPage/EmailVerificationPage.js index 497fa8a9..03958f4b 100644 --- a/src/containers/EmailVerificationPage/EmailVerificationPage.js +++ b/src/containers/EmailVerificationPage/EmailVerificationPage.js @@ -6,7 +6,7 @@ import { FormattedMessage, injectIntl, intlShape } from 'react-intl'; import * as propTypes from '../../util/propTypes'; import { PageLayout, Topbar } from '../../components'; import { EmailVerificationForm } from '../../containers'; -import { authenticationInProgress } from '../../ducks/Auth.duck'; +import { logout, authenticationInProgress } from '../../ducks/Auth.duck'; import { verify, verificationInProgress } from '../../ducks/EmailVerification.duck'; import { manageDisableScrolling, isScrollingDisabled } from '../../ducks/UI.duck'; import { parse } from '../../util/urlHelpers'; @@ -50,6 +50,8 @@ export const EmailVerificationPageComponent = props => { submitVerification, emailVerificationInProgress, verificationError, + location, + history, } = props; const title = intl.formatMessage({ id: 'EmailVerificationPage.title', @@ -102,7 +104,7 @@ EmailVerificationPageComponent.defaultProps = { verificationError: null, }; -const { bool, func, instanceOf, number } = PropTypes; +const { bool, func, instanceOf, number, object, shape, string } = PropTypes; EmailVerificationPageComponent.propTypes = { authInfoError: instanceOf(Error), @@ -118,6 +120,14 @@ EmailVerificationPageComponent.propTypes = { submitVerification: func.isRequired, emailVerificationInProgress: bool.isRequired, verificationError: instanceOf(Error), + + // from withRouter + history: object.isRequired, + location: shape({ + search: string, + }).isRequired, + + // from injectIntl intl: intlShape.isRequired, }; @@ -150,6 +160,7 @@ const mapStateToProps = state => { }; const mapDispatchToProps = dispatch => ({ + onLogout: () => dispatch(logout()), onManageDisableScrolling: (componentId, disableScrolling) => dispatch(manageDisableScrolling(componentId, disableScrolling)), submitVerification: ({ verificationToken }) => { diff --git a/src/routesConfiguration.js b/src/routesConfiguration.js index 46b28486..2dd3b39b 100644 --- a/src/routesConfiguration.js +++ b/src/routesConfiguration.js @@ -309,6 +309,7 @@ const routesConfiguration = [ { path: '/email_verification', auth: true, + authPage: 'LoginPage', exact: true, name: 'EmailVerificationPage', component: props => ,