chace password by superadmin
This commit is contained in:
1 parent
468a67f937
commit
4317d1a47e
6 files changed
+54
-47
No files matched your search
@@ -7,8 +7,7 @@ import TextInput from "@/Components/v1/Inputs/TextInput/index.jsx";
|
||||
import Search from "@/Components/v1/Inputs/Search/index.jsx";
|
||||
import Button from "@mui/material/Button";
|
||||
import RoleTable from "../components/RoleTable/index.jsx";
|
||||
import ChangePasswordModal from "../components/ChangePasswordModal";
|
||||
|
||||
import ChangePasswordModal from "@/Pages/Account/components/ChangePasswordModal/index.jsx";
|
||||
// Utils
|
||||
import { useParams } from "react-router-dom";
|
||||
import { useTheme } from "@emotion/react";
|
||||
@@ -16,9 +15,12 @@ import { useTranslation } from "react-i18next";
|
||||
import { useGetUser, useEditUser } from "../../../../Hooks/v1/userHooks.js";
|
||||
import { EDITABLE_ROLES, ROLES } from "../../../../Utils/roleUtils.js";
|
||||
import { useEditUserForm, useValidateEditUserForm } from "./hooks/editUser.js";
|
||||
import { useSelector } from "react-redux";
|
||||
|
||||
const EditUser = () => {
|
||||
const { user } = useSelector((state) => state.auth);
|
||||
const { userId } = useParams();
|
||||
const isSameUser = user?._id === userId;
|
||||
const theme = useTheme();
|
||||
const { t } = useTranslation();
|
||||
const BREADCRUMBS = [
|
||||
@@ -26,7 +28,7 @@ const EditUser = () => {
|
||||
{ name: t("editUserPage.title"), path: "" },
|
||||
];
|
||||
|
||||
const [user, isLoading, error] = useGetUser(userId);
|
||||
const [userToEdit, isLoading, error] = useGetUser(userId);
|
||||
const [editUser, isSaving, saveError, changePassword] = useEditUser(userId);
|
||||
const [
|
||||
form,
|
||||
@@ -35,7 +37,7 @@ const EditUser = () => {
|
||||
handleDeleteRole,
|
||||
searchInput,
|
||||
handleSearchInput,
|
||||
] = useEditUserForm(user);
|
||||
] = useEditUserForm(userToEdit);
|
||||
const [errors, validateForm, validateField] = useValidateEditUserForm();
|
||||
|
||||
const onChange = (e) => {
|
||||
@@ -119,13 +121,14 @@ const EditUser = () => {
|
||||
>
|
||||
{t("editUserPage.form.save")}
|
||||
</Button>
|
||||
<ChangePasswordModal
|
||||
isSaving={isSaving}
|
||||
isLoading={isLoading}
|
||||
userId={userId}
|
||||
changePassword={changePassword}
|
||||
email={user?.email}
|
||||
/>
|
||||
{!isSameUser && (
|
||||
<ChangePasswordModal
|
||||
isSaving={isSaving}
|
||||
isLoading={isLoading}
|
||||
changePassword={changePassword}
|
||||
email={userToEdit?.email}
|
||||
/>
|
||||
)}
|
||||
</Stack>
|
||||
</Stack>
|
||||
</Stack>
|
||||
|
||||
Reference in new issue
Block a user