diff --git a/api/settings.php b/api/settings.php
new file mode 100644
index 0000000..0f21d3f
--- /dev/null
+++ b/api/settings.php
@@ -0,0 +1,17 @@
+getConnection();
+
+
+if (isset($_POST['action'])) {
+ $action = $_POST['action'];
+ switch ($action) {
+ case "isPasswordNeeded":
+ echo '{"password": true}';
+ break;
+ case "checkPassword":
+
+ break;
+ }
+}
\ No newline at end of file
diff --git a/src/App.js b/src/App.js
index d5009d5..1974d3b 100644
--- a/src/App.js
+++ b/src/App.js
@@ -7,11 +7,13 @@ import RandomPage from "./pages/RandomPage/RandomPage";
import 'bootstrap/dist/css/bootstrap.min.css';
import SettingsPage from "./pages/SettingsPage/SettingsPage";
import CategoryPage from "./pages/CategoryPage/CategoryPage";
+import {Spinner} from "react-bootstrap";
+import LoginPage from "./pages/LoginPage/LoginPage";
class App extends React.Component {
constructor(props, context) {
super(props, context);
- this.state = {page: "default"};
+ this.state = {page: "unverified"};
// bind this to the method for being able to call methods such as this.setstate
this.showVideo = this.showVideo.bind(this);
@@ -42,12 +44,42 @@ class App extends React.Component {
} else if (this.state.page === "lastpage") {
// return back to last page
page = this.mypage;
+ } else if (this.state.page === "loginpage") {
+ // return back to last page
+ page = ;
+ } else if (this.state.page === "unverified") {
+ // return back to last page
+ page =
+
diff --git a/src/css/App.css b/src/css/App.css
index af62d60..fe799d2 100644
--- a/src/css/App.css
+++ b/src/css/App.css
@@ -10,3 +10,8 @@
.nav-link:hover {
color: rgba(255, 255, 255, 1);
}
+
+.loadSpinner {
+ margin-top: 200px;
+ margin-left: 50%;
+}
diff --git a/src/pages/LoginPage/LoginPage.js b/src/pages/LoginPage/LoginPage.js
new file mode 100644
index 0000000..48a18e8
--- /dev/null
+++ b/src/pages/LoginPage/LoginPage.js
@@ -0,0 +1,60 @@
+import React from "react";
+import {Form} from "react-bootstrap";
+
+class LoginPage extends React.Component {
+ constructor(props) {
+ super(props);
+
+ this.state = {};
+
+ this.props = props;
+ }
+
+ render() {
+ return (
+ <>
+
+ Login Page
+ type correct password!
+
+
+
+
+ Password
+ {
+ this.password = v.target.value
+ }}/>
+
+ You can disable/enable this feature on settingspage.
+
+
+
+
+
+
+ >
+ );
+ }
+
+ checkPassword() {
+ const updateRequest = new FormData();
+ updateRequest.append("action", "checkPassword");
+ updateRequest.append("password", this.state.password);
+
+ fetch('/api/settings.php', {method: 'POST', body: updateRequest})
+ .then((response) => response.json()
+ .then((result) => {
+ if (result.correct) {
+ // todo 2020-06-18: call a callback to return back to right page
+ } else {
+ // error popup
+ }
+ }))
+ .catch(() => {
+ console.log("no connection to backend");
+ });
+ }
+}
+
+export default LoginPage;
\ No newline at end of file
diff --git a/src/pages/SettingsPage/SettingsPage.js b/src/pages/SettingsPage/SettingsPage.js
index 40c35d1..714167b 100644
--- a/src/pages/SettingsPage/SettingsPage.js
+++ b/src/pages/SettingsPage/SettingsPage.js
@@ -34,7 +34,10 @@ class SettingsPage extends React.Component {
if (this.myinterval) {
clearInterval(this.myinterval);
}
+ // todo 2020-06-18: maybe not start on mount
this.myinterval = setInterval(this.updateStatus, 1000);
+
+ // todo 2020-06-18: fetch path data here
}
componentWillUnmount() {