Skip to content

Commit

Permalink
Update password reset pages (#1714)
Browse files Browse the repository at this point in the history
* Update password reset pages

* Update src/auth/components/ResetPasswordPage/ResetPasswordPage.tsx

Co-authored-by: Jakub Majorek <majorek.jakub@gmail.com>

Co-authored-by: Jakub Majorek <majorek.jakub@gmail.com>
  • Loading branch information
dominik-zeglen and jwm0 committed Jan 11, 2022
1 parent ae57d99 commit 65ce65d
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 8 deletions.
10 changes: 8 additions & 2 deletions src/auth/components/NewPasswordPage/NewPasswordPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,15 @@ const NewPasswordPage: React.FC<NewPasswordPageProps> = props => {

return (
<>
<Typography variant="h3" className={classes.header}>
<FormattedMessage
defaultMessage="Set up new password"
description="page title"
/>
</Typography>
{!!error && <div className={classes.panel}>{error}</div>}
<Typography>
<FormattedMessage defaultMessage="Please set up a new password." />
<Typography variant="caption" color="textSecondary">
<FormattedMessage defaultMessage="Please set up a new password for your account. Repeat your new password to make sure you will be able to remember it." />
</Typography>
<FormSpacer />
<TextField
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import ResetPasswordPage, { ResetPasswordPageProps } from "./ResetPasswordPage";
const props: ResetPasswordPageProps = {
disabled: false,
error: undefined,
onBack: () => undefined,
onSubmit: () => undefined
};
storiesOf("Views / Authentication / Reset password", module)
Expand Down
17 changes: 12 additions & 5 deletions src/auth/components/ResetPasswordPage/ResetPasswordPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { TextField, Typography } from "@material-ui/core";
import Form from "@saleor/components/Form";
import FormSpacer from "@saleor/components/FormSpacer";
import { commonMessages } from "@saleor/intl";
import { Button } from "@saleor/macaw-ui";
import { ArrowRightIcon, Button, IconButton } from "@saleor/macaw-ui";
import React from "react";
import { FormattedMessage, useIntl } from "react-intl";

Expand All @@ -14,11 +14,12 @@ export interface ResetPasswordPageFormData {
export interface ResetPasswordPageProps {
disabled: boolean;
error: string;
onBack: () => void;
onSubmit: (data: ResetPasswordPageFormData) => void;
}

const ResetPasswordPage: React.FC<ResetPasswordPageProps> = props => {
const { disabled, error, onSubmit } = props;
const { disabled, error, onBack, onSubmit } = props;

const classes = useStyles(props);
const intl = useIntl();
Expand All @@ -27,9 +28,15 @@ const ResetPasswordPage: React.FC<ResetPasswordPageProps> = props => {
<Form initial={{ email: "" }} onSubmit={onSubmit}>
{({ change: handleChange, data, submit: handleSubmit }) => (
<>
<IconButton className={classes.backBtn} onClick={onBack}>
<ArrowRightIcon className={classes.arrow} />
</IconButton>
<Typography variant="h3" className={classes.header}>
<FormattedMessage defaultMessage="Reset password" />
</Typography>
{!!error && <div className={classes.panel}>{error}</div>}
<Typography>
<FormattedMessage defaultMessage="Forgot your password? Don't worry, we'll reset it for you." />
<Typography variant="caption" color="textSecondary">
<FormattedMessage defaultMessage="Provide us with an email - if we find it in our database we will send you a link to reset your password. You should be able to find it in your inbox in the next couple of minutes." />
</Typography>
<FormSpacer />
<TextField
Expand All @@ -54,7 +61,7 @@ const ResetPasswordPage: React.FC<ResetPasswordPageProps> = props => {
type="submit"
>
<FormattedMessage
defaultMessage="Send Instructions"
defaultMessage="Send an email with reset link"
description="password reset, button"
/>
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ const ResetPasswordSuccessPage: React.FC<ResetPasswordSuccessPageProps> = props

return (
<>
<Typography variant="h3" className={classes.header}>
<FormattedMessage defaultMessage="Reset password" />
</Typography>
<Typography>
<FormattedMessage defaultMessage="Success! In a few minutes you’ll receive a message with instructions on how to reset your password." />
</Typography>
Expand Down
6 changes: 6 additions & 0 deletions src/auth/components/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ import { makeStyles } from "@saleor/macaw-ui";

const useStyles = makeStyles(
theme => ({
arrow: {
transform: "rotate(180deg)"
},
backBtn: {
marginBottom: theme.spacing(3)
},
buttonContainer: {
display: "flex",
justifyContent: "flex-end"
Expand Down
1 change: 1 addition & 0 deletions src/auth/views/ResetPassword.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const ResetPasswordView: React.FC = () => {
<ResetPasswordPage
disabled={requestPasswordResetOpts.loading}
error={error}
onBack={() => navigate(APP_MOUNT_URI)}
onSubmit={handleSubmit}
/>
);
Expand Down
3 changes: 2 additions & 1 deletion src/auth/views/ResetPasswordSuccess.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { APP_MOUNT_URI } from "@saleor/config";
import useNavigator from "@saleor/hooks/useNavigator";
import React from "react";

Expand All @@ -6,7 +7,7 @@ import ResetPasswordSuccessPage from "../components/ResetPasswordSuccessPage";
const ResetPasswordSuccessView: React.FC = () => {
const navigate = useNavigator();

return <ResetPasswordSuccessPage onBack={() => navigate("/")} />;
return <ResetPasswordSuccessPage onBack={() => navigate(APP_MOUNT_URI)} />;
};
ResetPasswordSuccessView.displayName = "ResetPasswordSuccessView";
export default ResetPasswordSuccessView;

0 comments on commit 65ce65d

Please sign in to comment.