PageSourceSearch

https://www.horesta.dk/scripts/ajax-handler/login-ajax-handler.js

js horesta.dk collected 2026-10-02 08:33:29 UTC 11,975 bytes, 309 lines download raw bytes

1$(document).ready(function () {
2    var Upremember = [];
3    $('.invalid-login').hide();
4    $('.userNameTxt-error').hide();
5    $('.passwordTxthome-error').hide();
6    $('.loader-login').hide();
7    $('#invalid-login').hide();
8    $('#loginForm').on('submit', function (event) {
9        event.preventDefault();
10        var $userName = $('#userNameTxtResearch').val();
11        var $password = $('#passwordTxthomeResearch').val();
12        if ($userName !== "" && $password !== "") {
13            var formdata = new FormData($(this).get(0));
14            $.ajax({
15                url: this.action,
16                type: this.method,
17                data: formdata,
18                processData: false,
19                contentType: false,
20                //beforeSend: function () {
21                //    $('.loader-login').show();
22                //},
23                success: function (result) {
24
25                    if (result.Status === "Success") {
26                        if (result.Url !== "") {
27                            window.location = result.Url;
28                        }
29                        else {
30                            var currentAction = window.localStorage.getItem('eventLoggedIn');
31                            if (currentAction != null) {
32                                window.localStorage.clear('eventLoggedIn');
33                                console.log('currentAction', currentAction);
34                                window.location.href = currentAction;
35
36                            }
37                            else {
38                                window.location.reload();
39                            }
40                        }
41                        $('.invalid-login').hide();
42
43                        var isChecked = $('#rememberUserPass').prop('checked');
44                        if (isChecked) {
45                            Upremember = [];
46                            Upremember.push($('#userNameTxtResearch').val());
47                            Upremember.push($('#passwordTxthomeResearch').val());
48                            createCookie("rmbr", Upremember, 360);
49
50                        }
51                        else {
52                            eraseCookie("rmbr");
53                        }
54
55                        //    $('.loader-login').hide()
56                    }
57                    else if (result.Status === "Failed") {
58                        $('.invalid-login').show();
59                        //$('.loader-login').hide()
60                    }
61                    else if (result.Status === "Activate") {
62                        $(".activate-user").removeClass("hidden")
63                    }
64
65                },
66                complete: function () {
67                    // $('.loader-overlay').hide();
68                    $('.loader-login').hide()
69                }
70            });
71        }
72    })
73    $('#signOut').on('click', function (event) {
74
75        //var formdata = new FormData($(this).get(0));
76        $.ajax({
77            url: "/HomeController/MemberLogout/",
78            type: "POST",
79            data: {},
80            processData: false,
81            contentType: false,
82            beforeSend: function () {
83                // $('.loader-overlay').show();
84            },
85            success: function (result) {
86                location.reload();
87            },
88            complete: function () {
89                // $('.loader-overlay').hide();
90            }
91        });
92        return false;
93    });
94    $('#login-form-paywall').on('submit', function (e) {
95        e.preventDefault();
96        var $userName = $('#userNameTxtResearchPaywall').val();
97        var $password = $('#passwordTxthomeResearchPaywall').val();
98        var $resultstatus = "";
99        var $redirectUrl = "";
100        if ($userName !== "" && $password !== "") {
101            var formdata = new FormData($(this).get(0));
102            $.ajax({
103                url: this.action,
104                type: this.method,
105                data: formdata,
106                processData: false,
107                contentType: false,
108                success: function (result) {
109                    if (result.Status === "Success") {
110                        $resultstatus = "Success";
111                        $redirectUrl = result.Url;
112                        var currentpageName = $('#pagaName').val();
113                        if (currentpageName == "L%c3%98NSTATISTIK") {
114                            $.confirm({
115                                title: 'Info!',
116                                content: 'We are redirecting you to SSO screen. It will take few minutes.. Please do not reload the page',
117                                buttons: {
118                                    Ok: function () {
119
120                                    }
121                                }
122                            });
123                        }
124                        //if (result.Url !== "") {
125                        //    window.open = result.Url;
126                        //}
127                        //else {
128                        //    window.location.reload();
129                        //}
130                        //$('.invalid-login').hide();
131                        //$('.invalid-login-paywall').hide();
132                        //$('.invalid-login-paywall_1').hide();
133                        window.location.reload();
134                    }
135                    else if (result.Status === "Failed") {
136
137                        $('.invalid-login-paywall').show();
138                        $('.invalid-login').show();
139                        $('.invalid-login-paywall_1').hide();
140                        //$('.reveal-login-form').trigger("click");
141                        $('#userNameTxtResearchPaywall').val('');
142                        $('#passwordTxthomeResearchPaywall').val('');
143                        $.confirm({
144                            title: 'Error!',
145                            content: 'Invalid Login',
146                            buttons: {
147                                Ok: function () {
148                                }
149                            }
150                        });
151                    }
152                },
153                complete: function () {
154                    if ($redirectUrl !== "") {
155                        window.location = $redirectUrl;
156                    }
157                    //else {
158                    //    window.location.reload();
159                    //}
160                    $('.invalid-login').hide();
161                    $('.invalid-login-paywall').hide();
162                    $('.invalid-login-paywall_1').hide();
163                }
164            });
165        }
166    });
167    //full width content
168    $('.login-full-width-form-paywall-cls').on('submit', function (e) {
169        e.preventDefault();
170        var $userName = $('#userNameTxtResearchPaywall_-text1').val();
171        var $password = $('#passwordTxthomeResearchPaywall_text1').val();
172        if ($userName !== "" && $password !== "") {
173            var formdata = new FormData($(this).get(0));
174            $.ajax({
175                url: this.action,
176                type: this.method,
177                data: formdata,
178                processData: false,
179                contentType: false,
180                success: function (result) {
181                    if (result.Status === "Success") {
182
183                        if (result.Url !== "") {
184                            window.location = result.Url;
185                        }
186                        else {
187                            window.location.reload();
188                        }
189                        $('.invalid-login').hide();
190                        $('.invalid-login-paywall_1').hide();
191                        $('.invalid-login-paywall').hide();
192                    }
193                    else if (result.Status === "Failed") {
194                        $('.invalid-login').hide();
195                        $('.invalid-login-paywall').hide();
196                        $('.invalid-login-paywall_1').show();
197                    }
198                },
199                complete: function () {
200
201                }
202            });
203        }
204    });
205    /*$('#login-right-side-form-paywall').on('submit', function (e) {*/
206    $('.paywall-login-form').on('submit', function (e) {
207        e.preventDefault();
208       // var $userName = $('#userNameTxtResearchPaywall_1').val();
209      //  var $password = $('#passwordTxthomeResearchPaywall_1').val();
210        var btnSubmit = $(this).find('.login-form-submit-btn');
211        var formData1 = $(this);
212        var $userName = formData1[0].valueOf('paywall-login-form')[0].value;
213        var $password = formData1[0].valueOf('paywall-login-form')[1].value;
214        if ($userName !== "" && $password !== "") {
215            var formdata = new FormData($(this).get(0));
216            $.ajax({
217                url: this.action,
218                type: this.method,
219                data: formdata,
220                processData: false,
221                contentType: false,
222                success: function (result) {
223                    if (result.Status === "Success") {
224
225                        if (result.Url !== "") {
226                            window.location = result.Url;
227                        }
228                        else {
229                            window.location.reload();
230                        }
231                        $('.invalid-login').hide();
232                        $('.invalid-login-paywall_1').hide();
233                        $('.invalid-login-paywall').hide();
234                    }
235                    else if (result.Status === "Failed") {
236                        //alert();
237                        $('.invalid-login').hide();
238                        $('.invalid-login-paywall').hide();
239                        $('.invalid-login-paywall_1').show();
240                    }
241                },
242                complete: function () {
243
244                }
245            });
246        }
247    });
248
249    $('#logintriggerRmbr').click(function (e) {
250        $('#rememberUserPass').prop('checked', false);
251
252        if (readCookie('rmbr') != null) {
253            var usr = readCookie('rmbr').split(',')[0];
254            var pss = readCookie('rmbr').split(',')[1];
255            if (usr.trim() != "" && pss.trim() != "") {
256                $('#rememberUserPass').prop('checked', true);
257            }
258
259            $('#userNameTxtResearch').val(usr);
260            $('#passwordTxthomeResearch').val(pss);
261        }
262
263
264
265    });
266
267    $('#logintriggersmall').click(function (e) {
268        $('#rememberUserPass').prop('checked', false);
269        if (readCookie('rmbr') != null) {
270            var usr = readCookie('rmbr').split(',')[0];
271            var pss = readCookie('rmbr').split(',')[1];
272            if (usr.trim() != "" && pss.trim() != "") {
273                $('#rememberUserPass').prop('checked', true);
274            }
275            $('#userNameTxtResearch').val(usr);
276            $('#passwordTxthomeResearch').val(pss);
277        }
278
279
280    });
281
282
283});
284
285function createCookie(name, value, days) {
286
287    if (days) {
288        var date = new Date();
289        date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
290        var expires = "; expires=" + date.toGMTString();
291    }
292    else var expires = "";
293    document.cookie = name + "=" + value + expires + "; path=/";
294}
295
296function readCookie(name) {
297    var nameEQ = name + "=";
298    var ca = document.cookie.split(';');
299    for (var i = 0; i < ca.length; i++) {
300        var c = ca[i];
301        while (c.charAt(0) == ' ') c = c.substring(1, c.length);
302        if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
303    }
304    return null;
305}
306
307function eraseCookie(name) {
308    createCookie(name, "", -1);
309}

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.