diff --git a/components/CreateRootUser.tsx b/components/CreateRootUser.tsx index c77b749..ff07db8 100644 --- a/components/CreateRootUser.tsx +++ b/components/CreateRootUser.tsx @@ -51,6 +51,9 @@ export default class CreateRootUser extends Component { b.append("password", p2); b.append("t", t.toString()); b.append("set_cookie", "1"); + if (document.location.protocol === "https:") { + b.append("secure", "1"); + } const re2 = await fetch("/api/token", { method: "PUT", body: b }); const token = await re2.json(); if (!token.ok) { diff --git a/components/Login.tsx b/components/Login.tsx index 1199dc0..6bccf5b 100644 --- a/components/Login.tsx +++ b/components/Login.tsx @@ -43,6 +43,9 @@ export default class Login extends Component { b.append("password", p2); b.append("t", t.toString()); b.append("set_cookie", "1"); + if (document.location.protocol === "https:") { + b.append("secure", "1"); + } const re2 = await fetch("/api/token", { method: "PUT", body: b }); const token = await re2.json(); if (!token.ok) {