From 356669fdfd001ad29cb68fcf5e051edf52d351ea Mon Sep 17 00:00:00 2001 From: Steven Tracey Date: Thu, 10 Jul 2025 09:04:16 -0400 Subject: [PATCH] V1 --- error.php | 19 +++++ home.php | 6 +- info.php | 23 ++++++ snippets/head.php | 6 ++ snippets/header.php | 2 +- static/style.css | 189 +++++++++++++++++++++++++++++++------------- static/verify.js | 9 +-- unauthorized.php | 18 +++++ verify.php | 6 +- 9 files changed, 207 insertions(+), 71 deletions(-) create mode 100644 error.php create mode 100644 info.php create mode 100644 snippets/head.php create mode 100644 unauthorized.php diff --git a/error.php b/error.php new file mode 100644 index 0000000..b8e5a73 --- /dev/null +++ b/error.php @@ -0,0 +1,19 @@ + + + + + + +
+
+
+

Error

+

Please report the following to Steven

+

{{ .error }}

+
+
+
+ + + + diff --git a/home.php b/home.php index 5f5df60..fb49bf4 100644 --- a/home.php +++ b/home.php @@ -1,10 +1,6 @@ - - - Luggage Tracker - - + diff --git a/info.php b/info.php new file mode 100644 index 0000000..9b97d4a --- /dev/null +++ b/info.php @@ -0,0 +1,23 @@ + + + + + + +
+
+
+

Owner Information

+
+
+

Contact Name: {{ .contact_name }}

+

Phone Number: {{ .phone_number }}

+

Email Address: {{ .email_address }}

+

Address: {{ .address }}

+
+
+
+ + + + \ No newline at end of file diff --git a/snippets/head.php b/snippets/head.php new file mode 100644 index 0000000..c723bb7 --- /dev/null +++ b/snippets/head.php @@ -0,0 +1,6 @@ + + + + My Luggage Info + + diff --git a/snippets/header.php b/snippets/header.php index 1084632..5bea5e7 100644 --- a/snippets/header.php +++ b/snippets/header.php @@ -2,6 +2,6 @@
icon -

Luggage Tracker

+

My Luggage Info

\ No newline at end of file diff --git a/static/style.css b/static/style.css index b45e01f..fd60afd 100644 --- a/static/style.css +++ b/static/style.css @@ -8,33 +8,144 @@ font-family: Verdana,sans-serif; } -body { - margin: 0; - height: 100vh; - display: flex; - flex-direction: column; +@media only screen and (min-width: 300px) { + body { + margin: 0; + height: 92vh; + display: flex; + flex-direction: column; + } + + .header { + display: flex; + flex: 0 0 auto; + align-items: center; + justify-content: space-between; + background-color: var(--mid-dark); + padding: 0 1rem; + height: 120px; + } + + .spacer { + flex: 0 0 72px; + } + + .header-icon { + display: block; + flex: 0 0 72px; + width: 20vw; + height: auto; + max-height: 85px; + } + + .footer { + background-color: var(--dark); + display: flex; + flex: 0 0 auto; + height: 120px; + } + + .content { + display: flex; + width: 85vw; + max-width: 800px; + padding: 1.5rem; + background: white; + border-radius: 5px; + text-align: center; + } + + .content input { + font-size: 16px; + } + + .content button { + color: var(--dark); + background-color: var(--light); + border-radius: 8px; + border: 2px solid; + border-color: var(--dark); + padding: 8px 12px; + text-align: center; + text-decoration: none; + font-size: 16px; + cursor: pointer; + } + + .align-left { + align-items: flex-start; + margin-left: 5vw; + } } -.header { - display: flex; - flex: 0 0 auto; - align-items: center; - justify-content: space-between; - background-color: var(--mid-dark); - padding: 0 1rem; - height: 80px; -} +@media only screen and (min-width: 700px) { + body { + margin: 0; + height: 100vh; + display: flex; + flex-direction: column; + } -.spacer { - flex: 0 0 64px; -} + .header { + display: flex; + flex: 0 0 auto; + align-items: center; + justify-content: space-between; + background-color: var(--mid-dark); + padding: 0 1rem; + height: 80px; + } -.header-icon { - display: block; - flex: 0 0 64px; - width: 15vw; - height: auto; - max-height: 80px; + .spacer { + flex: 0 0 64px; + } + + .header-icon { + display: block; + flex: 0 0 64px; + width: 15vw; + height: auto; + max-height: 80px; + } + + .footer { + background-color: var(--dark); + display: flex; + flex: 0 0 auto; + height: 80px; + } + + .content { + display: flex; + width: 90vw; + max-width: 800px; + padding: 1.5rem; + background: white; + border-radius: 5px; + text-align: center; + } + + .content input { + font-size: 16px; + } + + .content button { + color: var(--dark); + background-color: var(--light); + border-radius: 8px; + border: 2px solid; + border-color: var(--dark); + padding: 8px 12px; + text-align: center; + text-decoration: none; + font-size: 16px; + cursor: pointer; + } + + .align-left { + align-items: flex-start; + margin-left: 5vw; + } } .title { @@ -43,13 +154,6 @@ body { color: var(--light); } -.footer { - background-color: var(--dark); - display: flex; - flex: 0 0 auto; - height: 80px; -} - .footer-text { display: inherit; align-content: center; @@ -96,13 +200,7 @@ body { ); } -.content { - display: flex; - width: 90vw; - max-width: 800px; - padding: 1.5rem; - background: white; - border-radius: 5px; +.content h1 { text-align: center; } @@ -114,23 +212,6 @@ body { text-align: center; } -.content input { - font-size: 16px; -} - -.content button { - color: var(--dark); - background-color: var(--light); - border-radius: 8px; - border: 2px solid; - border-color: var(--dark); - padding: 8px 12px; - text-align: center; - text-decoration: none; - font-size: 16px; - cursor: pointer; -} - .content button:hover { color: var(--light); background-color: var(--dark); diff --git a/static/verify.js b/static/verify.js index 55cd22f..40924ad 100644 --- a/static/verify.js +++ b/static/verify.js @@ -1,15 +1,12 @@ -let baseUrl = "http://localhost:8000" - document.getElementById("submitBtn").addEventListener('click', function(e) { let code = document.getElementById("code").value; console.log("Clicked: " + code); const path = window.location.pathname; const parts = path.split("/"); - //const user = parts.pop(); + const user = parts.pop(); - const user = "tracey" - fetch(baseUrl + "/api/verify/" + user, { + fetch("/api/verify/" + user, { method: 'GET', headers: { 'Content-Type': 'application/json', @@ -26,7 +23,7 @@ document.getElementById("submitBtn").addEventListener('click', function(e) { } else if (data.status === 200) { // Display found and redirect to baseUrl/u/user/info with auth token statusText.innerText = "User found, redirecting..."; - window.location.replace(baseUrl + "/u/" + user + "/info") + window.location.replace("/u/" + user + "/info?token=" + data.token); } else { // Error statusText.innerText = "Error, please send this to Steven to be fixed. Error: " + data.error; diff --git a/unauthorized.php b/unauthorized.php new file mode 100644 index 0000000..6776458 --- /dev/null +++ b/unauthorized.php @@ -0,0 +1,18 @@ + + + + + + +
+
+
+

Unauthorized

+

Maybe you had the wrong code?

+
+
+
+ + + + diff --git a/verify.php b/verify.php index f94017d..45691da 100644 --- a/verify.php +++ b/verify.php @@ -1,10 +1,6 @@ - - - Luggage Tracker - - +