Fixed email recover route
This commit is contained in:
parent
12b76715dd
commit
65851b5dc1
7 changed files with 19 additions and 12 deletions
|
|
@ -33,9 +33,7 @@ function MainPage() {
|
|||
if (!Cookies.get('token')) {
|
||||
navigate('/login');
|
||||
}
|
||||
});
|
||||
|
||||
useEffect(() => {}, []);
|
||||
}, [navigate]);
|
||||
|
||||
useEffect(() => {
|
||||
getMemberOrgs();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import React from 'react';
|
||||
import { Link, Outlet } from 'react-router-dom';
|
||||
import React, { useEffect } from 'react';
|
||||
import { Link, Outlet, useLocation } from 'react-router-dom';
|
||||
|
||||
import {
|
||||
AppBar,
|
||||
|
|
@ -14,12 +14,18 @@ import { ThemeProvider, createTheme } from '@mui/material/styles';
|
|||
|
||||
function Navbar({ token }) {
|
||||
const linkStyle = { textDecoration: 'none', color: 'inherit' };
|
||||
const { pathname } = useLocation();
|
||||
|
||||
const darkTheme = createTheme({
|
||||
palette: {
|
||||
mode: 'dark',
|
||||
},
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
console.log(pathname);
|
||||
}, [pathname]);
|
||||
|
||||
function ButtonGroup({ token }) {
|
||||
if (token) {
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -22,9 +22,11 @@ function Recover() {
|
|||
async function handleSubmit(e) {
|
||||
e.preventDefault();
|
||||
await axios
|
||||
.get(
|
||||
`${process.env.REACT_APP_API_ROOT}/auth/reset-password?${form.email}`
|
||||
)
|
||||
.get(`${process.env.REACT_APP_API_ROOT}/auth/reset-password`, {
|
||||
params: {
|
||||
email: form.email,
|
||||
},
|
||||
})
|
||||
.then((response) => {
|
||||
setSuccess(() => response.data);
|
||||
})
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@
|
|||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"install-all": "npm ci && npm ci --prefix client && npm ci --prefix server",
|
||||
"client": "npm start --prefix client",
|
||||
"server": "npm start --prefix server",
|
||||
"dev": "npm run build && npm run server",
|
||||
"build": "npm run env && npm run build --prefix client",
|
||||
"test": "npm run build && npm run server",
|
||||
"install-all": "npm ci && npm ci --prefix client && npm ci --prefix server",
|
||||
"env": "cp .env ./server/.env && cp .env ./client/.env",
|
||||
"package": "tar -czf ./dist.tar.gz ./.github ./.vscode ./client ./node_modules ./server .env .gitignore LICENSE package-lock.json package.json README.md",
|
||||
"dist": "npm run install-all && npm run build && npm run package"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
require('dotenv').config({ path: `../.env.${process.env.NODE_ENV}` });
|
||||
require('dotenv').config();
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const Sequelize = require('sequelize');
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ async function RequestReset(req, res, next) {
|
|||
data: {
|
||||
email: result.email,
|
||||
resetRequest: resetRequest.reqID,
|
||||
apiDomainRoot: process.env.REACT_APP_DOMAIN_ROOT,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ async function ResetPassword(req, res, next) {
|
|||
return res.status(400).send('Form missing required information.');
|
||||
}
|
||||
|
||||
const result = await ResetRequest.findOne({ where: { reqID: reqID } });
|
||||
const result = await ResetRequest.findByPk(reqID);
|
||||
|
||||
if (!result) {
|
||||
return res
|
||||
|
|
|
|||
Reference in a new issue