From 625578f56d7da53d7349d77c2f053e0639929e78 Mon Sep 17 00:00:00 2001 From: britea Date: Thu, 5 Mar 2020 11:02:33 +0100 Subject: [PATCH 1/2] added pages to reset password --- smart-hut/src/App.js | 34 ++++++++-------------------------- smart-hut/src/views/Signup.js | 2 ++ 2 files changed, 10 insertions(+), 26 deletions(-) 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/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); From 9390cdc0c0c6dfc41325d0b3d54aa07438fc2904 Mon Sep 17 00:00:00 2001 From: britea Date: Thu, 5 Mar 2020 11:03:44 +0100 Subject: [PATCH 2/2] added components --- smart-hut/src/views/Forgot-pass-reset.js | 85 ++++++++++++++++++++++++ smart-hut/src/views/Forgot-password.js | 67 +++++++++++++++++++ 2 files changed, 152 insertions(+) create mode 100644 smart-hut/src/views/Forgot-pass-reset.js create mode 100644 smart-hut/src/views/Forgot-password.js 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