The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
TypeScript analyticsbibusiness-intelligencebusinessintelligenceclojuredashboarddatadata-analysisdata-visualizationdatabasemetabasemysqlpostgrespostgresqlreportingslacksql-editorvisualization
Password reset should show confirmation toast (#64522)
Phoomparin Mano913bb086c320
diff --git a/e2e/test/scenarios/admin-2/people.cy.spec.js b/e2e/test/scenarios/admin-2/people.cy.spec.jsindex 2c551c4bdb2..b68c5c18153 100644--- a/e2e/test/scenarios/admin-2/people.cy.spec.js+++ b/e2e/test/scenarios/admin-2/people.cy.spec.js@@ -336,12 +336,23 @@ describe("scenarios > admin > people", () => {// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usagecy.findByText(`Reset ${normalUserName}'s password?`);clickButton("Reset password");++ H.undoToast().within(() => {+ cy.findByText(+ `Password reset email sent to ${normalUserName}`,+ ).should("be.visible");+ });++ cy.log("Should not show temporary password modal");// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usagecy.findByText(`${normalUserName}'s password has been reset`).should("not.exist",);// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usagecy.findByText(/^temporary password$/i).should("not.exist");++ cy.log("Should close the modal");+ H.modal().should("not.exist");},);diff --git a/frontend/src/metabase/admin/people/containers/UserPasswordResetModal.tsx b/frontend/src/metabase/admin/people/containers/UserPasswordResetModal.tsxindex 29ae14d2363..754854da031 100644--- a/frontend/src/metabase/admin/people/containers/UserPasswordResetModal.tsx+++ b/frontend/src/metabase/admin/people/containers/UserPasswordResetModal.tsx@@ -1,6 +1,6 @@import { goBack } from "react-router-redux";import { useUnmount } from "react-use";-import { t } from "ttag";+import { c, t } from "ttag";import {useForgotPasswordMutation,@@ -10,6 +10,7 @@ import {import { ConfirmModal } from "metabase/common/components/ConfirmModal";import { LoadingAndErrorWrapper } from "metabase/common/components/LoadingAndErrorWrapper";import PasswordReveal from "metabase/common/components/PasswordReveal";+import { useToast } from "metabase/common/hooks/use-toast";import { useDispatch, useSelector } from "metabase/lib/redux";import { generatePassword } from "metabase/lib/security";import MetabaseSettings from "metabase/lib/settings";@@ -38,12 +39,20 @@ const UserPasswordResetModalInner = ({clearTemporaryPassword();});+ const [sendToast] = useToast();const [updatePassword] = useUpdatePasswordMutation();const [resetPasswordEmail] = useForgotPasswordMutation();const handleResetConfirm = async () => {if (emailConfigured) {await resetPasswordEmail(user.email).unwrap();++ sendToast({+ message: c("{0} is the name of the user")+ .t`Password reset email sent to ${user.common_name}`,+ });++ onClose();} else {const password = generatePassword();await updatePassword({ id: user.id, password }).unwrap();