From 5712483efb7e9acf92793e2a90b496e9b9d96047 Mon Sep 17 00:00:00 2001 From: britea Date: Thu, 26 Mar 2020 08:34:21 +0100 Subject: [PATCH] fixed redirect reset password --- smart-hut/src/components/HeaderController.js | 15 +--------- smart-hut/src/views/Forgot-pass-reset.js | 29 ++++++++++---------- 2 files changed, 16 insertions(+), 28 deletions(-) diff --git a/smart-hut/src/components/HeaderController.js b/smart-hut/src/components/HeaderController.js index cbcbadb..d5a5e19 100644 --- a/smart-hut/src/components/HeaderController.js +++ b/smart-hut/src/components/HeaderController.js @@ -1,21 +1,8 @@ import React from "react"; -import { - Dropdown, - Icon, - Grid, - Divider, - Button, - Label, - Responsive, -} from "semantic-ui-react"; +import { Grid, Divider, Button, Label, Responsive } from "semantic-ui-react"; import { Segment, Image } from "semantic-ui-react"; -import { BrowserView, MobileView } from "react-device-detect"; import { call } from "../client_server"; -const AvatarImage = () => ( - -); - const IconHomeImage = () => ( { - if (e.target.value !== this.state.password) { + handleChangePassword = (e) => { + const params = { + confirmationToken: this.props.query.token, + password: this.state.password, + }; + if (this.state.confirmPassword !== this.state.password) { this.setState({ error: { state: true, @@ -39,22 +44,15 @@ export default class ChangePass extends Component { }, }); } - }; - handleChangePassword = (e) => { - const params = { - confirmationToken: this.props.query.token, - password: this.state.password, - }; call .resetPassword(params) .then((res) => { - if (res.status !== 200) { - this.setState({ error: { state: true, message: "Errore" } }); + if (res.status === 200) { + this.setState({ success: true }); } else { - return ; + this.setState({ error: { state: true, message: "Errore" } }); } - // else set a message that an email has been sent }) .catch((err) => { console.log(err); @@ -62,6 +60,9 @@ export default class ChangePass extends Component { }; render() { + if (this.state.success) { + return ; + } return (