added pages to reset password

This commit is contained in:
britea 2020-03-05 11:02:33 +01:00
parent 8074774d8b
commit 625578f56d
2 changed files with 10 additions and 26 deletions

View file

@ -4,34 +4,11 @@ import Home from "./views/Home";
import Dashboard from "./views/DashboardTest"; import Dashboard from "./views/DashboardTest";
import Signup from "./views/Signup"; import Signup from "./views/Signup";
import Login from "./views/Login"; import Login from "./views/Login";
import ForgotPass from "./views/Forgot-password";
import ChangePass from "./views/Forgot-pass-reset";
import { call } from './client_server'; import { call } from './client_server';
/*const ProtectedRoute = ({ component: Comp, loggedIn, logOut, path, ...rest }) => {
return (
<Route
path={path}
{...rest}
render={(props) => {
return loggedIn ? (
<Comp logOut={logOut} {...props} />
) : (
<Redirect
to={{
pathname: "/login",
state: {
prevLocation: path,
error: "You need to login first!",
},
}}
/>
);
}}
/>
);
};*/
class App extends React.Component { class App extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
@ -101,7 +78,12 @@ class App extends React.Component {
<Route path="/dashboard" > <Route path="/dashboard" >
{this.state.loggedIn ? <Dashboard logout={this.logout} /> : <Redirect to="/login" />} {this.state.loggedIn ? <Dashboard logout={this.logout} /> : <Redirect to="/login" />}
</Route> </Route>
<Route path="/forgot-password" >
<ForgotPass />
</Route>
<Route path="/forgot-pass-change" >
<ChangePass />
</Route>
</Switch> </Switch>
); );
} }

View file

@ -31,6 +31,8 @@ export default class Signup extends Component{
if (res.status === "Errore") { if (res.status === "Errore") {
this.setState({error: { state: true, this.setState({error: { state: true,
message: "Errore"}}); message: "Errore"}});
} else if (res.status === 200 && res.data){
this.props.history.push("/");
} }
}).catch(err => { }).catch(err => {
//console.log(err); //console.log(err);