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
|
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");
});
setInterval(() => {
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"
);
}
}, 1000 * 60 * 5);
});
|