From 4235f31051c541560887f9f9f47bdceec133763c Mon Sep 17 00:00:00 2001 From: soyed Date: Thu, 8 Apr 2021 19:38:07 -0400 Subject: [PATCH 1/2] validate login page --- src/login-page/Login.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/login-page/Login.js b/src/login-page/Login.js index 57ead38..dfa2297 100644 --- a/src/login-page/Login.js +++ b/src/login-page/Login.js @@ -1,7 +1,7 @@ import React, { Component } from "react"; import Logo from "../images/logo1.png"; import "./Login.css"; -import { Link } from "react-router-dom"; +import { Link, Redirect, withRouter } from "react-router-dom"; // import { useTranslation } from "react-i18next"; import { withTranslation } from "react-i18next"; class Login extends Component { @@ -15,13 +15,15 @@ class Login extends Component { }; handleLogin = (e) => { - // e.preventDefault(); - // if ( !== this.state.Account.email) { - // alert("invalid"); - // } - // if (password !== this.state.Account.password) { - // alert("invalid"); - // } + e.preventDefault(); + var loginEmail = document.getElementById("login-email"); + if (loginEmail.value === this.state.Account.email) { + // alert("validated!!!"); + return this.props.history.push("/account"); + } else { + // alert("Errors!!") + return this.props.history.push("/login"); + } }; render() { @@ -80,4 +82,4 @@ class Login extends Component { } } -export default withTranslation()(Login); +export default withTranslation()(withRouter(Login)); From ad57c9bbb243e747462b51c0f1dee5e49e8d461e Mon Sep 17 00:00:00 2001 From: soyed Date: Thu, 8 Apr 2021 19:42:00 -0400 Subject: [PATCH 2/2] validate login --- public/assets/locales/en/translations.json | 9 +++------ public/assets/locales/fr/translations.json | 6 +----- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/public/assets/locales/en/translations.json b/public/assets/locales/en/translations.json index d075efa..e20bcfe 100644 --- a/public/assets/locales/en/translations.json +++ b/public/assets/locales/en/translations.json @@ -46,7 +46,7 @@ "Danger2": "There are some errors in your contact form.", "Success1": "The message is successfully sent.", "Success2": "You contact form will be delivered to our support team.", - "Contact-Title": "Contact to Us", + "Contact-Title": "Contact Us", "Contact-House": "Select an Agent", "Contact-Agent": "Select a House", "No-Pref": "No preference", @@ -58,17 +58,14 @@ "Contact-Error1": "Please select an item in the list.", "Contact-Error2": "Please fill out this field.", "Contact-Error3": "Invalid email address.", - - "Search-Bar":"Search your location", - "Budget":"Select Budget", + "Search-Bar": "Search your location", + "Budget": "Select Budget", "Beds": "Number of Beds", "Baths": "Number of Beds", - "Any": "Any", "Listing-Button": "Show Listing", "listing_desc": "{{desc}}", "listing_address": "{{address}}", - "Listing1-address": "8720 Russell Road", "Listing2-address": "1490 Youville Drive", "Listing3-address": "100 Charlie Rogers Place", diff --git a/public/assets/locales/fr/translations.json b/public/assets/locales/fr/translations.json index 732e6e0..b5d1d58 100644 --- a/public/assets/locales/fr/translations.json +++ b/public/assets/locales/fr/translations.json @@ -64,18 +64,14 @@ "Contact-Error1": "Veuillez sélectionner un élément dans la liste.", "Contact-Error2": "Veuillez remplir ce champ.", "Contact-Error3": "Adresse e-mail invalide.", - "Search-Bar": "Rechercher", - "Budget":"Sélectionnez Budget", + "Budget": "Sélectionnez Budget", "Beds": "Nombre de lits", "Baths": "Nombre de bains", "Any": "quelconque", "Listing-Button": "Afficher la liste", - "listing_desc": "{{desc}}", "listing_address": "{{address}}", - - "Listing1-address": "8720, chemin Russell", "Listing2-address": "1490, promenade Youville", "Listing3-address": "100, place Charlie Rogers",