fix errors
This commit is contained in:
1 parent
5159d43cad
commit
f31ff994fe
4 files changed
+3
-12
No files matched your search
@@ -10,7 +10,7 @@ import { PasswordEndAdornment } from "@/Components/v1/Inputs/TextInput/Adornment
|
|||||||
import usePasswordFeedback from "@/Pages/v1/Auth/hooks/usePasswordFeedback";
|
import usePasswordFeedback from "@/Pages/v1/Auth/hooks/usePasswordFeedback";
|
||||||
import PropTypes from "prop-types";
|
import PropTypes from "prop-types";
|
||||||
|
|
||||||
const ChangePasswordModal = ({ isSaving, isLoading, changePassword, email }) => {
|
const ChangePasswordModal = ({ isSaving, isLoading, changePassword }) => {
|
||||||
const INITIAL_FORM_STATE = {
|
const INITIAL_FORM_STATE = {
|
||||||
password: "",
|
password: "",
|
||||||
confirm: "",
|
confirm: "",
|
||||||
@@ -44,8 +44,6 @@ const ChangePasswordModal = ({ isSaving, isLoading, changePassword, email }) =>
|
|||||||
if (!isFormValid) return;
|
if (!isFormValid) return;
|
||||||
const newPasswordForm = {
|
const newPasswordForm = {
|
||||||
password: form.password,
|
password: form.password,
|
||||||
newPassword: form.confirm,
|
|
||||||
email: email,
|
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
setIsLoadingSubmit(true);
|
setIsLoadingSubmit(true);
|
||||||
@@ -146,7 +144,6 @@ ChangePasswordModal.propTypes = {
|
|||||||
isSaving: PropTypes.bool.isRequired,
|
isSaving: PropTypes.bool.isRequired,
|
||||||
isLoading: PropTypes.bool.isRequired,
|
isLoading: PropTypes.bool.isRequired,
|
||||||
changePassword: PropTypes.func.isRequired,
|
changePassword: PropTypes.func.isRequired,
|
||||||
email: PropTypes.string.isRequired,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ChangePasswordModal;
|
export default ChangePasswordModal;
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
// Components
|
// Components
|
||||||
import Stack from "@mui/material/Stack";
|
import Stack from "@mui/material/Stack";
|
||||||
import Box from "@mui/material/Box";
|
|
||||||
import Typography from "@mui/material/Typography";
|
import Typography from "@mui/material/Typography";
|
||||||
import Breadcrumbs from "@/Components/v1/Breadcrumbs/index.jsx";
|
import Breadcrumbs from "@/Components/v1/Breadcrumbs/index.jsx";
|
||||||
import TextInput from "@/Components/v1/Inputs/TextInput/index.jsx";
|
import TextInput from "@/Components/v1/Inputs/TextInput/index.jsx";
|
||||||
@@ -126,7 +125,6 @@ const EditUser = () => {
|
|||||||
isSaving={isSaving}
|
isSaving={isSaving}
|
||||||
isLoading={isLoading}
|
isLoading={isLoading}
|
||||||
changePassword={changePassword}
|
changePassword={changePassword}
|
||||||
email={userToEdit?.email}
|
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|||||||
@@ -12,10 +12,8 @@ import {
|
|||||||
editSuperadminUserByIdBodyValidation,
|
editSuperadminUserByIdBodyValidation,
|
||||||
editUserPasswordByIdBodyValidation,
|
editUserPasswordByIdBodyValidation,
|
||||||
} from "../../validation/joi.js";
|
} from "../../validation/joi.js";
|
||||||
import ErrorService from "../../service/v1/infrastructure/errorService.js";
|
|
||||||
|
|
||||||
const SERVICE_NAME = "authController";
|
const SERVICE_NAME = "authController";
|
||||||
const errorService = new ErrorService();
|
|
||||||
/**
|
/**
|
||||||
* Authentication Controller
|
* Authentication Controller
|
||||||
*
|
*
|
||||||
@@ -438,7 +436,7 @@ class AuthController extends BaseController {
|
|||||||
async (req, res) => {
|
async (req, res) => {
|
||||||
const roles = req?.user?.role;
|
const roles = req?.user?.role;
|
||||||
if (!roles.includes("superadmin")) {
|
if (!roles.includes("superadmin")) {
|
||||||
throw errorService.createError("Unauthorized", 403);
|
throw this.errorService.createError("Unauthorized", 403);
|
||||||
}
|
}
|
||||||
|
|
||||||
const userId = req.params.userId;
|
const userId = req.params.userId;
|
||||||
@@ -462,7 +460,7 @@ class AuthController extends BaseController {
|
|||||||
async (req, res) => {
|
async (req, res) => {
|
||||||
const roles = req?.user?.role;
|
const roles = req?.user?.role;
|
||||||
if (!roles.includes("superadmin")) {
|
if (!roles.includes("superadmin")) {
|
||||||
throw errorService.createError("Unauthorized", 403);
|
throw this.errorService.createError("Unauthorized", 403);
|
||||||
}
|
}
|
||||||
|
|
||||||
const userId = req.params.userId;
|
const userId = req.params.userId;
|
||||||
|
|||||||
@@ -671,8 +671,6 @@ const editSuperadminUserByIdBodyValidation = joi.object({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const editUserPasswordByIdBodyValidation = joi.object({
|
const editUserPasswordByIdBodyValidation = joi.object({
|
||||||
email: joi.string().required(),
|
|
||||||
newPassword: joi.string().min(8).required().pattern(passwordPattern),
|
|
||||||
password: joi.string().min(8).required().pattern(passwordPattern),
|
password: joi.string().min(8).required().pattern(passwordPattern),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user