PageSourceSearch

https://rpglifesciences.com/admin/Library/login.js

js rpglifesciences.com collected 2026-09-29 06:39:47 UTC 5,523 bytes, 193 lines download raw bytes

1 $(document).ready(function () {
2	 
3 	//enable below to catch form submit
4 	/*
5	$("form").submit(function () {
6    	return false;
7    });
8	*/
9 	
10	$("#register_box").hide();
11	$("#forgot_box").hide();
12  
13	$("#register").click(function () {
14		$("#login_box").slideUp(500);
15		$("#register_box").slideUp(500);
16		$("#register_box").slideDown(500);
17	});
18	
19	$("#forgot").click(function () {
20		$("#login_box").slideUp(500);
21		$("#register_box").hide();
22		$("#forgot_box").slideDown(500);
23	});
24
25	$(".already_member").click(function () {
26		$("#register_box").slideUp(500);
27		$("#forgot_box").slideUp(500);
28		$("#login_box").slideDown(500);
29    });	
30
31	//button login click
32    $("#btn-login").click(function () {
33
34        var  un    = $("#login-username"),
35             pa    = $("#login-password");
36
37       //validate login form
38       if(login.validateLogin(un, pa) === true) { 
39	   
40           //validation passed, prepare data that will be sent to server
41            var data = {
42                username: un.val(),
43                password: pa.val(),
44                id: {
45                    username: "login-username",
46                    password: "login-password"
47                }
48            };
49
50            //send login data to server
51            login.loginUser(data);
52       }
53});
54
55//set focus on username field when page is loaded
56$("#login-username").focus();
57
58});
59
60
61/** LOGIN NAMESPACE
62 ======================================== */
63var login = {};
64
65login.loginUser = function (data) {
66    var btn = $("#btn-login"),
67	system_admin_folder = $("#system_admin_folder").val();
68	
69    engine.loadingButton(btn, $_lang.logging_in);
70
71    //encrypt password before sending it through the network
72    data.password = CryptoJS.SHA512(data.password).toString();
73
74    $.ajax({
75        url: "../"+system_admin_folder+"/Engine/Cases.php",
76        type: "POST",
77        dataType: "json",
78        data: {
79            action  : "checkLogin",
80            username: data.username,
81            password: data.password,
82            id      : data.id
83        },
84        success: function (result) {
85           engine.removeLoadingButton(btn);
86           if( result.status === 'success' )
87               location.reload();
88           else {
89               engine.displayErrorMessage($("#login-password"), result.message);
90           }
91
92        }
93    });
94};
95
96login.validateLogin = function (un, pass) {
97    var valid = true;
98
99    //remove previous error messages
100    engine.removeErrorMessages();
101
102    //check if all fields are filled
103    $("#login-form").find("input").each(function () {
104        var el = $(this);
105
106        if($.trim(el.val()) === "") {
107            engine.displayErrorMessage(el, $_lang.field_required);
108          valid = false;
109        }
110    });
111    return valid;
112};
113
114
115login.verify_mobile = function () {
116
117		var	system_admin_folder = $("#system_admin_folder").val();
118			btn   = $("#verify_mobile_button");
119			engine.loadingButton(btn, $_lang.authenticating_mobile);
120			
121			//remove previous error messages
122			engine.removeErrorMessages();
123			
124			mobile   		= $("#mobile").val();
125			country_code   	= $("#country_code").val();
126			var fdata 		= new FormData($('#loginwithmobileform')[0]);
127			fdata.append('mobile', mobile);
128			fdata.append('country_code', country_code);
129			
130		$.ajax({
131					url: "../"+system_admin_folder+"/Engine/Cases.php",
132					type : "POST", // Type of request to be send, called as method
133					data : fdata,
134					contentType : false, // The content type used when sending data to the server.
135					cache : false, // To unable request pages to be cached
136					processData : false, // To send DOMDocument or non processed data file it is set to false
137					success : function (result) // A function to be called if request succeeds
138					{
139						engine.removeLoadingButton(btn);
140						var res = JSON.parse(result);
141						if(res.status === "error") {
142							engine.displayErrorMessage($("#wrong-mobile"), res.message);
143						}
144						else{
145							alert(res.message);
146							var form = document.getElementById("loginwithmobileform");
147							form.style.display = "none";
148							var form = document.getElementById("submitOTPform");
149							form.style.display = "block";
150						}
151					}
152		});
153	
154};
155
156login.verify_otp = function () {
157
158		var	system_admin_folder = $("#system_admin_folder").val();
159			btn   = $("#verify_otp_button");
160			engine.loadingButton(btn, $_lang.authenticating_mobile);
161			
162			//remove previous error messages
163			engine.removeErrorMessages();
164			
165			mobile   		= $("#mobile").val();
166			country_code   	= $("#country_code").val();
167			var formData 	= new FormData($('#submitOTPform')[0]);
168			formData.append('mobile', mobile);
169			formData.append('country_code', country_code);
170			
171		$.ajax({
172					url: "../"+system_admin_folder+"/Engine/Cases.php",
173					type : "POST", // Type of request to be send, called as method
174					data : formData,
175					contentType : false, // The content type used when sending data to the server.
176					cache : false, // To unable request pages to be cached
177					processData : false, // To send DOMDocument or non processed data file it is set to false
178					success : function (result) // A function to be called if request succeeds
179					{
180						engine.removeLoadingButton(btn);
181						var res = JSON.parse(result);
182						
183						if(res.status === "error") {
184							engine.displayErrorMessage($("#wrong-otp"), res.message);
185						}
186						else{
187						    location.reload();
188							//location.replace("https://www.rpglifesciences.com/website/rpgserv.php");
189						}
190					}
191		});
192	
193};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.