diff --git a/smart-hut/src/App.js b/smart-hut/src/App.js index fd6ccee..530ffcb 100644 --- a/smart-hut/src/App.js +++ b/smart-hut/src/App.js @@ -4,34 +4,11 @@ import Home from "./views/Home"; import Dashboard from "./views/DashboardTest"; import Signup from "./views/Signup"; import Login from "./views/Login"; +import ForgotPass from "./views/Forgot-password"; +import ChangePass from "./views/Forgot-pass-reset"; import { call } from './client_server'; - -/*const ProtectedRoute = ({ component: Comp, loggedIn, logOut, path, ...rest }) => { - return ( - { - return loggedIn ? ( - - ) : ( - - ); - }} - /> - ); -};*/ - class App extends React.Component { constructor(props) { super(props); @@ -101,7 +78,12 @@ class App extends React.Component { {this.state.loggedIn ? : } - + + + + + + ); } diff --git a/smart-hut/src/views/Forgot-pass-reset.js b/smart-hut/src/views/Forgot-pass-reset.js new file mode 100644 index 0000000..39496d5 --- /dev/null +++ b/smart-hut/src/views/Forgot-pass-reset.js @@ -0,0 +1,85 @@ +import React, {Component} from 'react'; +import {Button, Form, Grid, Header, Image, Icon, Message} from 'semantic-ui-react'; +//import { call } from '../client_server'; + + +export default class ChangePass extends Component { + constructor(props) { + super(props); + this.state = { + password: "", + error: { + state: false, + message: "", + } + } + } + + onChangeHandler = (event) => { + let nam = event.target.name; + let val = event.target.value; + this.setState({[nam]: val}); + }; + + checkpassword = (e) => { + if (e.target.value !== this.state.password) { + this.setState({error: { + state : true, + message : "Passwords do not match.", + }}); + } + }; + + handleChangePassword = (e) => { + + }; + + render() { + return ( + + + + +
+ Reset Password +
+
+ + + + + +
+
+
+ ) + } +} \ No newline at end of file diff --git a/smart-hut/src/views/Forgot-password.js b/smart-hut/src/views/Forgot-password.js new file mode 100644 index 0000000..b3f1e93 --- /dev/null +++ b/smart-hut/src/views/Forgot-password.js @@ -0,0 +1,67 @@ +import React, {Component} from 'react'; +import {Button, Form, Grid, Header, Image, Icon, Message} from 'semantic-ui-react'; +//import { call } from '../client_server'; + + +export default class ForgotPass extends Component { + constructor(props) { + super(props); + this.state = { + user: "", + error: { + state: false, + message: "", + } + } + } + + onChangeHandler = (event) => { + let nam = event.target.name; + let val = event.target.value; + this.setState({[nam]: val}); + }; + + handleSendEmail = (e) => { + + }; + + render() { + return ( + + + + +
+ Reset Password +
+
+ + + + +
+
+
+ ) + } +} \ No newline at end of file diff --git a/smart-hut/src/views/Signup.js b/smart-hut/src/views/Signup.js index 503683b..9c301aa 100644 --- a/smart-hut/src/views/Signup.js +++ b/smart-hut/src/views/Signup.js @@ -31,6 +31,8 @@ export default class Signup extends Component{ if (res.status === "Errore") { this.setState({error: { state: true, message: "Errore"}}); + } else if (res.status === 200 && res.data){ + this.props.history.push("/"); } }).catch(err => { //console.log(err);