BR-002: warn at the dynamic free-text fields
This commit is contained in:
1 parent
a895a4d14f
commit
81c6fab13d
1 file changed
+15
@@ -45,6 +45,8 @@ const availabilityOptions = [["", "Select availability"], ["1", "Yes"], ["0", "N
|
|||||||
// Hardware works requires an active choice, so the placeholder is not an answer
|
// Hardware works requires an active choice, so the placeholder is not an answer
|
||||||
// (section 24.1).
|
// (section 24.1).
|
||||||
const hardwareWorksOptions = [["", "Select status"], ["1", "Yes"], ["0", "No"]];
|
const hardwareWorksOptions = [["", "Select status"], ["1", "Yes"], ["0", "No"]];
|
||||||
|
// The reminder that belongs with every free-text field (sections 2 and 15).
|
||||||
|
const SECRET_WARNING = "Never paste a seed phrase or a private key here.";
|
||||||
let keyProfiles = [];
|
let keyProfiles = [];
|
||||||
let previousValues = { keys: [] };
|
let previousValues = { keys: [] };
|
||||||
// The wallet software list the user maintains in the settings (section 25.4).
|
// The wallet software list the user maintains in the settings (section 25.4).
|
||||||
@@ -62,6 +64,16 @@ function emptyState(text) {
|
|||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function secretWarning() {
|
||||||
|
// A short reminder that sits with a free-text field. The server refuses a value
|
||||||
|
// that looks like a wallet secret and stores nothing, so the field says so
|
||||||
|
// before the user types (sections 2 and 15).
|
||||||
|
const warning = document.createElement("span");
|
||||||
|
warning.className = "field-help secret-warning";
|
||||||
|
warning.textContent = SECRET_WARNING;
|
||||||
|
return warning;
|
||||||
|
}
|
||||||
|
|
||||||
function makeField(labelText, name, control) {
|
function makeField(labelText, name, control) {
|
||||||
const label = document.createElement("label");
|
const label = document.createElement("label");
|
||||||
label.className = "field";
|
label.className = "field";
|
||||||
@@ -313,6 +325,7 @@ function renderKeyCheck() {
|
|||||||
"firmware_version",
|
"firmware_version",
|
||||||
makeTextInput("firmware_version", 100, previousText(previous, "firmware_version")),
|
makeTextInput("firmware_version", 100, previousText(previous, "firmware_version")),
|
||||||
));
|
));
|
||||||
|
details.append(secretWarning());
|
||||||
details.append(makeField(
|
details.append(makeField(
|
||||||
"Seed backup intact and matching the device",
|
"Seed backup intact and matching the device",
|
||||||
"seed_backup_verified",
|
"seed_backup_verified",
|
||||||
@@ -329,6 +342,7 @@ function renderKeyCheck() {
|
|||||||
makeTextInput("address_path", 200, key.address_path || ""),
|
makeTextInput("address_path", 200, key.address_path || ""),
|
||||||
));
|
));
|
||||||
card.append(makeField("Key notes", "key_comments", makeTextarea("key_comments")));
|
card.append(makeField("Key notes", "key_comments", makeTextarea("key_comments")));
|
||||||
|
card.append(secretWarning());
|
||||||
keyCheck.append(card);
|
keyCheck.append(card);
|
||||||
|
|
||||||
available.addEventListener("change", () => {
|
available.addEventListener("change", () => {
|
||||||
@@ -467,6 +481,7 @@ function renderSecurityChecks() {
|
|||||||
status.required = true;
|
status.required = true;
|
||||||
card.append(makeField("Security status", statusName, status));
|
card.append(makeField("Security status", statusName, status));
|
||||||
card.append(makeField("Comment", commentName, makeTextarea(commentName, 1000)));
|
card.append(makeField("Comment", commentName, makeTextarea(commentName, 1000)));
|
||||||
|
card.append(secretWarning());
|
||||||
securityChecks.append(card);
|
securityChecks.append(card);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user