Version 0.2.0
Changes: - forbid to overwrite secrets of other users - add some logs of success - add validation on code (length 50) - use same limiter for POST requests
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
<meta charset="UTF-8">
|
||||
<title>CodeVault - Set value</title>
|
||||
<style>
|
||||
body { font-family: sans-serif; max-width: 480px; margin: 4rem auto; }
|
||||
body { font-family: sans-serif; max-width: 880px; margin: 4rem auto; }
|
||||
input, button, textarea { font-size: 1rem; padding: 0.4rem; }
|
||||
input, textarea { width: 100%; box-sizing: border-box; margin-bottom: 0.75rem; }
|
||||
#result { margin-top: 1rem; padding: 0.75rem; border-radius: 4px; white-space: pre-wrap; word-break: break-all; }
|
||||
@@ -16,7 +16,7 @@
|
||||
<h1>Set value for a code</h1>
|
||||
<input id="login" type="text" placeholder="Login" autocomplete="username">
|
||||
<input id="password" type="password" placeholder="Password" autocomplete="current-password">
|
||||
<input id="code" type="text" placeholder="Access code">
|
||||
<input id="code" type="text" placeholder="Access code" maxlength="50">
|
||||
<textarea id="value" rows="4" placeholder="Value"></textarea>
|
||||
<button id="submit">Save</button>
|
||||
<div id="result"></div>
|
||||
@@ -46,6 +46,9 @@ document.getElementById('submit').addEventListener('click', async () => {
|
||||
} else if (response.status === 401) {
|
||||
result.className = 'err';
|
||||
result.textContent = 'Invalid login or password';
|
||||
} else if (response.status === 403) {
|
||||
result.className = 'err';
|
||||
result.textContent = 'Code is owned by another user';
|
||||
} else if (response.status === 400) {
|
||||
result.className = 'err';
|
||||
result.textContent = 'Code and value are required';
|
||||
|
||||
Reference in New Issue
Block a user