Skip to content
This repository was archived by the owner on Oct 30, 2022. It is now read-only.

Commit 3c36e6b

Browse files
Add forgot & reset password components (#119)
* add controller for forgot password and reset password * add password change specific route * add instance method * add route for password change specific routers * Update pwd.controllers.js updated controller, and removed comments * Update server.js removed comments * add express rate limiter for blocking concurrent requests * Update pwd.route.js Added middleware for rate limiting * Create ratelimiter.middleware.js Added a middleware which returns the rate limit function, configuration change can be addressed in a single location * add middleware * add new feature * add forgot_password Link * Update pwd.controllers.js * update reset route * add AXIOS * add AXIOS * update response code
1 parent c1d364b commit 3c36e6b

File tree

5 files changed

+757
-32
lines changed

5 files changed

+757
-32
lines changed

client/src/App.js

Lines changed: 58 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import React, { useState, useEffect } from 'react'
2-
import { BrowserRouter as Router, Route, Redirect } from "react-router-dom";
1+
import React, { useState, useEffect } from 'react';
2+
import { BrowserRouter as Router, Route, Redirect } from 'react-router-dom';
33
import { createBrowserHistory } from 'history';
44

55
import Room from './Components/Room/Room';
@@ -9,60 +9,87 @@ import JoinRoom from './Components/Room/JoinRoom';
99
import CreateRoom from './Components/Room/CreateRoom';
1010
import FrontPage from './Components/FrontPage/FrontPage';
1111
import LoginPage from './Components/Auth/Login/LoginPage';
12+
import ForgotPassword from './Components/Auth/ForgotPassword/ForgotPassword';
13+
import ResetPassword from './Components/Auth/ResetPassword/ResetPassword';
1214
import Register from './Components/Auth/Register/Register';
1315
import Cookies from 'universal-cookie';
14-
import ProtectedRoute from './Protected'
16+
import ProtectedRoute from './Protected';
1517
import Trial from './Components/trial/trial';
1618
import ReactGA from 'react-ga';
17-
import TeamPage from './Components/Team Page/TeamPage'
19+
import TeamPage from './Components/Team Page/TeamPage';
1820
import NotFound from './Components/NotFound/NotFound';
19-
import { Helmet } from "react-helmet";
20-
import { useMediaQuery } from 'react-responsive'
21+
import { Helmet } from 'react-helmet';
22+
import { useMediaQuery } from 'react-responsive';
2123
import Mobile from './Components/Mobile/Mobile';
2224
const cookies = new Cookies();
2325
const history = createBrowserHistory();
2426

25-
const isAuthenticated = JSON.parse(localStorage.getItem('authUser'))?.token
27+
const isAuthenticated = JSON.parse(localStorage.getItem('authUser'))?.token;
2628
function App() {
2729
// useEffect(() => {
2830
// console.log({ authroot: isAuthenticated });
2931
// }, [isAuthenticated])
3032
useEffect(() => {
3133
ReactGA.initialize('UA-213485416-1');
3234
ReactGA.pageview(window.location.pathname + window.location.search);
33-
}, [])
35+
}, []);
3436

35-
const [loginUser, setLoginUser] = useState(null)
37+
const [loginUser, setLoginUser] = useState(null);
3638
const isDesktopOrLaptop = useMediaQuery({
37-
query: '(min-width: 1224px)'
38-
})
39-
const isBigScreen = useMediaQuery({ query: '(min-width: 1200px)' })
40-
41-
42-
43-
console.log({ isBigScreen})
39+
query: '(min-width: 1224px)',
40+
});
41+
const isBigScreen = useMediaQuery({ query: '(min-width: 1200px)' });
4442

43+
console.log({ isBigScreen });
4544

4645
return (
4746
<>
48-
<Helmet >
47+
<Helmet>
4948
<title>CodeSync</title>
50-
<meta name="description" content="Cloud collaborative tool for student , Teachers and Professional with real time code editor or IDE, Realtime drawing board , Real time chat app "/>
49+
<meta
50+
name='description'
51+
content='Cloud collaborative tool for student , Teachers and Professional with real time code editor or IDE, Realtime drawing board , Real time chat app '
52+
/>
5153
</Helmet>
52-
{isBigScreen == true ? <Router history={history}>
53-
<Route path="/" component={FrontPage} exact />
54-
<Route path="/login" render={(props) => <LoginPage {...props} />} exact />
55-
<Route path="/register" component={Register} exact />
56-
<ProtectedRoute path='/room' component={HomePage} exact />
57-
<Route path='/room/:id' render={(props) => (isAuthenticated ? <Room {...props} /> : <Redirect to="/login" />)} exact />
58-
<ProtectedRoute path='/joinRoom' render={JoinRoom} exact />
59-
<Route path='/newRoom' render={(props) => isAuthenticated ? <CreateRoom {...props} /> : <Redirect to="/login" />} exact />
60-
<Route path='/editor' render={Editor} exact />
61-
<Route path='/trial' render={(props) => <Trial {...props} />} exact />
62-
<Route path="/team" component={TeamPage} exact />
54+
{isBigScreen == true ? (
55+
<Router history={history}>
56+
<Route path='/' component={FrontPage} exact />
57+
<Route path='/forgot_password' exact component={ForgotPassword} />
58+
<Route path='/_reset_password/:id' exact component={ResetPassword} />
6359

64-
</Router> : <Mobile />}
65-
60+
<Route
61+
path='/login'
62+
render={(props) => <LoginPage {...props} />}
63+
exact
64+
/>
65+
<Route path='/register' component={Register} exact />
66+
<ProtectedRoute path='/room' component={HomePage} exact />
67+
<Route
68+
path='/room/:id'
69+
render={(props) =>
70+
isAuthenticated ? <Room {...props} /> : <Redirect to='/login' />
71+
}
72+
exact
73+
/>
74+
<ProtectedRoute path='/joinRoom' render={JoinRoom} exact />
75+
<Route
76+
path='/newRoom'
77+
render={(props) =>
78+
isAuthenticated ? (
79+
<CreateRoom {...props} />
80+
) : (
81+
<Redirect to='/login' />
82+
)
83+
}
84+
exact
85+
/>
86+
<Route path='/editor' render={Editor} exact />
87+
<Route path='/trial' render={(props) => <Trial {...props} />} exact />
88+
<Route path='/team' component={TeamPage} exact />
89+
</Router>
90+
) : (
91+
<Mobile />
92+
)}
6693
</>
6794
);
6895
}

0 commit comments

Comments
 (0)