renamed to normal
This commit is contained in:
parent
1691500883
commit
ca25e3bcf8
1 changed files with 121 additions and 0 deletions
121
frontend/src/components/pages/BehaviorNormal.js
Normal file
121
frontend/src/components/pages/BehaviorNormal.js
Normal file
|
@ -0,0 +1,121 @@
|
||||||
|
import React, { useEffect } from "react";
|
||||||
|
import "../../App.css";
|
||||||
|
import Footer from "../../Footer";
|
||||||
|
import { Logger } from "@behametrics/logger-web";
|
||||||
|
import { useAuth } from "../../auth/AuthProvider";
|
||||||
|
import InputField from "../InputField";
|
||||||
|
import { useState } from "react/cjs/react.development";
|
||||||
|
import SubmitField from "../SubmitField";
|
||||||
|
|
||||||
|
export default function BehaviorNormal() {
|
||||||
|
const [username, setUsername] = useState("");
|
||||||
|
const [password, setPassword] = useState("");
|
||||||
|
|
||||||
|
const handleUsernameChange = (e) => {
|
||||||
|
setUsername(e.target.value);
|
||||||
|
};
|
||||||
|
const handlePasswordChange = (e) => {
|
||||||
|
setPassword(e.target.value);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleOnCopyEvent = (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
console.log("copy not allowed");
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleOnPasteEvent = (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
console.log("paste not allowed");
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
const onSubmitClick = (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
let opts = {
|
||||||
|
username: username,
|
||||||
|
password: password,
|
||||||
|
};
|
||||||
|
fetch("/api/protected/behavior", {
|
||||||
|
method: "post",
|
||||||
|
body: JSON.stringify(opts),
|
||||||
|
}).then((response) => {
|
||||||
|
if (response.status === 401) {
|
||||||
|
response.json().then((resp) => {
|
||||||
|
console.log("nicht so wirklich gut");
|
||||||
|
// setErrorMessage(resp.message);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
response.json().then((token) => {
|
||||||
|
console.log("Alles gut :-)");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
let logger = new Logger({
|
||||||
|
//inputs: ["cursor", "wheel", "keyboard", "touch"],
|
||||||
|
inputs: ["keyboard"],
|
||||||
|
// logToConsole: true,
|
||||||
|
});
|
||||||
|
logger.init();
|
||||||
|
|
||||||
|
let [isLoggedIn] = useAuth();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
document.title = `${isLoggedIn}`;
|
||||||
|
if (isLoggedIn === false) {
|
||||||
|
logger.stop();
|
||||||
|
} else {
|
||||||
|
logger.start();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<div className="sitePage">
|
||||||
|
<h1>Studie</h1>
|
||||||
|
<p>
|
||||||
|
Nachfolgend werden Sie einige Schritte durchlaufen, um ihre
|
||||||
|
Nutzerinteraktion messen zu können. Verwenden Sie hierbei jeweils
|
||||||
|
ihren Benutzernamen, welchen Sie bereits zuvor genutzt haben. Das
|
||||||
|
Passwort wird jeweils generiert.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Zu Beginn geht es darum, dass Sie ganz normal den Benutzernamen und
|
||||||
|
das Passwort eingeben. Verhalten Sie sich einfach so, als ob Sie sich
|
||||||
|
normalerweise anmelden.
|
||||||
|
</p>
|
||||||
|
<p onCopy={handleOnCopyEvent}>
|
||||||
|
Das Passwort für diese Situation lautet: abcdefgeh
|
||||||
|
</p>
|
||||||
|
<form action="#">
|
||||||
|
<InputField
|
||||||
|
LabelName="Benutzername"
|
||||||
|
onChange={handleUsernameChange}
|
||||||
|
InputType="text"
|
||||||
|
InputName="Benutzername"
|
||||||
|
InputPlaceHolder="Benutzername"
|
||||||
|
onCopy={handleOnCopyEvent}
|
||||||
|
onPaste={handleOnPasteEvent}
|
||||||
|
/>
|
||||||
|
<InputField
|
||||||
|
LabelName="Passwort"
|
||||||
|
onChange={handlePasswordChange}
|
||||||
|
InputType="password"
|
||||||
|
InputName="Passwort"
|
||||||
|
InputPlaceHolder="Benutzername"
|
||||||
|
onCopy={handleOnCopyEvent}
|
||||||
|
onPaste={handleOnPasteEvent}
|
||||||
|
/>
|
||||||
|
<SubmitField
|
||||||
|
LabelName="Weiter zur nächsten Situation"
|
||||||
|
InputValue="next-situation"
|
||||||
|
InputName="Weiter"
|
||||||
|
onClick={onSubmitClick}
|
||||||
|
/>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<Footer />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
Loading…
Reference in a new issue