Skip to content

Commit

Permalink
Use form for login helper pages
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Jul 27, 2024
1 parent b356ad2 commit 724f918
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 31 deletions.
22 changes: 13 additions & 9 deletions cmd/loginhelper/pages/cookies.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,29 @@
div {
margin-bottom: 8px;
}

input {
padding: 8px;
}

button {
padding: 8px;
}
</style>
</head>
<body>
<div>
<label for="username">Username:</label>
<input type="text" id="username" placeholder="Username"/>
</div>
<form onsubmit="saveToCookies()">
<div>
<label for="username">Username:</label>
<input type="text" id="username" placeholder="Username"/>
</div>

<div>
<label for="password">Password:</label>
<input type="password" id="password" placeholder="Password"/>
</div>
<div>
<label for="password">Password:</label>
<input type="password" id="password" placeholder="Password"/>
</div>

<button id="login" onClick="saveToCookies()">Save to cookies</button>
<button type="submit" id="login">Save to cookies</button>
</form>
</body>
</html>
32 changes: 19 additions & 13 deletions cmd/loginhelper/pages/daw_submit.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
.replace("_", "-")
.replace(/[^0123456789ABCDEFGHJKMNPQRSTVWXYZ-]/, "")
}

function submitToWaiter() {
const reqID = document.getElementById("reqid").value
fetch(`../api/daw_submit/${reqID}`, {
Expand All @@ -31,30 +32,35 @@
div {
margin-bottom: 10px;
}

input {
padding: 8px;
}

button {
padding: 8px;
}
</style>
</head>
<body>
<div>
<label for="reqid">Request ID:</label>
<input type="text" id="reqid" oninput="this.value = normalizeCrockfordBase32(this.value)" placeholder="ABC-123-DEF"/>
</div>
<form onsubmit="submitToWaiter()">
<div>
<label for="reqid">Request ID:</label>
<input type="text" id="reqid" oninput="this.value = normalizeCrockfordBase32(this.value)"
placeholder="ABC-123-DEF"/>
</div>

<div>
<label for="username">Username:</label>
<input type="text" id="username" placeholder="Username"/>
</div>
<div>
<label for="username">Username:</label>
<input type="text" id="username" placeholder="Username"/>
</div>

<div>
<label for="password">Password:</label>
<input type="password" id="password" placeholder="Password"/>
</div>
<div>
<label for="password">Password:</label>
<input type="password" id="password" placeholder="Password"/>
</div>

<button id="login" onClick="submitToWaiter()">Submit to waiter</button>
<button type="submit" id="login">Submit to waiter</button>
</form>
</body>
</html>
22 changes: 13 additions & 9 deletions cmd/loginhelper/pages/localstorage.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,29 @@
div {
margin-bottom: 10px;
}

input {
padding: 8px;
}

button {
padding: 8px;
}
</style>
</head>
<body>
<div>
<label for="username">Username:</label>
<input type="text" id="username" placeholder="Username"/>
</div>
<form onsubmit="saveToLocalstorage()">
<div>
<label for="username">Username:</label>
<input type="text" id="username" placeholder="Username"/>
</div>

<div>
<label for="password">Password:</label>
<input type="password" id="password" placeholder="Password"/>
</div>
<div>
<label for="password">Password:</label>
<input type="password" id="password" placeholder="Password"/>
</div>

<button id="login" onClick="saveToLocalstorage()">Save to cookies</button>
<button id="login">Save to localStorage</button>
</form>
</body>
</html>

0 comments on commit 724f918

Please sign in to comment.