MCPcopy
hub / github.com/pallets/werkzeug / initPinBox

Function initPinBox

src/werkzeug/debug/shared/debugger.js:46–80  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

44}
45
46function initPinBox() {
47 document.querySelector(".pin-prompt form").addEventListener(
48 "submit",
49 function (event) {
50 event.preventDefault();
51 const btn = this.btn;
52 btn.disabled = true;
53
54 fetch(
55 makeDebugURL({cmd: "pinauth", pin: this.pin.value})
56 )
57 .then((res) => res.json())
58 .then(({auth, exhausted}) => {
59 if (auth) {
60 EVALEX_TRUSTED = true;
61 fadeOut(document.getElementsByClassName("pin-prompt")[0]);
62 } else {
63 alert(
64 `Error: ${
65 exhausted
66 ? "too many attempts. Restart server to retry."
67 : "incorrect pin"
68 }`
69 );
70 }
71 })
72 .catch((err) => {
73 alert("Error: Could not verify PIN. Network error?");
74 console.error(err);
75 })
76 .finally(() => (btn.disabled = false));
77 },
78 false
79 );
80}
81
82function promptForPin() {
83 if (!EVALEX_TRUSTED) {

Callers 1

debugger.jsFile · 0.85

Calls 3

makeDebugURLFunction · 0.85
fadeOutFunction · 0.85
jsonMethod · 0.45

Tested by

no test coverage detected