From 1a2f8727a8abc2d3520fa2c17147a547e08d7758 Mon Sep 17 00:00:00 2001 From: dominik-zeglen Date: Tue, 3 Dec 2019 17:14:30 +0100 Subject: [PATCH 01/12] Add password reset card --- .../StaffDetailsPage/StaffDetailsPage.tsx | 9 ++++ .../StaffPassword/StaffPassword.tsx | 43 +++++++++++++++++++ src/staff/components/StaffPassword/index.ts | 2 + src/staff/urls.ts | 5 ++- src/staff/views/StaffDetails.tsx | 7 +++ 5 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 src/staff/components/StaffPassword/StaffPassword.tsx create mode 100644 src/staff/components/StaffPassword/index.ts diff --git a/src/staff/components/StaffDetailsPage/StaffDetailsPage.tsx b/src/staff/components/StaffDetailsPage/StaffDetailsPage.tsx index f8e1d9b80..dfb3ae516 100644 --- a/src/staff/components/StaffDetailsPage/StaffDetailsPage.tsx +++ b/src/staff/components/StaffDetailsPage/StaffDetailsPage.tsx @@ -19,6 +19,7 @@ import { PermissionEnum } from "../../../types/globalTypes"; import { StaffMemberDetails_user } from "../../types/StaffMemberDetails"; import StaffPreferences from "../StaffPreferences"; import StaffProperties from "../StaffProperties/StaffProperties"; +import StaffPassword from "../StaffPassword/StaffPassword"; interface FormData { hasFullAccess: boolean; @@ -39,6 +40,7 @@ export interface StaffDetailsPageProps { saveButtonBarState: ConfirmButtonTransitionState; staffMember: StaffMemberDetails_user; onBack: () => void; + onChangePassword: () => void; onDelete: () => void; onImageDelete: () => void; onSubmit: (data: FormData) => void; @@ -55,6 +57,7 @@ const StaffDetailsPage: React.FC = ({ saveButtonBarState, staffMember, onBack, + onChangePassword, onDelete, onImageDelete, onImageUpload, @@ -100,6 +103,12 @@ const StaffDetailsPage: React.FC = ({ onImageUpload={onImageUpload} onImageDelete={onImageDelete} /> + {canEditPreferences && ( + <> + + + + )}
{canEditPreferences && ( diff --git a/src/staff/components/StaffPassword/StaffPassword.tsx b/src/staff/components/StaffPassword/StaffPassword.tsx new file mode 100644 index 000000000..485e536ee --- /dev/null +++ b/src/staff/components/StaffPassword/StaffPassword.tsx @@ -0,0 +1,43 @@ +import React from "react"; +import Button from "@material-ui/core/Button"; +import Card from "@material-ui/core/Card"; +import CardContent from "@material-ui/core/CardContent"; +import Typography from "@material-ui/core/Typography"; +import { FormattedMessage, useIntl } from "react-intl"; + +import CardTitle from "@saleor/components/CardTitle"; + +interface StaffPasswordProps { + onChangePassword: () => void; +} + +const StaffPassword: React.FC = ({ onChangePassword }) => { + const intl = useIntl(); + + return ( + + + + + } + /> + + + + + + + ); +}; + +StaffPassword.displayName = "StaffPassword"; +export default StaffPassword; diff --git a/src/staff/components/StaffPassword/index.ts b/src/staff/components/StaffPassword/index.ts new file mode 100644 index 000000000..9131e4472 --- /dev/null +++ b/src/staff/components/StaffPassword/index.ts @@ -0,0 +1,2 @@ +export { default } from "./StaffPassword"; +export * from "./StaffPassword"; diff --git a/src/staff/urls.ts b/src/staff/urls.ts index 7bdf6e201..b99a09235 100644 --- a/src/staff/urls.ts +++ b/src/staff/urls.ts @@ -27,7 +27,10 @@ export const staffListUrl = (params?: StaffListUrlQueryParams) => staffListPath + "?" + stringifyQs(params); export const staffMemberDetailsPath = (id: string) => urlJoin(staffSection, id); -export type StaffMemberDetailsUrlDialog = "remove" | "remove-avatar"; +export type StaffMemberDetailsUrlDialog = + | "change-password" + | "remove" + | "remove-avatar"; export type StaffMemberDetailsUrlQueryParams = Dialog< StaffMemberDetailsUrlDialog >; diff --git a/src/staff/views/StaffDetails.tsx b/src/staff/views/StaffDetails.tsx index e3739efc0..7d54e099c 100644 --- a/src/staff/views/StaffDetails.tsx +++ b/src/staff/views/StaffDetails.tsx @@ -128,6 +128,13 @@ export const StaffDetails: React.FC = ({ id, params }) => { canRemove={!isUserSameAsViewer} disabled={loading} onBack={() => navigate(staffListUrl())} + onChangePassword={() => + navigate( + staffMemberDetailsUrl(id, { + action: "change-password" + }) + ) + } onDelete={() => navigate( staffMemberDetailsUrl(id, { From a6f425ef39ccc50418cf55ad151cccdfe507d024 Mon Sep 17 00:00:00 2001 From: dominik-zeglen Date: Tue, 3 Dec 2019 17:30:37 +0100 Subject: [PATCH 02/12] Add dialog component --- .../StaffPasswordResetDialog.tsx | 113 ++++++++++++++++++ .../StaffPasswordResetDialog/index.ts | 2 + src/staff/views/StaffDetails.tsx | 24 +++- 3 files changed, 133 insertions(+), 6 deletions(-) create mode 100644 src/staff/components/StaffPasswordResetDialog/StaffPasswordResetDialog.tsx create mode 100644 src/staff/components/StaffPasswordResetDialog/index.ts diff --git a/src/staff/components/StaffPasswordResetDialog/StaffPasswordResetDialog.tsx b/src/staff/components/StaffPasswordResetDialog/StaffPasswordResetDialog.tsx new file mode 100644 index 000000000..500d9fa9e --- /dev/null +++ b/src/staff/components/StaffPasswordResetDialog/StaffPasswordResetDialog.tsx @@ -0,0 +1,113 @@ +import React from "react"; +import Button from "@material-ui/core/Button"; +import Dialog from "@material-ui/core/Dialog"; +import DialogActions from "@material-ui/core/DialogActions"; +import DialogContent from "@material-ui/core/DialogContent"; +import TextField from "@material-ui/core/TextField"; +import DialogTitle from "@material-ui/core/DialogTitle"; +import { FormattedMessage, useIntl } from "react-intl"; + +import { DialogProps, UserError } from "@saleor/types"; +import { buttonMessages } from "@saleor/intl"; +import Form from "@saleor/components/Form"; +import ConfirmButton, { + ConfirmButtonTransitionState +} from "@saleor/components/ConfirmButton"; +import FormSpacer from "@saleor/components/FormSpacer"; + +interface StaffPasswordResetDialogFormData { + password: string; + previousPassword: string; +} +export interface StaffPasswordResetDialogProps extends DialogProps { + confirmButtonState: ConfirmButtonTransitionState; + errors: UserError[]; + onSubmit: (password: string) => void; +} + +const initialForm: StaffPasswordResetDialogFormData = { + password: "", + previousPassword: "" +}; + +const StaffPasswordResetDialog: React.FC = ({ + confirmButtonState, + errors: apiErrors, + open, + onClose, + onSubmit +}) => { + const intl = useIntl(); + + return ( + + + + +
onSubmit(data.password)} + > + {({ change, data, errors, submit }) => ( + <> + + + + + + + + + + + + + )} +
+
+ ); +}; + +StaffPasswordResetDialog.displayName = "StaffPasswordResetDialog"; +export default StaffPasswordResetDialog; diff --git a/src/staff/components/StaffPasswordResetDialog/index.ts b/src/staff/components/StaffPasswordResetDialog/index.ts new file mode 100644 index 000000000..4bffd3362 --- /dev/null +++ b/src/staff/components/StaffPasswordResetDialog/index.ts @@ -0,0 +1,2 @@ +export { default } from "./StaffPasswordResetDialog"; +export * from "./StaffPasswordResetDialog"; diff --git a/src/staff/views/StaffDetails.tsx b/src/staff/views/StaffDetails.tsx index 7d54e099c..c2a165069 100644 --- a/src/staff/views/StaffDetails.tsx +++ b/src/staff/views/StaffDetails.tsx @@ -27,6 +27,7 @@ import { staffMemberDetailsUrl, StaffMemberDetailsUrlQueryParams } from "../urls"; +import StaffPasswordResetDialog from "../components/StaffPasswordResetDialog"; interface OrderListProps { id: string; @@ -40,6 +41,14 @@ export const StaffDetails: React.FC = ({ id, params }) => { const intl = useIntl(); const shop = useShop(); + const closeModal = () => + navigate( + staffMemberDetailsUrl(id, { + ...params, + action: undefined + }) + ); + return ( = ({ id, params }) => { })} confirmButtonState={deleteTransitionState} variant="delete" - onClose={() => - navigate(staffMemberDetailsUrl(id)) - } + onClose={closeModal} onConfirm={deleteStaffMember} > @@ -204,9 +211,7 @@ export const StaffDetails: React.FC = ({ id, params }) => { })} confirmButtonState={deleteAvatarTransitionState} variant="delete" - onClose={() => - navigate(staffMemberDetailsUrl(id)) - } + onClose={closeModal} onConfirm={deleteStaffAvatar} > @@ -222,6 +227,13 @@ export const StaffDetails: React.FC = ({ id, params }) => { /> + undefined} + /> ); }} From 0bd2d52840a6246c8c6ca22fc25d322cd0efb1cf Mon Sep 17 00:00:00 2001 From: dominik-zeglen Date: Tue, 3 Dec 2019 17:34:21 +0100 Subject: [PATCH 03/12] Fix types --- .../StaffPasswordResetDialog.tsx | 8 ++---- src/staff/mutations.ts | 20 ++++++++++++++ src/staff/types/ChangeStaffPassword.ts | 27 +++++++++++++++++++ 3 files changed, 49 insertions(+), 6 deletions(-) create mode 100644 src/staff/types/ChangeStaffPassword.ts diff --git a/src/staff/components/StaffPasswordResetDialog/StaffPasswordResetDialog.tsx b/src/staff/components/StaffPasswordResetDialog/StaffPasswordResetDialog.tsx index 500d9fa9e..018980b25 100644 --- a/src/staff/components/StaffPasswordResetDialog/StaffPasswordResetDialog.tsx +++ b/src/staff/components/StaffPasswordResetDialog/StaffPasswordResetDialog.tsx @@ -22,7 +22,7 @@ interface StaffPasswordResetDialogFormData { export interface StaffPasswordResetDialogProps extends DialogProps { confirmButtonState: ConfirmButtonTransitionState; errors: UserError[]; - onSubmit: (password: string) => void; + onSubmit: (data: StaffPasswordResetDialogFormData) => void; } const initialForm: StaffPasswordResetDialogFormData = { @@ -47,11 +47,7 @@ const StaffPasswordResetDialog: React.FC = ({ description="dialog header" /> -
onSubmit(data.password)} - > + {({ change, data, errors, submit }) => ( <> diff --git a/src/staff/mutations.ts b/src/staff/mutations.ts index a3939ecc3..ee1dde297 100644 --- a/src/staff/mutations.ts +++ b/src/staff/mutations.ts @@ -1,5 +1,6 @@ import gql from "graphql-tag"; +import makeMutation from "@saleor/hooks/makeMutation"; import { TypedMutation } from "../mutations"; import { staffMemberDetailsFragment } from "./queries"; import { StaffAvatarDelete } from "./types/StaffAvatarDelete"; @@ -19,6 +20,10 @@ import { StaffMemberUpdate, StaffMemberUpdateVariables } from "./types/StaffMemberUpdate"; +import { + ChangeStaffPassword, + ChangeStaffPasswordVariables +} from "./types/ChangeStaffPassword"; const staffMemberAddMutation = gql` ${staffMemberDetailsFragment} @@ -114,3 +119,18 @@ export const TypedStaffAvatarDeleteMutation = TypedMutation< StaffAvatarDelete, StaffMemberDeleteVariables >(staffAvatarDeleteMutation); + +const changeStaffPassword = gql` + mutation ChangeStaffPassword($newPassword: String!, $oldPassword: String!) { + passwordChange(newPassword: $newPassword, oldPassword: $oldPassword) { + errors { + field + message + } + } + } +`; +export const useChangeStaffPassword = makeMutation< + ChangeStaffPassword, + ChangeStaffPasswordVariables +>(changeStaffPassword); diff --git a/src/staff/types/ChangeStaffPassword.ts b/src/staff/types/ChangeStaffPassword.ts new file mode 100644 index 000000000..18c15db12 --- /dev/null +++ b/src/staff/types/ChangeStaffPassword.ts @@ -0,0 +1,27 @@ +/* tslint:disable */ +/* eslint-disable */ +// This file was automatically generated and should not be edited. + +// ==================================================== +// GraphQL mutation operation: ChangeStaffPassword +// ==================================================== + +export interface ChangeStaffPassword_passwordChange_errors { + __typename: "Error"; + field: string | null; + message: string | null; +} + +export interface ChangeStaffPassword_passwordChange { + __typename: "PasswordChange"; + errors: ChangeStaffPassword_passwordChange_errors[] | null; +} + +export interface ChangeStaffPassword { + passwordChange: ChangeStaffPassword_passwordChange | null; +} + +export interface ChangeStaffPasswordVariables { + newPassword: string; + oldPassword: string; +} From 1bded89d1e31e9452199d2af6b7f1c4d88e971a1 Mon Sep 17 00:00:00 2001 From: dominik-zeglen Date: Tue, 3 Dec 2019 17:39:27 +0100 Subject: [PATCH 04/12] Make it work --- .../StaffPasswordResetDialog.tsx | 4 +- src/staff/views/StaffDetails.tsx | 42 +++++++++++++++++-- 2 files changed, 41 insertions(+), 5 deletions(-) diff --git a/src/staff/components/StaffPasswordResetDialog/StaffPasswordResetDialog.tsx b/src/staff/components/StaffPasswordResetDialog/StaffPasswordResetDialog.tsx index 018980b25..e53521577 100644 --- a/src/staff/components/StaffPasswordResetDialog/StaffPasswordResetDialog.tsx +++ b/src/staff/components/StaffPasswordResetDialog/StaffPasswordResetDialog.tsx @@ -14,6 +14,7 @@ import ConfirmButton, { ConfirmButtonTransitionState } from "@saleor/components/ConfirmButton"; import FormSpacer from "@saleor/components/FormSpacer"; +import useModalDialogErrors from "@saleor/hooks/useModalDialogErrors"; interface StaffPasswordResetDialogFormData { password: string; @@ -38,6 +39,7 @@ const StaffPasswordResetDialog: React.FC = ({ onSubmit }) => { const intl = useIntl(); + const dialogErrors = useModalDialogErrors(apiErrors, open); return ( @@ -47,7 +49,7 @@ const StaffPasswordResetDialog: React.FC = ({ description="dialog header" /> - + {({ change, data, errors, submit }) => ( <> diff --git a/src/staff/views/StaffDetails.tsx b/src/staff/views/StaffDetails.tsx index c2a165069..6efe2770a 100644 --- a/src/staff/views/StaffDetails.tsx +++ b/src/staff/views/StaffDetails.tsx @@ -15,7 +15,8 @@ import { TypedStaffAvatarDeleteMutation, TypedStaffAvatarUpdateMutation, TypedStaffMemberDeleteMutation, - TypedStaffMemberUpdateMutation + TypedStaffMemberUpdateMutation, + useChangeStaffPassword } from "../mutations"; import { TypedStaffMemberDetailsQuery } from "../queries"; import { StaffAvatarDelete } from "../types/StaffAvatarDelete"; @@ -28,6 +29,7 @@ import { StaffMemberDetailsUrlQueryParams } from "../urls"; import StaffPasswordResetDialog from "../components/StaffPasswordResetDialog"; +import { ChangeStaffPassword } from "../types/ChangeStaffPassword"; interface OrderListProps { id: string; @@ -49,6 +51,24 @@ export const StaffDetails: React.FC = ({ id, params }) => { }) ); + const handleChangePassword = (data: ChangeStaffPassword) => { + if (data.passwordChange.errors.length === 0) { + notify({ + text: intl.formatMessage(commonMessages.savedChanges) + }); + closeModal(); + } + }; + const [changePassword, changePasswordOpts] = useChangeStaffPassword({ + onCompleted: handleChangePassword + }); + + const changePasswordTransitionState = getMutationState( + changePasswordOpts.called, + changePasswordOpts.loading, + maybe(() => changePasswordOpts.data.passwordChange.errors) + ); + return ( = ({ id, params }) => { + changePasswordOpts.data.passwordChange + .errors, + [] + )} open={params.action === "change-password"} onClose={closeModal} - onSubmit={() => undefined} + onSubmit={data => + changePassword({ + variables: { + newPassword: data.password, + oldPassword: data.previousPassword + } + }) + } /> ); From 01a83f8aa16482d88054c40da759eff7c29e4fd9 Mon Sep 17 00:00:00 2001 From: dominik-zeglen Date: Tue, 3 Dec 2019 17:42:27 +0100 Subject: [PATCH 05/12] Code cleanup --- .../StaffPasswordResetDialog.tsx | 24 +++++++++---------- src/staff/views/StaffDetails.tsx | 5 +--- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/src/staff/components/StaffPasswordResetDialog/StaffPasswordResetDialog.tsx b/src/staff/components/StaffPasswordResetDialog/StaffPasswordResetDialog.tsx index e53521577..1ee321b9e 100644 --- a/src/staff/components/StaffPasswordResetDialog/StaffPasswordResetDialog.tsx +++ b/src/staff/components/StaffPasswordResetDialog/StaffPasswordResetDialog.tsx @@ -17,8 +17,8 @@ import FormSpacer from "@saleor/components/FormSpacer"; import useModalDialogErrors from "@saleor/hooks/useModalDialogErrors"; interface StaffPasswordResetDialogFormData { - password: string; - previousPassword: string; + newPassword: string; + oldPassword: string; } export interface StaffPasswordResetDialogProps extends DialogProps { confirmButtonState: ConfirmButtonTransitionState; @@ -27,8 +27,8 @@ export interface StaffPasswordResetDialogProps extends DialogProps { } const initialForm: StaffPasswordResetDialogFormData = { - password: "", - previousPassword: "" + newPassword: "", + oldPassword: "" }; const StaffPasswordResetDialog: React.FC = ({ @@ -54,33 +54,33 @@ const StaffPasswordResetDialog: React.FC = ({ <> @@ -90,7 +90,7 @@ const StaffPasswordResetDialog: React.FC = ({ = 8)} transitionState={confirmButtonState} color="primary" variant="contained" diff --git a/src/staff/views/StaffDetails.tsx b/src/staff/views/StaffDetails.tsx index 6efe2770a..85a9c4bc6 100644 --- a/src/staff/views/StaffDetails.tsx +++ b/src/staff/views/StaffDetails.tsx @@ -261,10 +261,7 @@ export const StaffDetails: React.FC = ({ id, params }) => { onClose={closeModal} onSubmit={data => changePassword({ - variables: { - newPassword: data.password, - oldPassword: data.previousPassword - } + variables: data }) } /> From df1d9e4e24b3c3cd827c93e1c83c135e257b0884 Mon Sep 17 00:00:00 2001 From: dominik-zeglen Date: Tue, 3 Dec 2019 17:43:02 +0100 Subject: [PATCH 06/12] Fix types --- src/storybook/stories/staff/StaffDetailsPage.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/storybook/stories/staff/StaffDetailsPage.tsx b/src/storybook/stories/staff/StaffDetailsPage.tsx index 455e7d7fe..4559cd2aa 100644 --- a/src/storybook/stories/staff/StaffDetailsPage.tsx +++ b/src/storybook/stories/staff/StaffDetailsPage.tsx @@ -16,6 +16,7 @@ const props: Omit = { canRemove: true, disabled: false, onBack: () => undefined, + onChangePassword: () => undefined, onDelete: () => undefined, onImageDelete: () => undefined, onImageUpload: () => undefined, From 06ab3aa6e56958806e9b747912d97840f631679f Mon Sep 17 00:00:00 2001 From: dominik-zeglen Date: Tue, 3 Dec 2019 17:44:50 +0100 Subject: [PATCH 07/12] Update snapshots --- .../__snapshots__/Stories.test.ts.snap | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/src/storybook/__snapshots__/Stories.test.ts.snap b/src/storybook/__snapshots__/Stories.test.ts.snap index ec1f35e51..a03cbb98b 100644 --- a/src/storybook/__snapshots__/Stories.test.ts.snap +++ b/src/storybook/__snapshots__/Stories.test.ts.snap @@ -121349,6 +121349,52 @@ exports[`Storyshots Views / Staff / Staff member details himself 1`] = `
+
+
+
+ + Password + +
+ +
+
+
+
+
+
+ You should change your password every month to avoid security issues. +
+
+
Date: Tue, 3 Dec 2019 17:47:22 +0100 Subject: [PATCH 08/12] Fix typo --- .../StaffPasswordResetDialog/StaffPasswordResetDialog.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/staff/components/StaffPasswordResetDialog/StaffPasswordResetDialog.tsx b/src/staff/components/StaffPasswordResetDialog/StaffPasswordResetDialog.tsx index 1ee321b9e..8383a554e 100644 --- a/src/staff/components/StaffPasswordResetDialog/StaffPasswordResetDialog.tsx +++ b/src/staff/components/StaffPasswordResetDialog/StaffPasswordResetDialog.tsx @@ -73,7 +73,7 @@ const StaffPasswordResetDialog: React.FC = ({ errors.newPassword || intl.formatMessage({ defaultMessage: - "New newPassword must be at least 8 characters long" + "New password must be at least 8 characters long" }) } label={intl.formatMessage({ From fd91aba73549939b008d305d423f216ea7515d08 Mon Sep 17 00:00:00 2001 From: dominik-zeglen Date: Tue, 3 Dec 2019 17:47:30 +0100 Subject: [PATCH 09/12] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b2430dd3f..f8144c1ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ All notable, unreleased changes to this project will be documented in this file. - Fix dropdown clickable areas - #281 by @dominik-zeglen - Use eslint - #285 by @dominik-zeglen - Enforce using "name" property in style hooks - #288 by @dominik-zeglen +- Add ability to reset own password - #289 by @dominik-zeglen ## 2.0.0 From ebb3d9ebea17ef00e7853fd2b9f95554f6a60ac3 Mon Sep 17 00:00:00 2001 From: dominik-zeglen Date: Tue, 3 Dec 2019 17:48:30 +0100 Subject: [PATCH 10/12] Update messages --- locale/messages.pot | 54 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/locale/messages.pot b/locale/messages.pot index 28902c762..dc19e77a9 100644 --- a/locale/messages.pot +++ b/locale/messages.pot @@ -1,6 +1,6 @@ msgid "" msgstr "" -"POT-Creation-Date: 2019-11-26T14:34:48.426Z\n" +"POT-Creation-Date: 2019-12-03T16:48:22.955Z\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "MIME-Version: 1.0\n" @@ -1239,6 +1239,10 @@ msgstr "" #. [src.components.AssignCollectionDialog.3992923611] - dialog header #. defaultMessage is: #. Assign Collection +#: build/locale/src/staff/components/StaffPasswordResetDialog/StaffPasswordResetDialog.json +#. [src.staff.components.StaffPasswordResetDialog.3992923611] - dialog header +#. defaultMessage is: +#. Assign Collection msgctxt "dialog header" msgid "Assign Collection" msgstr "" @@ -1863,6 +1867,14 @@ msgctxt "button" msgid "Change photo" msgstr "" +#: build/locale/src/staff/components/StaffPassword/StaffPassword.json +#. [src.staff.components.StaffPassword.1434811103] - utton +#. defaultMessage is: +#. Change your password +msgctxt " utton" +msgid "Change your password" +msgstr "" + #: build/locale/src/products/components/ProductPricing/ProductPricing.json #. [src.products.components.ProductPricing.3015886868] #. defaultMessage is: @@ -4911,6 +4923,14 @@ msgctxt "description" msgid "New Password" msgstr "" +#: build/locale/src/staff/components/StaffPasswordResetDialog/StaffPasswordResetDialog.json +#. [src.staff.components.StaffPasswordResetDialog.1254879564] - input label +#. defaultMessage is: +#. New Password +msgctxt "input label" +msgid "New Password" +msgstr "" + #: build/locale/src/products/views/ProductCreate.json #. [src.products.views.1591632382] - page header #. defaultMessage is: @@ -4927,6 +4947,14 @@ msgctxt "variant name" msgid "New Variant" msgstr "" +#: build/locale/src/staff/components/StaffPasswordResetDialog/StaffPasswordResetDialog.json +#. [src.staff.components.StaffPasswordResetDialog.1651415182] +#. defaultMessage is: +#. New password must be at least 8 characters long +msgctxt "description" +msgid "New password must be at least 8 characters long" +msgstr "" + #: build/locale/src/taxes/components/CountryTaxesPage/CountryTaxesPage.json #. [src.taxes.components.CountryTaxesPage.1451721797] - tax rate #. defaultMessage is: @@ -5947,6 +5975,14 @@ msgctxt "description" msgid "Password" msgstr "" +#: build/locale/src/staff/components/StaffPassword/StaffPassword.json +#. [src.staff.components.StaffPassword.2237029987] - header +#. defaultMessage is: +#. Password +msgctxt "header" +msgid "Password" +msgstr "" + #: build/locale/src/auth/components/NewPasswordPage/NewPasswordPage.json #. [src.auth.components.NewPasswordPage.4253911811] #. defaultMessage is: @@ -6215,6 +6251,14 @@ msgctxt "previous step, button" msgid "Previous" msgstr "" +#: build/locale/src/staff/components/StaffPasswordResetDialog/StaffPasswordResetDialog.json +#. [src.staff.components.StaffPasswordResetDialog.53359254] - input label +#. defaultMessage is: +#. Previous Password +msgctxt "input label" +msgid "Previous Password" +msgstr "" + #: build/locale/src/categories/components/CategoryProductList/CategoryProductList.json #. [src.categories.components.CategoryProductList.1134347598] - product price #. defaultMessage is: @@ -9667,6 +9711,14 @@ msgctxt "description" msgid "Yes" msgstr "" +#: build/locale/src/staff/components/StaffPassword/StaffPassword.json +#. [src.staff.components.StaffPassword.1274006906] +#. defaultMessage is: +#. You should change your password every month to avoid security issues. +msgctxt "description" +msgid "You should change your password every month to avoid security issues." +msgstr "" + #: build/locale/src/products/components/ProductVariantCreateDialog/ProductVariantCreateSummary.json #. [src.products.components.ProductVariantCreateDialog.1009678918] - header #. defaultMessage is: From 214a44d4b1cd4f25cbb424f17b1a47f034de40e8 Mon Sep 17 00:00:00 2001 From: dominik-zeglen Date: Wed, 4 Dec 2019 11:16:29 +0100 Subject: [PATCH 11/12] Fix message --- locale/messages.pot | 14 +++++++++----- .../StaffPasswordResetDialog.tsx | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/locale/messages.pot b/locale/messages.pot index dc19e77a9..f8eba0214 100644 --- a/locale/messages.pot +++ b/locale/messages.pot @@ -1,6 +1,6 @@ msgid "" msgstr "" -"POT-Creation-Date: 2019-12-03T16:48:22.955Z\n" +"POT-Creation-Date: 2019-12-04T10:13:32.661Z\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "MIME-Version: 1.0\n" @@ -1239,10 +1239,6 @@ msgstr "" #. [src.components.AssignCollectionDialog.3992923611] - dialog header #. defaultMessage is: #. Assign Collection -#: build/locale/src/staff/components/StaffPasswordResetDialog/StaffPasswordResetDialog.json -#. [src.staff.components.StaffPasswordResetDialog.3992923611] - dialog header -#. defaultMessage is: -#. Assign Collection msgctxt "dialog header" msgid "Assign Collection" msgstr "" @@ -1859,6 +1855,14 @@ msgctxt "description" msgid "Category name" msgstr "" +#: build/locale/src/staff/components/StaffPasswordResetDialog/StaffPasswordResetDialog.json +#. [src.staff.components.StaffPasswordResetDialog.2521568990] - dialog header +#. defaultMessage is: +#. Change Password +msgctxt "dialog header" +msgid "Change Password" +msgstr "" + #: build/locale/src/staff/components/StaffProperties/StaffProperties.json #. [src.staff.components.StaffProperties.2771097267] - button #. defaultMessage is: diff --git a/src/staff/components/StaffPasswordResetDialog/StaffPasswordResetDialog.tsx b/src/staff/components/StaffPasswordResetDialog/StaffPasswordResetDialog.tsx index 8383a554e..5767549a2 100644 --- a/src/staff/components/StaffPasswordResetDialog/StaffPasswordResetDialog.tsx +++ b/src/staff/components/StaffPasswordResetDialog/StaffPasswordResetDialog.tsx @@ -45,7 +45,7 @@ const StaffPasswordResetDialog: React.FC = ({ From 44bb4be1fa5ee17cfaec87e78b7350246a70a99f Mon Sep 17 00:00:00 2001 From: dominik-zeglen Date: Wed, 4 Dec 2019 15:17:54 +0100 Subject: [PATCH 12/12] Fix minor bugs --- locale/messages.pot | 6 +++--- src/staff/components/StaffPassword/StaffPassword.tsx | 2 +- .../StaffPasswordResetDialog/StaffPasswordResetDialog.tsx | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/locale/messages.pot b/locale/messages.pot index f8eba0214..2d58e0b2e 100644 --- a/locale/messages.pot +++ b/locale/messages.pot @@ -1,6 +1,6 @@ msgid "" msgstr "" -"POT-Creation-Date: 2019-12-04T10:13:32.661Z\n" +"POT-Creation-Date: 2019-12-04T14:17:34.264Z\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "MIME-Version: 1.0\n" @@ -1872,10 +1872,10 @@ msgid "Change photo" msgstr "" #: build/locale/src/staff/components/StaffPassword/StaffPassword.json -#. [src.staff.components.StaffPassword.1434811103] - utton +#. [src.staff.components.StaffPassword.1434811103] - button #. defaultMessage is: #. Change your password -msgctxt " utton" +msgctxt "button" msgid "Change your password" msgstr "" diff --git a/src/staff/components/StaffPassword/StaffPassword.tsx b/src/staff/components/StaffPassword/StaffPassword.tsx index 485e536ee..1d9582540 100644 --- a/src/staff/components/StaffPassword/StaffPassword.tsx +++ b/src/staff/components/StaffPassword/StaffPassword.tsx @@ -25,7 +25,7 @@ const StaffPassword: React.FC = ({ onChangePassword }) => { } diff --git a/src/staff/components/StaffPasswordResetDialog/StaffPasswordResetDialog.tsx b/src/staff/components/StaffPasswordResetDialog/StaffPasswordResetDialog.tsx index 5767549a2..93420361b 100644 --- a/src/staff/components/StaffPasswordResetDialog/StaffPasswordResetDialog.tsx +++ b/src/staff/components/StaffPasswordResetDialog/StaffPasswordResetDialog.tsx @@ -90,7 +90,7 @@ const StaffPasswordResetDialog: React.FC = ({ = 8)} + disabled={data.newPassword.length < 8} transitionState={confirmButtonState} color="primary" variant="contained"