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/components/FilterDevices.js b/smart-hut/src/components/FilterDevices.js deleted file mode 100644 index bc241b1..0000000 --- a/smart-hut/src/components/FilterDevices.js +++ /dev/null @@ -1,82 +0,0 @@ -import { Dropdown } from "semantic-ui-react"; -import React, { Component } from "react"; - -export default class FilterDevices extends Component { - render() { - const tagOptions = [ - { - key: "regularLight", - text: "regularLight", - value: "regularLight", - label: { color: "red", empty: true, circular: true }, - }, - { - key: "dimmableLight", - text: "dimmableLight", - value: "dimmableLight", - label: { color: "blue", empty: true, circular: true }, - }, - { - key: "buttonDimmer", - text: "buttonDimmer", - value: "buttonDimmer", - label: { color: "black", empty: true, circular: true }, - }, - { - key: "knobDimmer", - text: "knobDimmer", - value: "knobDimmer", - label: { color: "purple", empty: true, circular: true }, - }, - { - key: "motionSensor", - text: "motionSensor", - value: "motionSensor", - label: { color: "orange", empty: true, circular: true }, - }, - { - key: "sensor", - text: "sensor", - value: "sensor", - label: { empty: true, circular: true }, - }, - { - key: "smartPlug", - text: "smartPlug", - value: "smartPlug", - label: { color: "pink", empty: true, circular: true }, - }, - { - key: "switch", - text: "switch", - value: "switch", - label: { color: "green", empty: true, circular: true }, - }, - ]; - - return ( - - - - - - {tagOptions.map((option) => ( - - ))} - - - - ); - } -} diff --git a/smart-hut/src/components/dashboard/AutomationCreationModal.js b/smart-hut/src/components/dashboard/AutomationCreationModal.js index e0ef5f6..84f3a76 100644 --- a/smart-hut/src/components/dashboard/AutomationCreationModal.js +++ b/smart-hut/src/components/dashboard/AutomationCreationModal.js @@ -431,7 +431,7 @@ class AutomationSaveModal extends Component { automation.id = this.props.id; automation.triggers = []; automation.scenes = []; - + automation.conditions = []; for (let i = 0; i < this.state.order.length; i++) { automation.scenes.push({ priority: i, 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 ( - - - - Go Home{" "} - - - - - 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 ( - - - - Go Home{" "} - - - - - Reset Password - - - - - - - Confirm 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 { ))} - - - Send E-mail - + {this.props.type === "FPassword1" ? ( + + + + Send E-mail + + + ) : ( + + + + + Confirm password + + + )} 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 ; - } -}
- 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. -
- - The message will return in 2s - - -