From bb11babc5b1e1831e01f2c72801b73819ad86652 Mon Sep 17 00:00:00 2001 From: britea Date: Sun, 10 May 2020 23:50:59 +0200 Subject: [PATCH] fixed other duplications --- smart-hut/src/App.js | 9 +- smart-hut/src/views/ConfirmForgotPassword.js | 38 +------ smart-hut/src/views/Forgot-pass-reset.js | 114 ------------------- smart-hut/src/views/Forgot-password.js | 89 ++++++++++++--- smart-hut/src/views/ForgotPassword.js | 91 --------------- 5 files changed, 81 insertions(+), 260 deletions(-) delete mode 100644 smart-hut/src/views/Forgot-pass-reset.js delete mode 100644 smart-hut/src/views/ForgotPassword.js diff --git a/smart-hut/src/App.js b/smart-hut/src/App.js index 602e77f..6598de0 100644 --- a/smart-hut/src/App.js +++ b/smart-hut/src/App.js @@ -6,7 +6,6 @@ import Signup from "./views/Signup"; import Login from "./views/Login"; import FourOhFour from "./views/FourOhFour"; import ForgotPass from "./views/Forgot-password"; -import ChangePass from "./views/Forgot-pass-reset"; import ConfirmForgotPasswrod from "./views/ConfirmForgotPassword"; import ConfirmRegistration from "./views/ConfirmRegistration"; import ConfirmResetPassword from "./views/ConfirmResetPassword"; @@ -49,7 +48,7 @@ class App extends Component { {this.props.loggedIn ? : } - + @@ -60,9 +59,11 @@ class App extends Component { - + + + - + diff --git a/smart-hut/src/views/ConfirmForgotPassword.js b/smart-hut/src/views/ConfirmForgotPassword.js index 1f4d0ec..c025a75 100644 --- a/smart-hut/src/views/ConfirmForgotPassword.js +++ b/smart-hut/src/views/ConfirmForgotPassword.js @@ -1,40 +1,10 @@ import React, { Component } from "react"; -import { - Image, - Grid, - Button, - Icon, - Header, - Container, -} from "semantic-ui-react"; +import Confirm from "./Confirm"; +const msg = + "An E-mail has been sent to your address, confirm your registration by following the enclosed link. If you don't find the E-mail please check also the spam folder."; export default class ConfirmForgotPasswrod extends Component { render() { - return ( - - - - -
- Link has been sent! -
- -

- An E-mail has been sent to your address, please follow the - instructions to create a new password. If you don't find the - E-mail please check also the spam folder. -

-
-
-
-
- ); + return ; } } diff --git a/smart-hut/src/views/Forgot-pass-reset.js b/smart-hut/src/views/Forgot-pass-reset.js deleted file mode 100644 index 24ed9e6..0000000 --- a/smart-hut/src/views/Forgot-pass-reset.js +++ /dev/null @@ -1,114 +0,0 @@ -import React, { Component } from "react"; -import { - Button, - Form, - Grid, - Header, - Image, - Icon, - Message, -} from "semantic-ui-react"; -import { Redirect } from "react-router-dom"; -import { Forms } from "../remote"; - -export default class ChangePass extends Component { - constructor(props) { - super(props); - this.state = { - password: "", - error: { - state: false, - message: "", - }, - success: false, - }; - this.handleChangePassword = this.handleChangePassword.bind(this); - } - - onChangeHandler = (event) => { - let nam = event.target.name; - let val = event.target.value; - this.setState({ [nam]: val }); - }; - - handleChangePassword = (e) => { - if (this.state.confirmPassword !== this.state.password) { - this.setState({ - error: { - state: true, - message: "Passwords do not match.", - }, - }); - } - - Forms.submitResetPassword(this.props.query.token, this.state.password) - .then(() => this.setState({ success: true })) - .catch((err) => - this.setState({ - error: { state: true, message: err.messages.join(" - ") }, - }) - ); - }; - - render() { - if (this.state.success) { - return ; - } - return ( - - - - -
- Reset Password -
-
- - - - - -
-
-
- ); - } -} diff --git a/smart-hut/src/views/Forgot-password.js b/smart-hut/src/views/Forgot-password.js index 6ebc2a5..bf3064e 100644 --- a/smart-hut/src/views/Forgot-password.js +++ b/smart-hut/src/views/Forgot-password.js @@ -22,6 +22,8 @@ export default class ForgotPass extends Component { }, success: false, }; + + this.handleChangePassword = this.handleChangePassword.bind(this); } onChangeHandler = (event) => { @@ -40,7 +42,27 @@ export default class ForgotPass extends Component { ); }; + handleChangePassword = (e) => { + if (this.state.confirmPassword !== this.state.password) { + this.setState({ + error: { + state: true, + message: "Passwords do not match.", + }, + }); + } + + Forms.submitResetPassword(this.props.query.token, this.state.password) + .then(() => this.setState({ success: true })) + .catch((err) => + this.setState({ + error: { state: true, message: err.messages.join(" - ") }, + }) + ); + }; + render() { + console.log(this.props); if (this.state.success) { return ; } @@ -74,23 +96,56 @@ export default class ForgotPass extends Component { ))} - - + {this.props.type === "FPassword1" ? ( + + + + + ) : ( + + + + + + )} diff --git a/smart-hut/src/views/ForgotPassword.js b/smart-hut/src/views/ForgotPassword.js deleted file mode 100644 index b6ade3f..0000000 --- a/smart-hut/src/views/ForgotPassword.js +++ /dev/null @@ -1,91 +0,0 @@ -import React, { Component } from "react"; -import { render } from "react-dom"; -import HomeNavbar from "./../components/HomeNavbar"; -import { - Container, - Icon, - Image, - Menu, - Sidebar, - Responsive, - Header, - Divider, - Message, - Grid, -} from "semantic-ui-react"; - -class Paragraph extends Component { - state = { visible: true }; - - handleDismiss = () => { - this.setState({ visible: false }); - - setTimeout(() => { - this.setState({ visible: true }); - }, 2000); - }; - - render() { - if (this.state.visible) { - return ( - - ); - } - - return ( -

-
- The message will return in 2s -
-
-

- ); - } -} - -const MessageReg = () => ( - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -); - -export default class ForgotPasswrod extends React.Component { - render() { - return ; - } -}