mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-29 05:00:43 +10:00
Review comments fixed
This commit is contained in:
parent
7b5d5d5fab
commit
110b7b28c0
5 changed files with 35 additions and 13 deletions
|
|
@ -88,7 +88,7 @@ const {
|
|||
EmailVerificationFormComponent.propTypes = {
|
||||
...formPropTypes,
|
||||
inProgress: bool,
|
||||
currentUser: propTypes.currentUser,
|
||||
currentUser: propTypes.currentUser.isRequired,
|
||||
verificationError: instanceOf(Error),
|
||||
};
|
||||
const defaultFormName = 'EmailVerificationForm';
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
@import '../../marketplaceFonts.css';
|
||||
@import '../../marketplace.css';
|
||||
|
||||
.root {
|
||||
|
|
|
|||
|
|
@ -11,6 +11,29 @@ import { verify, verificationInProgress } from '../../ducks/EmailVerification.du
|
|||
import { manageDisableScrolling, isScrollingDisabled } from '../../ducks/UI.duck';
|
||||
import { parse } from '../../util/urlHelpers';
|
||||
import css from './EmailVerificationPage.css';
|
||||
|
||||
/**
|
||||
Parse verification token from URL
|
||||
|
||||
Returns stringified token, if the token is provided.
|
||||
|
||||
Returns `null` if verification token is not provided.
|
||||
|
||||
Please note that we need to explicitely stringify the token, because
|
||||
the unwanted result of the `parse` method is that it automatically
|
||||
parses the token to number.
|
||||
*/
|
||||
const parseVerificationToken = location => {
|
||||
const urlParams = parse(location.search);
|
||||
const verificationToken = urlParams.t;
|
||||
|
||||
if (verificationToken) {
|
||||
return `${verificationToken}`;
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
export const EmailVerificationPageComponent = props => {
|
||||
const {
|
||||
authInfoError,
|
||||
|
|
@ -25,16 +48,14 @@ export const EmailVerificationPageComponent = props => {
|
|||
onManageDisableScrolling,
|
||||
scrollingDisabled,
|
||||
submitVerification,
|
||||
verifInProgress,
|
||||
emailVerificationInProgress,
|
||||
verificationError,
|
||||
} = props;
|
||||
const title = intl.formatMessage({
|
||||
id: 'EmailVerificationPage.title',
|
||||
});
|
||||
|
||||
const urlParams = parse(location.search);
|
||||
|
||||
const initialValues = { verificationToken: urlParams.t };
|
||||
const initialValues = { verificationToken: parseVerificationToken(location) };
|
||||
|
||||
return (
|
||||
<PageLayout
|
||||
|
|
@ -62,7 +83,7 @@ export const EmailVerificationPageComponent = props => {
|
|||
initialValues={initialValues}
|
||||
onSubmit={submitVerification}
|
||||
currentUser={currentUser}
|
||||
inProgress={verifInProgress}
|
||||
inProgress={emailVerificationInProgress}
|
||||
verificationError={verificationError}
|
||||
/>
|
||||
: <FormattedMessage id="EmailVerificationPage.loadingUserInformation" />}
|
||||
|
|
@ -80,7 +101,9 @@ EmailVerificationPageComponent.defaultProps = {
|
|||
notificationCount: 0,
|
||||
verificationError: null,
|
||||
};
|
||||
|
||||
const { bool, func, instanceOf, number } = PropTypes;
|
||||
|
||||
EmailVerificationPageComponent.propTypes = {
|
||||
authInfoError: instanceOf(Error),
|
||||
authInProgress: bool.isRequired,
|
||||
|
|
@ -93,10 +116,11 @@ EmailVerificationPageComponent.propTypes = {
|
|||
onManageDisableScrolling: func.isRequired,
|
||||
scrollingDisabled: bool.isRequired,
|
||||
submitVerification: func.isRequired,
|
||||
verifInProgress: bool.isRequired,
|
||||
emailVerificationInProgress: bool.isRequired,
|
||||
verificationError: instanceOf(Error),
|
||||
intl: intlShape.isRequired,
|
||||
};
|
||||
|
||||
const mapStateToProps = state => {
|
||||
const {
|
||||
authInfoError,
|
||||
|
|
@ -114,7 +138,7 @@ const mapStateToProps = state => {
|
|||
return {
|
||||
authInfoError,
|
||||
authInProgress: authenticationInProgress(state),
|
||||
verifInProgress: verificationInProgress(state),
|
||||
emailVerificationInProgress: verificationInProgress(state),
|
||||
verificationError,
|
||||
currentUser,
|
||||
currentUserHasListings,
|
||||
|
|
|
|||
|
|
@ -61,9 +61,8 @@ export const verify = verificationToken =>
|
|||
|
||||
// Note that the thunk does not reject when the verification fails, it
|
||||
// just dispatches the login error action.
|
||||
const verifyParams = { verificationToken: `${verificationToken}` };
|
||||
return sdk.users
|
||||
.verifyEmail(verifyParams)
|
||||
.verifyEmail({ verificationToken })
|
||||
.then(() => dispatch(verificationSuccess()))
|
||||
.then(() => dispatch(fetchCurrentUser()))
|
||||
.catch(e => dispatch(verificationError(e)));
|
||||
|
|
|
|||
|
|
@ -79,11 +79,11 @@
|
|||
"EditListingPricingForm.priceRequired": "You need to add a valid price.",
|
||||
"EditListingPricingPanel.title": "How much does it cost?",
|
||||
"EmailVerificationPage.title": "Verify your email address",
|
||||
"EmailVerificationPage.loadingUserInformation": "Loading user information...",
|
||||
"EmailVerificationPage.loadingUserInformation": "Loading user information…",
|
||||
"EmailVerificationForm.verifyEmailAddress": "Verify your email address",
|
||||
"EmailVerificationForm.finishAccountSetup": "To finish setting up your Saunatime account, we sent an email to {email} to make sure this email is yours.",
|
||||
"EmailVerificationForm.verify": "Verify my email",
|
||||
"EmailVerificationForm.verifying": "Verifying...",
|
||||
"EmailVerificationForm.verifying": "Verifying…",
|
||||
"EmailVerificationForm.emailVerified": "Your email address is verified",
|
||||
"EmailVerificationForm.yourEmailAddressIsVerified": "Your email address {email} is verified.",
|
||||
"EmailVerificationForm.okHomepage": "Ok, got it. Take me to the homepage",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue