From a08607762db5681785159358084213558a5f11f9 Mon Sep 17 00:00:00 2001 From: Arpit Chakladar <54011232+arpitchakladar@users.noreply.github.com> Date: Sat, 4 Feb 2023 12:20:46 +0530 Subject: Initial commit --- src/scripts/auto-login.ts | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/scripts/auto-login.ts (limited to 'src/scripts/auto-login.ts') diff --git a/src/scripts/auto-login.ts b/src/scripts/auto-login.ts new file mode 100644 index 0000000..0da8ce3 --- /dev/null +++ b/src/scripts/auto-login.ts @@ -0,0 +1,32 @@ +const proxiedPost = $.post; + +let loginData: any = null; + +$.post = function() { + if (arguments[0].endsWith("login.action")) { + const callback = arguments[2]; + arguments[2] = (data: any) => { + if (!data.exception && data.checkmsg === "success") { + loginData = arguments[1]; + } + callback(data); + }; + } + + return proxiedPost.apply(this, Array.from(arguments) as any); +}; + +setInterval(() => { + if (loginData) { + $.post( + "/BanglarBhumi/login.action", + loginData, + data => { + if (data.exception || data.checkmsg !== "success") { + loginData = null; + } + }, + "json" + ); + } +}, 1000 * 60 * 5); -- cgit v1.2.3