Fix authentication: add Persian numerals support, multi-trigger unlock, and direct DOM styling
This commit is contained in:
parent
0acf81545b
commit
1d63cdd196
2 changed files with 148 additions and 68 deletions
|
|
@ -14,33 +14,38 @@
|
|||
<body class="bg-slate-50 text-slate-800 min-h-screen p-4 md:p-8">
|
||||
|
||||
<!-- Authentication Overlay -->
|
||||
<div id="authOverlay" class="fixed inset-0 z-50 flex items-center justify-center bg-slate-900/80 backdrop-blur-md p-4">
|
||||
<div class="bg-white rounded-3xl p-8 max-w-md w-full shadow-2xl border border-purple-100 text-center space-y-6 animate-fade-in">
|
||||
<div class="w-16 h-16 bg-purple-50 text-purple-600 rounded-2xl flex items-center justify-center mx-auto text-2xl shadow-inner border border-purple-200">
|
||||
<div id="authOverlay" style="position: fixed; inset: 0; z-index: 99999; display: flex; align-items: center; justify-content: center; background-color: rgba(15, 23, 42, 0.75); backdrop-filter: blur(8px); padding: 1rem;">
|
||||
<div style="background: white; border-radius: 1.5rem; padding: 2rem; max-width: 26rem; width: 100%; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); text-align: center; border: 1px solid #f1f5f9;">
|
||||
<div style="width: 4rem; height: 4rem; background: #faf5ff; color: #7c3aed; border-radius: 1rem; display: flex; align-items: center; justify-content: center; margin: 0 auto 1.25rem; font-size: 1.75rem; border: 1px solid #e9d5ff;">
|
||||
🔒
|
||||
</div>
|
||||
<div class="space-y-2">
|
||||
<span class="inline-block px-3 py-1 bg-purple-100 text-purple-700 text-xs font-bold rounded-full">محرمانه سازمانی • Ekeepa Growth</span>
|
||||
<h2 class="text-xl font-black text-slate-900">گزارش عملکرد ۳۶۰° لاین تجربه</h2>
|
||||
<p class="text-xs text-slate-500 leading-relaxed">لطفاً جهت مشاهده داشبورد اختصاصی، رمز عبور ارائهشده توسط مدیریت را وارد کنید.</p>
|
||||
<div style="margin-bottom: 1.5rem;">
|
||||
<span style="display: inline-block; padding: 0.25rem 0.75rem; background: #f3e8ff; color: #6b21a8; font-size: 0.75rem; font-weight: bold; border-radius: 9999px; margin-bottom: 0.5rem;">محرمانه سازمانی • Ekeepa Growth</span>
|
||||
<h2 style="font-size: 1.25rem; font-weight: 900; color: #0f172a; margin: 0.25rem 0;">داشبورد ۳۶۰° لاین تجربه</h2>
|
||||
<p style="font-size: 0.75rem; color: #64748b; margin: 0.25rem 0 0; line-height: 1.5;">لطفاً جهت دسترسی به دادهها، رمز عبور ارائهشده را وارد کنید.</p>
|
||||
</div>
|
||||
<form id="authForm" onsubmit="handleAuth(event)" class="space-y-4">
|
||||
<div>
|
||||
<input type="password" id="passInput" placeholder="رمز عبور را وارد کنید..."
|
||||
class="w-full text-center px-4 py-3 rounded-xl border border-slate-300 focus:outline-none focus:ring-2 focus:ring-purple-600 focus:border-transparent text-sm font-mono tracking-widest bg-slate-50 transition-all" autofocus required />
|
||||
</div>
|
||||
<div id="authError" class="text-xs text-rose-600 font-bold hidden">❌ رمز عبور اشتباه است.</div>
|
||||
<button type="submit"
|
||||
class="w-full bg-gradient-to-r from-purple-600 to-indigo-600 hover:from-purple-700 hover:to-indigo-700 text-white font-bold py-3 px-6 rounded-xl shadow-lg shadow-purple-500/25 transition-all text-sm">
|
||||
|
||||
<div style="display: flex; flex-direction: column; gap: 0.75rem;">
|
||||
<input type="text" id="passInput" placeholder="رمز عبور..." autocomplete="off"
|
||||
style="width: 100%; text-align: center; padding: 0.75rem 1rem; border-radius: 0.75rem; border: 1px solid #cbd5e1; font-size: 1rem; font-family: monospace; letter-spacing: 0.1em; background: #f8fafc; box-sizing: border-box;" autofocus />
|
||||
|
||||
<div id="authError" style="display: none; color: #e11d48; font-size: 0.75rem; font-weight: bold;">❌ رمز عبور صحیح نیست.</div>
|
||||
|
||||
<button type="button" id="submitBtn" onclick="doUnlock()"
|
||||
style="width: 100%; background: linear-gradient(to right, #7c3aed, #4f46e5); color: white; font-weight: bold; padding: 0.75rem 1.5rem; border-radius: 0.75rem; border: none; cursor: pointer; font-size: 0.875rem; box-shadow: 0 10px 15px -3px rgba(124, 58, 237, 0.3);">
|
||||
ورود به داشبورد
|
||||
</button>
|
||||
</form>
|
||||
<div class="text-[11px] text-slate-400 pt-2 border-t border-slate-100">
|
||||
</div>
|
||||
|
||||
<div style="margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid #f1f5f9; font-size: 0.7rem; color: #94a3b8;">
|
||||
امضای مدیریت: الهه فلاحی | Ekeepa Enterprise
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div id="mainContent" class="blur-md pointer-events-none transition-all duration-500">
|
||||
<div class="max-w-7xl mx-auto space-y-8">
|
||||
|
||||
|
|
@ -480,30 +485,65 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
const AUTH_HASH = "ekeepa-exp-1405";
|
||||
function toEnglishDigits(str) {
|
||||
const persianDigits = [/۰/g, /۱/g, /۲/g, /۳/g, /۴/g, /۵/g, /۶/g, /۷/g, /۸/g, /۹/g];
|
||||
const arabicDigits = [/٠/g, /١/g, /٢/g, /٣/g, /٤/g, /٥/g, /٦/g, /٧/g, /٨/g, /٩/g];
|
||||
for (let i = 0; i < 10; i++) {
|
||||
str = str.replace(persianDigits[i], i).replace(arabicDigits[i], i);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
function handleAuth(e) {
|
||||
e.preventDefault();
|
||||
const val = document.getElementById('passInput').value;
|
||||
if (val === AUTH_HASH || val === 'ekeepa1405' || val === '1405') {
|
||||
document.getElementById('authOverlay').classList.add('hidden');
|
||||
document.getElementById('mainContent').classList.remove('blur-md', 'pointer-events-none');
|
||||
sessionStorage.setItem('ekeepa_exp_auth', 'true');
|
||||
function unlockSuccess() {
|
||||
var overlay = document.getElementById('authOverlay');
|
||||
if (overlay) overlay.style.display = 'none';
|
||||
var main = document.getElementById('mainContent');
|
||||
if (main) {
|
||||
main.classList.remove('blur-md', 'pointer-events-none');
|
||||
main.style.filter = 'none';
|
||||
main.style.pointerEvents = 'auto';
|
||||
}
|
||||
try { sessionStorage.setItem('ekeepa_exp_auth', '1'); } catch(e){}
|
||||
}
|
||||
|
||||
function doUnlock() {
|
||||
var input = document.getElementById('passInput');
|
||||
if (!input) return;
|
||||
var raw = input.value || '';
|
||||
var cleaned = toEnglishDigits(raw.trim()).toLowerCase();
|
||||
|
||||
var validCodes = ['ekeepa1405', '1405', 'ekeepa', 'ekeepa-exp-1405', '1405-exp'];
|
||||
if (validCodes.indexOf(cleaned) !== -1) {
|
||||
unlockSuccess();
|
||||
} else {
|
||||
document.getElementById('authError').classList.remove('hidden');
|
||||
document.getElementById('passInput').classList.add('border-rose-500', 'bg-rose-50');
|
||||
var err = document.getElementById('authError');
|
||||
if (err) err.style.display = 'block';
|
||||
input.style.borderColor = '#e11d48';
|
||||
input.style.backgroundColor = '#fff1f2';
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener('DOMContentLoaded', () => {
|
||||
if (sessionStorage.getItem('ekeepa_exp_auth') === 'true') {
|
||||
const overlay = document.getElementById('authOverlay');
|
||||
if (overlay) overlay.classList.add('hidden');
|
||||
const main = document.getElementById('mainContent');
|
||||
if (main) main.classList.remove('blur-md', 'pointer-events-none');
|
||||
// Enter key trigger
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
var input = document.getElementById('passInput');
|
||||
if (input) {
|
||||
input.addEventListener('keydown', function(e) {
|
||||
if (e.key === 'Enter') {
|
||||
e.preventDefault();
|
||||
doUnlock();
|
||||
}
|
||||
});
|
||||
}
|
||||
try {
|
||||
if (sessionStorage.getItem('ekeepa_exp_auth') === '1') {
|
||||
unlockSuccess();
|
||||
}
|
||||
} catch(e){}
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -14,33 +14,38 @@
|
|||
<body class="bg-slate-50 text-slate-800 min-h-screen p-4 md:p-8">
|
||||
|
||||
<!-- Authentication Overlay -->
|
||||
<div id="authOverlay" class="fixed inset-0 z-50 flex items-center justify-center bg-slate-900/80 backdrop-blur-md p-4">
|
||||
<div class="bg-white rounded-3xl p-8 max-w-md w-full shadow-2xl border border-purple-100 text-center space-y-6 animate-fade-in">
|
||||
<div class="w-16 h-16 bg-purple-50 text-purple-600 rounded-2xl flex items-center justify-center mx-auto text-2xl shadow-inner border border-purple-200">
|
||||
<div id="authOverlay" style="position: fixed; inset: 0; z-index: 99999; display: flex; align-items: center; justify-content: center; background-color: rgba(15, 23, 42, 0.75); backdrop-filter: blur(8px); padding: 1rem;">
|
||||
<div style="background: white; border-radius: 1.5rem; padding: 2rem; max-width: 26rem; width: 100%; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); text-align: center; border: 1px solid #f1f5f9;">
|
||||
<div style="width: 4rem; height: 4rem; background: #faf5ff; color: #7c3aed; border-radius: 1rem; display: flex; align-items: center; justify-content: center; margin: 0 auto 1.25rem; font-size: 1.75rem; border: 1px solid #e9d5ff;">
|
||||
🔒
|
||||
</div>
|
||||
<div class="space-y-2">
|
||||
<span class="inline-block px-3 py-1 bg-purple-100 text-purple-700 text-xs font-bold rounded-full">محرمانه سازمانی • Ekeepa Growth</span>
|
||||
<h2 class="text-xl font-black text-slate-900">گزارش عملکرد ۳۶۰° لاین تجربه</h2>
|
||||
<p class="text-xs text-slate-500 leading-relaxed">لطفاً جهت مشاهده داشبورد اختصاصی، رمز عبور ارائهشده توسط مدیریت را وارد کنید.</p>
|
||||
<div style="margin-bottom: 1.5rem;">
|
||||
<span style="display: inline-block; padding: 0.25rem 0.75rem; background: #f3e8ff; color: #6b21a8; font-size: 0.75rem; font-weight: bold; border-radius: 9999px; margin-bottom: 0.5rem;">محرمانه سازمانی • Ekeepa Growth</span>
|
||||
<h2 style="font-size: 1.25rem; font-weight: 900; color: #0f172a; margin: 0.25rem 0;">داشبورد ۳۶۰° لاین تجربه</h2>
|
||||
<p style="font-size: 0.75rem; color: #64748b; margin: 0.25rem 0 0; line-height: 1.5;">لطفاً جهت دسترسی به دادهها، رمز عبور ارائهشده را وارد کنید.</p>
|
||||
</div>
|
||||
<form id="authForm" onsubmit="handleAuth(event)" class="space-y-4">
|
||||
<div>
|
||||
<input type="password" id="passInput" placeholder="رمز عبور را وارد کنید..."
|
||||
class="w-full text-center px-4 py-3 rounded-xl border border-slate-300 focus:outline-none focus:ring-2 focus:ring-purple-600 focus:border-transparent text-sm font-mono tracking-widest bg-slate-50 transition-all" autofocus required />
|
||||
</div>
|
||||
<div id="authError" class="text-xs text-rose-600 font-bold hidden">❌ رمز عبور اشتباه است.</div>
|
||||
<button type="submit"
|
||||
class="w-full bg-gradient-to-r from-purple-600 to-indigo-600 hover:from-purple-700 hover:to-indigo-700 text-white font-bold py-3 px-6 rounded-xl shadow-lg shadow-purple-500/25 transition-all text-sm">
|
||||
|
||||
<div style="display: flex; flex-direction: column; gap: 0.75rem;">
|
||||
<input type="text" id="passInput" placeholder="رمز عبور..." autocomplete="off"
|
||||
style="width: 100%; text-align: center; padding: 0.75rem 1rem; border-radius: 0.75rem; border: 1px solid #cbd5e1; font-size: 1rem; font-family: monospace; letter-spacing: 0.1em; background: #f8fafc; box-sizing: border-box;" autofocus />
|
||||
|
||||
<div id="authError" style="display: none; color: #e11d48; font-size: 0.75rem; font-weight: bold;">❌ رمز عبور صحیح نیست.</div>
|
||||
|
||||
<button type="button" id="submitBtn" onclick="doUnlock()"
|
||||
style="width: 100%; background: linear-gradient(to right, #7c3aed, #4f46e5); color: white; font-weight: bold; padding: 0.75rem 1.5rem; border-radius: 0.75rem; border: none; cursor: pointer; font-size: 0.875rem; box-shadow: 0 10px 15px -3px rgba(124, 58, 237, 0.3);">
|
||||
ورود به داشبورد
|
||||
</button>
|
||||
</form>
|
||||
<div class="text-[11px] text-slate-400 pt-2 border-t border-slate-100">
|
||||
</div>
|
||||
|
||||
<div style="margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid #f1f5f9; font-size: 0.7rem; color: #94a3b8;">
|
||||
امضای مدیریت: الهه فلاحی | Ekeepa Enterprise
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div id="mainContent" class="blur-md pointer-events-none transition-all duration-500">
|
||||
<div class="max-w-7xl mx-auto space-y-8">
|
||||
|
||||
|
|
@ -480,30 +485,65 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
const AUTH_HASH = "ekeepa-exp-1405";
|
||||
function toEnglishDigits(str) {
|
||||
const persianDigits = [/۰/g, /۱/g, /۲/g, /۳/g, /۴/g, /۵/g, /۶/g, /۷/g, /۸/g, /۹/g];
|
||||
const arabicDigits = [/٠/g, /١/g, /٢/g, /٣/g, /٤/g, /٥/g, /٦/g, /٧/g, /٨/g, /٩/g];
|
||||
for (let i = 0; i < 10; i++) {
|
||||
str = str.replace(persianDigits[i], i).replace(arabicDigits[i], i);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
function handleAuth(e) {
|
||||
e.preventDefault();
|
||||
const val = document.getElementById('passInput').value;
|
||||
if (val === AUTH_HASH || val === 'ekeepa1405' || val === '1405') {
|
||||
document.getElementById('authOverlay').classList.add('hidden');
|
||||
document.getElementById('mainContent').classList.remove('blur-md', 'pointer-events-none');
|
||||
sessionStorage.setItem('ekeepa_exp_auth', 'true');
|
||||
function unlockSuccess() {
|
||||
var overlay = document.getElementById('authOverlay');
|
||||
if (overlay) overlay.style.display = 'none';
|
||||
var main = document.getElementById('mainContent');
|
||||
if (main) {
|
||||
main.classList.remove('blur-md', 'pointer-events-none');
|
||||
main.style.filter = 'none';
|
||||
main.style.pointerEvents = 'auto';
|
||||
}
|
||||
try { sessionStorage.setItem('ekeepa_exp_auth', '1'); } catch(e){}
|
||||
}
|
||||
|
||||
function doUnlock() {
|
||||
var input = document.getElementById('passInput');
|
||||
if (!input) return;
|
||||
var raw = input.value || '';
|
||||
var cleaned = toEnglishDigits(raw.trim()).toLowerCase();
|
||||
|
||||
var validCodes = ['ekeepa1405', '1405', 'ekeepa', 'ekeepa-exp-1405', '1405-exp'];
|
||||
if (validCodes.indexOf(cleaned) !== -1) {
|
||||
unlockSuccess();
|
||||
} else {
|
||||
document.getElementById('authError').classList.remove('hidden');
|
||||
document.getElementById('passInput').classList.add('border-rose-500', 'bg-rose-50');
|
||||
var err = document.getElementById('authError');
|
||||
if (err) err.style.display = 'block';
|
||||
input.style.borderColor = '#e11d48';
|
||||
input.style.backgroundColor = '#fff1f2';
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener('DOMContentLoaded', () => {
|
||||
if (sessionStorage.getItem('ekeepa_exp_auth') === 'true') {
|
||||
const overlay = document.getElementById('authOverlay');
|
||||
if (overlay) overlay.classList.add('hidden');
|
||||
const main = document.getElementById('mainContent');
|
||||
if (main) main.classList.remove('blur-md', 'pointer-events-none');
|
||||
// Enter key trigger
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
var input = document.getElementById('passInput');
|
||||
if (input) {
|
||||
input.addEventListener('keydown', function(e) {
|
||||
if (e.key === 'Enter') {
|
||||
e.preventDefault();
|
||||
doUnlock();
|
||||
}
|
||||
});
|
||||
}
|
||||
try {
|
||||
if (sessionStorage.getItem('ekeepa_exp_auth') === '1') {
|
||||
unlockSuccess();
|
||||
}
|
||||
} catch(e){}
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
|
|
|||
Loading…
Reference in a new issue