diff --git a/src/components/SettingsPage/index.js b/src/components/SettingsPage/index.js
index 90f3b2da..4aa77771 100644
--- a/src/components/SettingsPage/index.js
+++ b/src/components/SettingsPage/index.js
@@ -85,7 +85,29 @@ class SettingsPageContainer extends React.Component {
})
}).catch((err) => {
- console.log("Loading user details error", err);
+
+ console.log("Loading user details error", err);
+
+ Swal.fire({
+ title: 'Error loading user account',
+ text: 'There was an error loading your account, would you like to logout?',
+ icon: 'warning',
+ showCancelButton: true,
+ confirmButtonText: 'Yes, logout',
+ cancelButtonText: 'No'
+ }).then((result) => {
+
+ if (result.value) {
+ console.log("Confirm logout");
+
+ axios.post("/user-service/logout").then(() => {
+ window.location.assign(env.url);
+ }).catch((e) => {
+ window.location.assign(env.url);
+ })
+ }
+
+ })
})
}
diff --git a/webUISetup/index.html b/webUISetup/index.html
index 83bc321b..3a0b2cc5 100644
--- a/webUISetup/index.html
+++ b/webUISetup/index.html
@@ -69,6 +69,9 @@
+
+ Use Local URL
+
@@ -88,9 +91,33 @@
+
+
+
Use default ports? (http port: 3000, https port: 8080
+
+
+
+ Yes
+ No
+
+
+
+
+
+
-
Enter The Client URL/IP Address (Must Be A Valid Link, If Using a URL Start With "https://" or "http://", Include Port With IP Address If Needed, Do Not End The URL In a Slash "/")
+
Enter The Client URL/IP Address (Must Be A Valid Link and Must Start With "http://" or "https://", Include Port With IP Address If Needed, Do Not End The URL In a Slash "/")
Error: URL Cannot End In a Slash ("/")
+
Error: URL Must Start With "http://" or "https://"
diff --git a/webUISetup/src/index.js b/webUISetup/src/index.js
index d197aed4..9c0d0fc1 100644
--- a/webUISetup/src/index.js
+++ b/webUISetup/src/index.js
@@ -27,11 +27,18 @@ const sendGridSelect = document.getElementById("sendgrid-select")
const sendGridWrapper = document.getElementById("sendgrid-wrapper");
const sendGridWrapper2 = document.getElementById("sendgrid-wrapper2");
const clientInvalidInputText = document.getElementById("client-input-invalid-text");
+const clientInvalidInputText2 = document.getElementById("client-input-invalid-text2");
const accessTokenInput = document.getElementById("access-token-input");
const refreshTokenInput = document.getElementById("refresh-token-input")
const cookieInput = document.getElementById("cookie-input");
const secureCookieSelect = document.getElementById("secure-cookie-select");
+const mongoDefaultButton = document.getElementById("mongo-default-button");
+const portsSelect = document.getElementById("port-select");
+const httpPortInput = document.getElementById("http-port-input");
+const httpsPortInput = document.getElementById("https-port-input");
+const portsWrappers = document.getElementById("ports-wrapper");
+const customPortsWrapper = document.getElementById("section-wrapper-ports");
//const stripeInputEmail = document.getElementById('stripe-input-email');
dockerSelection.addEventListener("change", (e) => {
@@ -40,11 +47,14 @@ dockerSelection.addEventListener("change", (e) => {
if (docker) {
dockerHidden.className = "section-wrapper"
- mainMongoURLWrapper.className = "docker-hidden"
+ mainMongoURLWrapper.className = "docker-hidden";
+ customPortsWrapper.className = "docker-hidden"
+ portsWrappers.className = "docker-hidden";
} else {
dockerHidden.className = "docker-hidden"
mainMongoURLWrapper.className = "section-wrapper"
dockerHiddenMongoURL.className = "docker-hidden"
+ customPortsWrapper.className = "section-wrapper";
}
})
@@ -117,12 +127,10 @@ sendGridSelect.addEventListener("change", () => {
clientInput.addEventListener("input", () => {
const value = clientInput.value;
- console.log("value", value)
if (value && value.length !== 0) {
const lastCharacter = value[value.length - 1];
- console.log("last character", lastCharacter)
if (lastCharacter === "/") {
@@ -140,6 +148,34 @@ clientInput.addEventListener("input", () => {
clientInvalidInputText.className = "invalid-input-text-hidden"
}
+ if (value && value.length >= 8 || value && value.length >= 7) {
+
+ const firstChactersHttp = value.substring(0, 7);
+ const firstChactersHttps = value.substring(0, 8);
+
+ if (firstChactersHttps !== "https://" && firstChactersHttp !== "http://") {
+ clientInput.className = "mongo-input input-invalid"
+ clientInvalidInputText2.className = "invalid-input-text"
+ } else {
+ clientInvalidInputText2.className = "invalid-input-text-hidden"
+ }
+ }
+})
+
+mongoDefaultButton.addEventListener("click", () => {
+
+ mongoURLInput.value = "mongodb://localhost:27017/mydrive-db"
+})
+
+portsSelect.addEventListener("change", () => {
+
+ const value = portsSelect.value === "no";
+
+ if (value) {
+ portsWrappers.className = "section-wrapper"
+ } else {
+ portsWrappers.className = "docker-hidden";
+ }
})
saveButton.addEventListener("click", () => {
@@ -153,8 +189,11 @@ saveButton.addEventListener("click", () => {
//if (dbSelect.value !== "fs") clientObj.DISABLE_STORAGE = true;
// Server
- serverObj.HTTP_PORT = 3000;
- serverObj.HTTPS_PORT = 8080;
+
+ portsSelect.value === "no" ? serverObj.HTTP_PORT = httpPortInput.value : serverObj.HTTP_PORT = 3000;
+ portsSelect.value === "no" ? serverObj.HTTPS_PORT = httpsPortInput.value : serverObj.HTTPS_PORT = 8080;
+ if (dockerSelection.value === "yes") serverObj.HTTP_PORT = 3000;
+ if (dockerSelection.value === "yes") serverObj.HTTPS_PORT = 8080;
serverObj.NODE_ENV = "production";
serverObj.MONGODB_URL = dockerSelection.value !== "yes" ? mongoURLInput.value :
dockerSelectionMongoURL.value !== "yes" ? mongoURLInputDocker.value : "mongodb://mongo:27017/mydrive"
@@ -188,9 +227,6 @@ saveButton.addEventListener("click", () => {
serverObj
}
- console.log("data", data);
- return;
-
axios.post("/submit", data).then((result) => {
console.log("Submitted");
diff --git a/webUISetup/src/styles.css b/webUISetup/src/styles.css
index 11a501a4..563b29ec 100644
--- a/webUISetup/src/styles.css
+++ b/webUISetup/src/styles.css
@@ -87,7 +87,7 @@ html {
/* width: 77%; */
/* max-width: 50vw; */
font-weight: 300;
- text-transform: capitalize;
+ /* text-transform: capitalize; */
font-size: 17px;
text-align: center;
max-width: 78%;
@@ -198,6 +198,16 @@ html {
margin: 30px;
}
+.button-wrapper-mongo {
+
+ display: flex;
+ flex-direction: row;
+ align-items: center;
+ justify-content: center;
+ margin: 30px;
+ margin-bottom: 0px;
+}
+
.button {
color: #fff;
background: #3c85ed;
@@ -208,4 +218,16 @@ html {
text-decoration: none;
line-height: 1;
border-radius: 2px;
+}
+
+.button-mongo {
+ color: #fff;
+ background: #3c85ed;
+ font-size: 16px;
+ padding: 9px;
+ border: none;
+ display: inline-block;
+ text-decoration: none;
+ line-height: 1;
+ border-radius: 2px;
}
\ No newline at end of file