From 58bd327377e123a8564eafe787405b52c3aacbca Mon Sep 17 00:00:00 2001 From: cami Date: Thu, 22 Jul 2021 05:20:37 +0200 Subject: [PATCH] Update some change password things.. --- frontend/src/components/BehaviorNormal.js | 7 ++++--- frontend/src/components/GeneratedPassword.js | 5 +++-- frontend/src/components/pages/Study.js | 15 +++++++++++---- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/frontend/src/components/BehaviorNormal.js b/frontend/src/components/BehaviorNormal.js index 9f64ef9..c427a02 100644 --- a/frontend/src/components/BehaviorNormal.js +++ b/frontend/src/components/BehaviorNormal.js @@ -1,8 +1,8 @@ import React from "react"; import "../App.css"; -import GeneratedPassword from "./GeneratedPassword" +import GeneratedPassword from "./GeneratedPassword"; -export default function BehaviorNormal() { +export default function BehaviorNormal(props) { return ( <>

@@ -10,7 +10,8 @@ export default function BehaviorNormal() { Passwort eingeben. Verhalten Sie sich einfach so, als ob Sie sich normalerweise anmelden.

- + {console.log("props", props)} + ); } diff --git a/frontend/src/components/GeneratedPassword.js b/frontend/src/components/GeneratedPassword.js index af03882..722fc2a 100644 --- a/frontend/src/components/GeneratedPassword.js +++ b/frontend/src/components/GeneratedPassword.js @@ -1,7 +1,7 @@ import React from "react"; import "../App.css"; -export default function GeneratedPassword() { +export default function GeneratedPassword(props) { const genPassword = "PASSWORT_MANUELL" const handleOnCopyEvent = (e) => { @@ -13,7 +13,8 @@ export default function GeneratedPassword() { <>

Das Passwort für diese Situation lautet:{" "} - {genPassword} + {console.log("component genpw, genpassword", props.genPassword)} + {props.genPassword}

); diff --git a/frontend/src/components/pages/Study.js b/frontend/src/components/pages/Study.js index 094479f..e369065 100644 --- a/frontend/src/components/pages/Study.js +++ b/frontend/src/components/pages/Study.js @@ -83,6 +83,12 @@ export default function Study() { }; const _genPassword = useRef(null); + let genPassword = ""; + + const setGenPassword = (tmp) => { + genPassword = tmp; + console.log("setGenPassword", genPassword, tmp); + }; const receiveRandomPassword = () => { fetch("/api/rcv_pw", { @@ -90,7 +96,8 @@ export default function Study() { }).then((response) => { response.json().then((resp) => { _genPassword.current = resp.random_password; - console.log(_genPassword.current) + console.log(_genPassword.current); + setGenPassword(_genPassword.current); }); }); }; @@ -110,7 +117,7 @@ export default function Study() { if (checkIfPasswordIsCorrect() && checkIfUsernameIsCorrect) { return true; } else { - alert("Passt nicht") + alert("Passt nicht"); return false; } }; @@ -123,7 +130,7 @@ export default function Study() { }; const handleClickAtStepNormal = () => { - if (checkIfValuesAreCorrect()){ + if (checkIfValuesAreCorrect()) { receiveRandomPassword(); setIsStepNormal(false); setIsStepPhone(true); @@ -158,7 +165,7 @@ export default function Study() { const study_normal = ( <> - +