diff --git a/locale/defaultMessages.json b/locale/defaultMessages.json index d82967c71..094d45571 100644 --- a/locale/defaultMessages.json +++ b/locale/defaultMessages.json @@ -1673,6 +1673,9 @@ "context": "header", "string": "Hello there, {userName}" }, + "ByYtFB": { + "string": "Invalid or expired token. Please check your token in URL" + }, "C0JLNW": { "string": "Provided email address does not exist in our database." }, @@ -7092,6 +7095,9 @@ "context": "PageTypeDeleteWarningDialog single assigned items description", "string": "You are about to delete page type {typeName}. It is assigned to {assignedItemsCount} {assignedItemsCount,plural,one{page} other{pages}}. Deleting this page type will also delete those pages. Are you sure you want to do this?" }, + "tR+UuE": { + "string": "User doesn't exist. Please check your email in URL" + }, "tTtoKd": { "context": "error message", "string": "Sorry, your username and/or password are incorrect. Please try again." diff --git a/src/auth/components/NewPasswordPage/NewPasswordPage.stories.tsx b/src/auth/components/NewPasswordPage/NewPasswordPage.stories.tsx index 1575065b4..c79ab8c25 100644 --- a/src/auth/components/NewPasswordPage/NewPasswordPage.stories.tsx +++ b/src/auth/components/NewPasswordPage/NewPasswordPage.stories.tsx @@ -10,10 +10,10 @@ storiesOf("Views / Authentication / Set up a new password", module) .addDecorator(CardDecorator) .addDecorator(Decorator) .add("default", () => ( - undefined} /> + undefined} /> )) .add("loading", () => ( - undefined} /> + undefined} /> )) .add("too short error", () => ( undefined} /> )); diff --git a/src/auth/components/NewPasswordPage/NewPasswordPage.tsx b/src/auth/components/NewPasswordPage/NewPasswordPage.tsx index da6dab959..ceecc500f 100644 --- a/src/auth/components/NewPasswordPage/NewPasswordPage.tsx +++ b/src/auth/components/NewPasswordPage/NewPasswordPage.tsx @@ -15,7 +15,7 @@ export interface NewPasswordPageFormData { confirmPassword: string; } export interface NewPasswordPageProps { - disabled: boolean; + loading: boolean; errors: SetPasswordData["errors"]; onSubmit: (data: NewPasswordPageFormData) => SubmitPromise; } @@ -26,14 +26,10 @@ const initialForm: NewPasswordPageFormData = { }; const NewPasswordPage: React.FC = props => { - const { disabled, errors, onSubmit } = props; + const { loading, errors, onSubmit } = props; const classes = useStyles(props); const intl = useIntl(); - const error = getAccountErrorMessage( - errors.find(err => err.field === "password"), - intl, - ); return (
@@ -50,7 +46,14 @@ const NewPasswordPage: React.FC = props => { description="page title" /> - {!!error &&
{error}
} + {errors.map(error => ( +
+ {getAccountErrorMessage(error, intl)} +
+ ))} = props => { autoFocus fullWidth autoComplete="none" - disabled={disabled} + disabled={loading} label={intl.formatMessage({ id: "Ev6SEF", defaultMessage: "New Password", @@ -74,13 +77,14 @@ const NewPasswordPage: React.FC = props => { inputProps={{ "data-test-id": "password", }} + required /> = props => { inputProps={{ "data-test-id": "confirm-password", }} + required />