clay-server 2.36.2-beta.2 → 2.36.2-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/public/modules/app-misc.js +34 -19
- package/package.json +1 -1
|
@@ -289,41 +289,56 @@ export function hideConfirm() {
|
|
|
289
289
|
}
|
|
290
290
|
|
|
291
291
|
export function showForceChangePinOverlay() {
|
|
292
|
+
// Inject the same .pin-digit / .pin-wrap CSS the login page uses, so this
|
|
293
|
+
// overlay behaves identically: visible focus ring, filled state, etc.
|
|
294
|
+
// The login page (lib/pages.js) loads this CSS inline; the main app
|
|
295
|
+
// doesn't, so we add it once here.
|
|
296
|
+
if (!document.getElementById("fcp-style")) {
|
|
297
|
+
var st = document.createElement("style");
|
|
298
|
+
st.id = "fcp-style";
|
|
299
|
+
st.textContent =
|
|
300
|
+
"#force-change-pin-overlay .pin-wrap{display:flex;gap:8px;justify-content:center;margin-bottom:16px}" +
|
|
301
|
+
"#force-change-pin-overlay .pin-digit{width:44px;height:56px;background:var(--input-bg);border:1.5px solid var(--border);border-radius:8px;color:var(--text);font-family:'Courier New',Courier,'Roboto Mono',monospace;font-size:28px;font-weight:700;text-align:center;line-height:56px;outline:none;caret-color:transparent;transition:border-color 0.15s,box-shadow 0.15s}" +
|
|
302
|
+
"#force-change-pin-overlay .pin-digit:focus{border-color:var(--accent);box-shadow:0 0 0 2px var(--accent-20,rgba(124,58,237,0.25))}" +
|
|
303
|
+
"#force-change-pin-overlay .pin-digit.filled{color:var(--text)}";
|
|
304
|
+
document.head.appendChild(st);
|
|
305
|
+
}
|
|
306
|
+
|
|
292
307
|
var ov = document.createElement("div");
|
|
293
308
|
ov.id = "force-change-pin-overlay";
|
|
294
309
|
ov.style.cssText = "position:fixed;inset:0;background:var(--bg,#0e0e10);z-index:99999;display:flex;align-items:center;justify-content:center;flex-direction:column";
|
|
295
310
|
ov.innerHTML = '<div style="width:100%;max-width:380px;padding:24px;text-align:center">' +
|
|
296
311
|
'<h2 style="margin:0 0 8px;color:var(--text,#fff);font-size:22px">Set your new PIN</h2>' +
|
|
297
312
|
'<p style="margin:0 0 24px;color:var(--text-secondary,#aaa);font-size:14px">Your temporary PIN has expired. Please set a new 6-digit PIN to continue.</p>' +
|
|
298
|
-
'<div
|
|
299
|
-
'<input class="
|
|
300
|
-
'<input class="
|
|
301
|
-
'<input class="
|
|
302
|
-
'<input class="
|
|
303
|
-
'<input class="
|
|
304
|
-
'<input class="
|
|
313
|
+
'<div class="pin-wrap" id="fcp-boxes">' +
|
|
314
|
+
'<input class="pin-digit" type="tel" maxlength="1" inputmode="numeric" autocomplete="off">' +
|
|
315
|
+
'<input class="pin-digit" type="tel" maxlength="1" inputmode="numeric" autocomplete="off">' +
|
|
316
|
+
'<input class="pin-digit" type="tel" maxlength="1" inputmode="numeric" autocomplete="off">' +
|
|
317
|
+
'<input class="pin-digit" type="tel" maxlength="1" inputmode="numeric" autocomplete="off">' +
|
|
318
|
+
'<input class="pin-digit" type="tel" maxlength="1" inputmode="numeric" autocomplete="off">' +
|
|
319
|
+
'<input class="pin-digit" type="tel" maxlength="1" inputmode="numeric" autocomplete="off">' +
|
|
305
320
|
'</div>' +
|
|
306
|
-
'<button id="fcp-save" disabled style="width:100%;padding:12px;border:none;border-radius:10px;background:var(--accent
|
|
307
|
-
'<div id="fcp-err" style="margin-top:12px;color
|
|
321
|
+
'<button id="fcp-save" disabled style="width:100%;padding:12px;border:none;border-radius:10px;background:var(--accent);color:#fff;font-size:15px;font-weight:600;cursor:pointer;opacity:0.5;transition:opacity 0.15s">Save PIN</button>' +
|
|
322
|
+
'<div id="fcp-err" style="margin-top:12px;color:var(--error,#ef4444);font-size:13px;min-height:1.3em"></div>' +
|
|
308
323
|
'</div>';
|
|
309
324
|
document.body.appendChild(ov);
|
|
310
325
|
|
|
311
|
-
var boxes = ov.querySelectorAll(".
|
|
326
|
+
var boxes = ov.querySelectorAll(".pin-digit");
|
|
312
327
|
var saveBtn = ov.querySelector("#fcp-save");
|
|
313
328
|
var errEl = ov.querySelector("#fcp-err");
|
|
314
|
-
|
|
315
|
-
|
|
329
|
+
// Mirror the login screen's pattern (lib/pages.js pinBoxScript): keep an
|
|
330
|
+
// explicit digits[] array as the source of truth, render bullets visually,
|
|
331
|
+
// enable the button when length === 6.
|
|
332
|
+
var digits = ["", "", "", "", "", ""];
|
|
316
333
|
|
|
317
334
|
function setDigit(idx, v) {
|
|
318
|
-
|
|
319
|
-
_settingDigit = true;
|
|
335
|
+
digits[idx] = v;
|
|
320
336
|
boxes[idx].value = v ? "\u2022" : "";
|
|
321
|
-
_settingDigit = false;
|
|
322
337
|
boxes[idx].classList.toggle("filled", v.length > 0);
|
|
323
338
|
}
|
|
324
339
|
|
|
325
340
|
function getPin() {
|
|
326
|
-
return
|
|
341
|
+
return digits.join("");
|
|
327
342
|
}
|
|
328
343
|
|
|
329
344
|
function updateBtn() {
|
|
@@ -335,7 +350,6 @@ export function showForceChangePinOverlay() {
|
|
|
335
350
|
for (var i = 0; i < boxes.length; i++) {
|
|
336
351
|
(function (idx) {
|
|
337
352
|
boxes[idx].addEventListener("input", function () {
|
|
338
|
-
if (_settingDigit) return;
|
|
339
353
|
var raw = this.value.replace(/[^0-9]/g, "");
|
|
340
354
|
if (!raw) { setDigit(idx, ""); updateBtn(); return; }
|
|
341
355
|
var v = raw.charAt(raw.length - 1);
|
|
@@ -345,13 +359,14 @@ export function showForceChangePinOverlay() {
|
|
|
345
359
|
});
|
|
346
360
|
boxes[idx].addEventListener("keydown", function (e) {
|
|
347
361
|
if (e.key === "Backspace") {
|
|
348
|
-
if (!
|
|
362
|
+
if (!digits[idx] && idx > 0) {
|
|
349
363
|
setDigit(idx - 1, "");
|
|
350
364
|
boxes[idx - 1].focus();
|
|
351
365
|
} else {
|
|
352
366
|
setDigit(idx, "");
|
|
353
367
|
}
|
|
354
368
|
updateBtn();
|
|
369
|
+
return;
|
|
355
370
|
}
|
|
356
371
|
if (e.key === "ArrowLeft" && idx > 0) boxes[idx - 1].focus();
|
|
357
372
|
if (e.key === "ArrowRight" && idx < 5) boxes[idx + 1].focus();
|
|
@@ -362,7 +377,7 @@ export function showForceChangePinOverlay() {
|
|
|
362
377
|
boxes[idx].addEventListener("keypress", function (e) { e.stopPropagation(); });
|
|
363
378
|
boxes[idx].addEventListener("paste", function (e) {
|
|
364
379
|
e.preventDefault();
|
|
365
|
-
var text = (e.clipboardData || window.clipboardData).getData("text").replace(/[^0-9]/g, "").
|
|
380
|
+
var text = (e.clipboardData || window.clipboardData).getData("text").replace(/[^0-9]/g, "").slice(0, 6);
|
|
366
381
|
for (var j = 0; j < text.length && (idx + j) < 6; j++) {
|
|
367
382
|
setDigit(idx + j, text.charAt(j));
|
|
368
383
|
}
|
package/package.json
CHANGED