diff --git a/login.html b/login.html
new file mode 100644
index 0000000..f9dd8fb
--- /dev/null
+++ b/login.html
@@ -0,0 +1,40 @@
+
+
+
+
+
+ Prijava
+
+
+
+
+
+
+
+
+
Prijava
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/register.html b/register.html
new file mode 100644
index 0000000..4b0af41
--- /dev/null
+++ b/register.html
@@ -0,0 +1,48 @@
+
+
+
+
+
+ Registracija
+
+
+
+
+
+
+
+
+
Registracija
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/scripts/login.js b/scripts/login.js
new file mode 100644
index 0000000..c8fcf2e
--- /dev/null
+++ b/scripts/login.js
@@ -0,0 +1,45 @@
+const errmsg = `
+
+`;
+
+document.getElementById("login-form").addEventListener("submit", async function(event) {
+ event.preventDefault();
+
+ // Izbriši prejšnje napake
+ const previousErrors = document.querySelectorAll(".page-paragraph-error");
+ previousErrors.forEach(error => error.remove());
+
+ const username = document.getElementById("username").value;
+ const password = document.getElementById("password").value;
+ const form = document.getElementById("login-form");
+
+ try {
+ const response = await fetch("http://localhost:3000/prijava", {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json"
+ },
+ body: JSON.stringify({ "username": username, "password": password })
+ });
+
+ const data = await response.json().catch(() => ({}));
+
+ if (response.status === 200) {
+ // Nastavi cookie, 3 ure veljaven
+ document.cookie = `token=${data.token}; max-age=${3 * 60 * 60}; path=/; secure; samesite=strict`;
+
+ window.location.href = "/";
+ return;
+ }
+
+ const message = data.message || "Napaka pri prijavi! Preverite uporabniško ime in geslo oz. poskusite kasneje.";
+ form.insertAdjacentHTML(
+ "beforeend",
+ ``
+ );
+ } catch (error) {
+ form.insertAdjacentHTML("beforeend", errmsg);
+ }
+});
\ No newline at end of file
diff --git a/scripts/main.js b/scripts/main.js
index 8ac7b2d..2e6e455 100644
--- a/scripts/main.js
+++ b/scripts/main.js
@@ -8,6 +8,7 @@ const headerHtml = `
O projektu
Kontakt
Dodatki
+