Prevent overwrites from web UI (closes #12)

This commit is contained in:
Raphaël Thériault 2020-01-16 00:54:02 -05:00
parent 7dcf7c3746
commit 35ba76a28d
2 changed files with 7 additions and 4 deletions

View File

@ -318,13 +318,14 @@
(x) => x.id === parseInt(urlInput.value, 36)
)
) {
urlInput.classList.add("conflict");
urlInput.setCustomValidity("ID already in use");
} else {
urlInput.classList.remove("conflict");
urlInput.setCustomValidity("");
}
submitButton.disabled = inputs[group].some(
(input) =>
input.validity != undefined && !input.validity.valid
input.validity !== undefined &&
!input.validity.valid
);
};
checkValidity();
@ -394,6 +395,7 @@
fetch(url, {
method: "PUT",
body: JSON.stringify({ forward }),
headers: { "Content-Type": "application/json" },
})
.then((response) => {
status = response.status;
@ -421,6 +423,7 @@
fetch(url, {
method: "PUT",
body: JSON.stringify({ contents, highlight }),
headers: { "Content-Type": "application/json" },
})
.then((response) => {
status = response.status;

View File

@ -277,7 +277,7 @@ pub fn init(init: bool) -> Config {
}
let keep_empty = Confirmation::new()
.with_text("Are you sure you want to leave an empty password? This will disable authentication")
.with_text("Are you sure you want to leave an empty password? This will disable authentication.")
.default(false)
.interact()
.unwrap_or_else(|e| {