gorgot password deploy

This commit is contained in:
pawan-dot 2025-05-08 14:18:16 +05:30
parent 64c927f27b
commit 10de1de3c2
6 changed files with 78 additions and 55 deletions

View File

@ -13,18 +13,19 @@
"license": "MIT", "license": "MIT",
"author": "The CoreUI Team (https://github.com/orgs/coreui/people)", "author": "The CoreUI Team (https://github.com/orgs/coreui/people)",
"scripts": { "scripts": {
"dev": "react-scripts start", "dev": "cross-env NODE_OPTIONS=--openssl-legacy-provider react-scripts start",
"build": "react-scripts --openssl-legacy-provider build", "build": "cross-env NODE_OPTIONS=--openssl-legacy-provider react-scripts build",
"changelog": "auto-changelog --starting-version 4.1.0 --commit-limit false --hide-credit", "changelog": "auto-changelog --starting-version 4.1.0 --commit-limit false --hide-credit",
"eject": "react-scripts eject", "eject": "react-scripts eject",
"lint": "eslint \"src/**/*.js\"", "lint": "eslint \"src/**/*.js\"",
"start": "serve -s build", "start": "serve -s build",
"start:n17": "react-scripts --openssl-legacy-provider start", "start:n17": "react-scripts --openssl-legacy-provider start",
"test": "react-scripts test", "test": "react-scripts test",
"test:cov": "npm test -- --coverage --watchAll=false", "test:cov": "npm test -- --coverage --watchAll=false",
"test:debug": "react-scripts --inspect-brk test --runInBand", "test:debug": "react-scripts --inspect-brk test --runInBand",
"heroku-postbuild": "npm run build" "heroku-postbuild": "npm run build"
}, }
,
"config": { "config": {
"coreui_library_short_version": "4.1" "coreui_library_short_version": "4.1"
}, },
@ -86,6 +87,7 @@
}, },
"devDependencies": { "devDependencies": {
"auto-changelog": "~2.3.0", "auto-changelog": "~2.3.0",
"cross-env": "^7.0.3",
"fuse.js": "^6.6.2", "fuse.js": "^6.6.2",
"react-scripts": "^4.0.3", "react-scripts": "^4.0.3",
"sass": "^1.43.5" "sass": "^1.43.5"

View File

@ -199,6 +199,7 @@ import { isAutheticated } from "./auth";
import "./scss/style.scss"; import "./scss/style.scss";
import ProtectedRoute from "./components/ProtectedRoute"; import ProtectedRoute from "./components/ProtectedRoute";
import axios from "axios"; import axios from "axios";
import ForgotPassword from "./views/pages/register/ForgotPassword";
// Containers // Containers
const DefaultLayout = React.lazy(() => import("./layout/DefaultLayout")); const DefaultLayout = React.lazy(() => import("./layout/DefaultLayout"));
@ -254,6 +255,8 @@ const App = () => {
<Routes> <Routes>
{/* <Route exact path="/change-password" name="My profile" element={<ChangePassword />} /> */} {/* <Route exact path="/change-password" name="My profile" element={<ChangePassword />} /> */}
<Route exact path="/" name="Login Page" element={<Login />} /> <Route exact path="/" name="Login Page" element={<Login />} />
<Route exact path="/forgot/password" name="Login Page" element={<ForgotPassword />} />
<Route exact path="/404" name="Page 404" element={<Page404 />} /> <Route exact path="/404" name="Page 404" element={<Page404 />} />
<Route exact path="/500" name="Page 500" element={<Page500 />} /> <Route exact path="/500" name="Page 500" element={<Page500 />} />
<Route <Route

View File

@ -16,7 +16,10 @@ import { createRoot } from "react-dom/client";
const setupAxios = () => { const setupAxios = () => {
// axios.defaults.baseURL = "http://localhost:5000"; // axios.defaults.baseURL = "http://localhost:5000";
//Old render deploy
// axios.defaults.baseURL = "https://cheminova-api-2.onrender.com"; // axios.defaults.baseURL = "https://cheminova-api-2.onrender.com";
//latest render deploy
//axios.defaults.baseURL = "https://cheminova-api1.onrender.com"
axios.defaults.baseURL = "https://api.cnapp.co.in"; axios.defaults.baseURL = "https://api.cnapp.co.in";
axios.defaults.headers = { axios.defaults.headers = {

View File

@ -179,6 +179,7 @@ import DistributorLiqudations from "./views/PrincipalDistributors/DistributorLiq
import UpdatePrincipalDistributor from "./views/PrincipalDistributors/updateprincipaldistributor"; import UpdatePrincipalDistributor from "./views/PrincipalDistributors/updateprincipaldistributor";
import RDViewOrder from "./views/RetailerOrders/ViewOrder"; import RDViewOrder from "./views/RetailerOrders/ViewOrder";
import RetailerOrder from "./views/RetailerOrders/RetailerOrder"; import RetailerOrder from "./views/RetailerOrders/RetailerOrder";
import ForgotPassword from "./views/pages/register/ForgotPassword";
const routes = [ const routes = [
//dashboard //dashboard
@ -189,6 +190,12 @@ const routes = [
element: Change_Password, element: Change_Password,
navName: "", navName: "",
}, },
{
path: "/forgot/password",
name: "Forgot Password",
element: ForgotPassword,
navName: "",
},
{ {
path: "/profile/edit", path: "/profile/edit",
name: "Edit Profile", name: "Edit Profile",

View File

@ -202,9 +202,11 @@ const Login = () => {
</Link> </Link>
<br /> <br />
{/* <CButton color="link" className="px-0"> <Link to="/forgot/password">
<Link to="/password/forgot">Forgot password.?</Link> <CButton className="px-0" color="link">
</CButton> */} Forgot password.?
</CButton>
</Link>
</CForm> </CForm>
</CCardBody> </CCardBody>
{/* <CButton color="" className="px-0"> {/* <CButton color="" className="px-0">

View File

@ -30,17 +30,19 @@ const ForgotPassword = () => {
try { try {
setLoading(true) setLoading(true)
const res = await axios.post(`/api/v1/user/password/forgot`, { email: email }) const res = await axios.post(`https://cheminova-api1.onrender.com/api/v1/user/password/forgot`, { email: email })
// console.log(res); // console.log(res);
if (res.data.success === true) { if (res.data.success === true) {
setLoading(false) setLoading(false)
// alert("Email Send Successfully! please check your mail for reset password") // alert("Email Send Successfully! please check your mail for reset password")
swal("success!", "Email Send Successfully! please check your Email for new password", "success"); swal("success!", "'Password sent to your email Successfully!", "success");
navigate("/"); navigate("/");
} }
} catch (e) { } catch (error) {
swal('Error!', 'Wrong Email ID. Enter valid email to get the password', 'error') const errorMessage = error?.response?.data?.message || 'Something went wrong!';
swal('Error!', errorMessage, 'error');
// swal('Error!', 'Wrong Email ID. Enter valid email to get the password', 'error')
setLoading(false) setLoading(false)
@ -52,49 +54,53 @@ const ForgotPassword = () => {
} }
return <div className="bg-light min-vh-100 d-flex flex-row align-items-center"> return (
<CContainer> <div
<CRow className="justify-content-center"> className=" min-vh-100 d-flex flex-row align-items-center"
<CCol md={9} lg={7} xl={6}> style={{ backgroundColor: "#179FAF" }}
<CCard className="mx-4"> >
<CCardBody className="p-4"> <CContainer>
<CForm> <CRow className="justify-content-center">
<h1>Forgot Password?</h1> <CCol md={9} lg={7} xl={6}>
<p className="text-medium-emphasis"> Enter your email Below, we will send you password in your Email</p> <CCard className="mx-4">
{/* <CInputGroup className="mb-3"> <CCardBody className="p-4">
<CForm>
<h1>Forgot Password?</h1>
<p className="text-medium-emphasis"> Enter your email Below, we will send you password in your Email</p>
{/* <CInputGroup className="mb-3">
<CInputGroupText> <CInputGroupText>
<CIcon icon={cilUser} /> <CIcon icon={cilUser} />
</CInputGroupText> </CInputGroupText>
<CFormInput placeholder="Username" autoComplete="username" /> <CFormInput placeholder="Username" autoComplete="username" />
</CInputGroup> */} </CInputGroup> */}
<CInputGroup className="mb-4"> <CInputGroup className="mb-4">
<CInputGroupText> <CInputGroupText>
<CIcon icon={cilEnvelopeOpen} /> <CIcon icon={cilEnvelopeOpen} />
</CInputGroupText> </CInputGroupText>
<CFormInput <CFormInput
type="email" type="email"
placeholder="Email" placeholder="Email"
autoComplete="email" autoComplete="email"
// value={email} // value={email}
onChange={(e) => setEmail(e.target.value)} onChange={(e) => setEmail(e.target.value)}
/> />
</CInputGroup> </CInputGroup>
<CButton color="primary" disabled={!email} onClick={() => handleSubmit()}> <CButton color="primary" disabled={!email} onClick={() => handleSubmit()}>
<ClipLoader loading={loading} size={18} /> <ClipLoader loading={loading} size={18} />
{!loading && "Send"} {!loading && "Send"}
</CButton> </CButton>
<Link to='/'> <Link to='/'>
<CButton color="secondary" className='ms-2'>Back to Login</CButton> <CButton color="secondary" className='ms-2'>Back to Login</CButton>
</Link> </Link>
</CForm> </CForm>
</CCardBody> </CCardBody>
</CCard> </CCard>
</CCol> </CCol>
</CRow> </CRow>
</CContainer> </CContainer>
</div>; </div>)
}; };
export default ForgotPassword; export default ForgotPassword;