aboutsummaryrefslogtreecommitdiffstats
path: root/src/scripts/login.ts
diff options
context:
space:
mode:
authorArpit Chakladar <54011232+arpitchakladar@users.noreply.github.com>2025-06-13 20:11:35 +0000
committerGitHub <noreply@github.com>2025-06-13 20:11:35 +0000
commitca20de409d08ec5abe2d3275bb97cfc5e8c164b3 (patch)
treea13b48386e20bf69e7ede0bfff4715c17b90549d /src/scripts/login.ts
parentcaa9c3f705730886cab911cb241703a10494581c (diff)
parent54467df36805eabf9113d1bb84d7434b331cd167 (diff)
downloadbanglar-bhumi-utils-ca20de409d08ec5abe2d3275bb97cfc5e8c164b3.tar.gz
banglar-bhumi-utils-ca20de409d08ec5abe2d3275bb97cfc5e8c164b3.zip
Merge pull request #2 from arpitchakladar/dev/porting-to-firefox
Dev/implementing OCR for captcha autofill
Diffstat (limited to 'src/scripts/login.ts')
-rw-r--r--src/scripts/login.ts111
1 files changed, 0 insertions, 111 deletions
diff --git a/src/scripts/login.ts b/src/scripts/login.ts
deleted file mode 100644
index 0fe5239..0000000
--- a/src/scripts/login.ts
+++ /dev/null
@@ -1,111 +0,0 @@
-import { interceptPost, interceptGet } from "@/shared/intercept-jquery-ajax";
-
-interceptPost("viewLoginAreaAction", args => {
- const callback = args[1];
- args[1] = (html: any) => {
- callback(html);
- const captchaInputElement = $("#txtCaptcha");
- const captchaValueElement = $("#txtInput");
- captchaInputElement.val("FFFFFF");
- captchaValueElement.val("FFFFFF");
- (window as any).DrawLoginCaptcha = () => {};
- (window as any).validateLoginCaptcha = () => true;
- captchaValueElement.hide();
- captchaInputElement.hide();
- $(".captcharefresh").hide();
- }
-});
-interceptPost("viewPasswordRecoveryArea", args => {
- const callback = args[1];
- args[1] = (html: any) => {
- callback(html);
- const captchaInputElement = $("#dText");
- const captchaValueElement = $("#captaText");
- captchaInputElement.val("FFFFFF");
- captchaValueElement.val("FFFFFF");
- (window as any).Captcha = () => {};
- captchaValueElement.hide();
- captchaInputElement.hide();
- $("#captchaRef").hide();
- }
-});
-interceptPost("login.action", args => {
- const callback = args[2];
- args[2] = (data: any) => {
- const loginData = args[1];
- if (!data.exception && data.checkmsg === "success") {
- window.localStorage.setItem("loginData", btoa(JSON.stringify(loginData)));
- }
-
- callback(data);
- $("#txtInput").val("FFFFFF");
- $("#beforeLoginDiv").hide();
- $("#afterLoginDiv").css("display", "block");
- $("#afterLoginLabel").css("display", "block");
- const username = atob(loginData.username.split("RGxycyMxMjM=")[1]);
- $("#afterLoginLabel > label").html(`--> ${username}`);
- };
-});
-interceptPost("changePassword.action", args => {
- const callback = args[2];
- args[2] = (data: any) => {
- callback(data);
- $("#txtInput").val("FFFFFF");
- };
-});
-interceptGet("viewRegistrationAreaAction", args => {
- const callback = args[1];
- args[1] = (html: any) => {
- callback(html);
- const captchaInputElement = $("#regInputCaptcha");
- const captchaValueElement = $("#regCaptcha");
- captchaInputElement.val("FFFFFF");
- captchaValueElement.val("FFFFFF");
- $("#registrationForm > div > div:nth-child(5) > div:nth-child(3)").hide();
- $("#registrationForm > div > div:nth-child(5) > div:nth-child(4)").hide();
- $("#registrationForm > div > div:nth-child(5) > div:nth-child(5)").hide();
- (window as any).DrawRegistrationCaptcha = () => {};
- (window as any).validateRegistrationCaptcha = () => true;
- }
-});
-interceptGet("viewChangePasswordAction", args => {
- const callback = args[1];
- args[1] = (html: any) => {
- callback(html);
- const captchaValueElement = $("#txtCaptcha");
- const captchaInputElement = $("#txtInput");
- captchaValueElement.val("FFFFFF");
- captchaInputElement.val("FFFFFF");
- (window as any).DrawLoginCaptcha = () => {};
- captchaValueElement.hide();
- captchaInputElement.hide();
- $(".captcharefresh").hide();
- }
-});
-
-document.addEventListener("DOMContentLoaded", () => {
- $("#afterLoginDiv > a").click(() => {
- window.localStorage.removeItem("loginData");
- });
-
- const login = () => {
- let loginData = window.localStorage.getItem("loginData");
- loginData = loginData ? JSON.parse(atob(loginData)) : null;
-
- if (loginData) {
- $.post(
- "/BanglarBhumi/login.action",
- loginData,
- data => {
- if (data.exception || data.checkmsg !== "success") {
- loginData = null;
- }
- },
- "json"
- );
- }
- };
-
- login();
- setInterval(login, 1000 * 60);
-});