mirror of
https://github.com/bluewave-labs/Checkmate.git
synced 2026-01-25 03:09:32 -06:00
fix errors
This commit is contained in:
@@ -10,7 +10,7 @@ import { PasswordEndAdornment } from "@/Components/v1/Inputs/TextInput/Adornment
|
||||
import usePasswordFeedback from "@/Pages/v1/Auth/hooks/usePasswordFeedback";
|
||||
import PropTypes from "prop-types";
|
||||
|
||||
const ChangePasswordModal = ({ isSaving, isLoading, changePassword, email }) => {
|
||||
const ChangePasswordModal = ({ isSaving, isLoading, changePassword }) => {
|
||||
const INITIAL_FORM_STATE = {
|
||||
password: "",
|
||||
confirm: "",
|
||||
@@ -44,8 +44,6 @@ const ChangePasswordModal = ({ isSaving, isLoading, changePassword, email }) =>
|
||||
if (!isFormValid) return;
|
||||
const newPasswordForm = {
|
||||
password: form.password,
|
||||
newPassword: form.confirm,
|
||||
email: email,
|
||||
};
|
||||
try {
|
||||
setIsLoadingSubmit(true);
|
||||
@@ -146,7 +144,6 @@ ChangePasswordModal.propTypes = {
|
||||
isSaving: PropTypes.bool.isRequired,
|
||||
isLoading: PropTypes.bool.isRequired,
|
||||
changePassword: PropTypes.func.isRequired,
|
||||
email: PropTypes.string.isRequired,
|
||||
};
|
||||
|
||||
export default ChangePasswordModal;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// Components
|
||||
import Stack from "@mui/material/Stack";
|
||||
import Box from "@mui/material/Box";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import Breadcrumbs from "@/Components/v1/Breadcrumbs/index.jsx";
|
||||
import TextInput from "@/Components/v1/Inputs/TextInput/index.jsx";
|
||||
@@ -126,7 +125,6 @@ const EditUser = () => {
|
||||
isSaving={isSaving}
|
||||
isLoading={isLoading}
|
||||
changePassword={changePassword}
|
||||
email={userToEdit?.email}
|
||||
/>
|
||||
)}
|
||||
</Stack>
|
||||
|
||||
@@ -12,10 +12,8 @@ import {
|
||||
editSuperadminUserByIdBodyValidation,
|
||||
editUserPasswordByIdBodyValidation,
|
||||
} from "../../validation/joi.js";
|
||||
import ErrorService from "../../service/v1/infrastructure/errorService.js";
|
||||
|
||||
const SERVICE_NAME = "authController";
|
||||
const errorService = new ErrorService();
|
||||
/**
|
||||
* Authentication Controller
|
||||
*
|
||||
@@ -438,7 +436,7 @@ class AuthController extends BaseController {
|
||||
async (req, res) => {
|
||||
const roles = req?.user?.role;
|
||||
if (!roles.includes("superadmin")) {
|
||||
throw errorService.createError("Unauthorized", 403);
|
||||
throw this.errorService.createError("Unauthorized", 403);
|
||||
}
|
||||
|
||||
const userId = req.params.userId;
|
||||
@@ -462,7 +460,7 @@ class AuthController extends BaseController {
|
||||
async (req, res) => {
|
||||
const roles = req?.user?.role;
|
||||
if (!roles.includes("superadmin")) {
|
||||
throw errorService.createError("Unauthorized", 403);
|
||||
throw this.errorService.createError("Unauthorized", 403);
|
||||
}
|
||||
|
||||
const userId = req.params.userId;
|
||||
|
||||
@@ -671,8 +671,6 @@ const editSuperadminUserByIdBodyValidation = 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),
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user