PageSourceSearch

https://intranat.multibygg-kalmar.se/HR/login/js/login.js?v1.0.1

js multibygg-kalmar.se collected 2026-09-29 06:57:07 UTC 10,651 bytes, 337 lines download raw bytes

1
2var Core = {
3
4    // Domain: "http://localhost:62411",//debug
5    // Domain: "http://www.fastmoving.se",//release
6    Domain: "",//release
7    PostJson: function (url, data, callback, error) {
8        $.ajax({
9            dataType: "json",
10            type: 'POST',
11            data: { json: JSON.stringify(data) },
12            url: url,
13            success: function (res) {
14                callback(res)
15            },
16            error: function (err) {
17                callback(err);
18            }
19        });
20    },
21    GetJson: function (url, callback, error) {
22        $.ajax({
23            dataType: "json",
24            url: url,
25            data: null,
26            success: function (res) { callback(res) },
27            error: function (err) { error(err); }
28        });
29    },
30    FormatDate: function (date) {
31        var d = new Date(date),
32            month = '' + (d.getMonth() + 1),
33            day = '' + d.getDate(),
34            year = d.getFullYear();
35
36        if (month.length < 2)
37            month = '0' + month;
38        if (day.length < 2)
39            day = '0' + day;
40
41        return [year, month, day].join('-');
42    }
43};
44
45
46
47
48
49
50var id_token_global = null
51var access_token_global = null
52
53var userAgentApplication = new Msal.UserAgentApplication(applicationConfig.clientID, applicationConfig.authority, function (errorDes, token, error, tokenType, instance) {
54
55    // this callback is called after loginRedirect OR acquireTokenRedirect. It's not used with loginPopup,  acquireTokenPopup.
56    console.log('x');
57    if (error) {
58        console.log(error + ": " + errorDes);
59    }
60    else
61        console.log("Token type = " + tokenType);
62    console.log("yes");
63    if (token) {
64        // console.log(token)
65
66        if (this.getUser()) {
67            //console.log(this.getUser());
68            $("#load").addClass('active');
69            window.location.href = "/HR/login/default.aspx?token=" + this.getUser().idToken.oid;
70        }
71        // this.acquireTokenSilent(applicationConfig.scopes).then(function (access_token) {
72        //    console.log(this);
73        // });
74
75
76    }
77
78})
79
80if (localStorage.getItem('ad')) {
81    if (localStorage.getItem('ad') == "1") {
82        window.location.reload();
83        localStorage.removeItem('ad');
84    }
85}
86
87
88
89
90function update_app() {
91
92    var scopes_string = "https://graph.microsoft.com/user.read,https://graph.microsoft.com/user.readbasic.all"
93    applicationConfig.scopes = scopes_string.split(' ').join('').split(',')
94
95
96    console.log("hit");
97    console.log(userAgentApplication)
98    userAgentApplication = new Msal.UserAgentApplication(applicationConfig.clientID, applicationConfig.authority, function (errorDes, token, error, tokenType, instance) {
99        function authCallback(error, response) {
100            //handle redirect response
101            console.log(response)
102        }
103
104        userAgentApplication.handleRedirectCallback(authCallback);
105        // this callback is called after loginRedirect OR acquireTokenRedirect. It's not used with loginPopup,  acquireTokenPopup.
106        if (error) {
107            console.log(error + ": " + errorDes);
108        }
109        else
110            console.log("Token type = " + tokenType);
111
112    })
113    document.getElementById("sign_in_text").innerText = "Configuration updated: \n" + JSON.stringify(applicationConfig)
114}
115
116function sign_in() {
117    function authCallback(error, response) {
118        //handle redirect response
119        console.log(response)
120    }
121
122    //userAgentApplication.handleRedirectCallback(authCallback);
123
124    const loginRequest = {
125        scopes: ["https://graph.microsoft.com/User.Read"]
126    }
127    console.log('yes')
128    console.log(userAgentApplication)
129
130
131
132
133    userAgentApplication.loginRedirect(loginRequest.scopes, "&login_hint=" + $("#username").val());
134
135}
136function sign_in2() {
137    //  update_app();
138    console.log('HMMMM')
139    userAgentApplication.loginRedirect(applicationConfig.scopes).then(function (id_token) {
140        var user = userAgentApplication.getUser();
141
142        if (user) {
143            console.log("signed in sucessfully");
144            console.log(id_token);
145            id_token_global = id_token;
146            updatePage();
147            // get an access token
148            userAgentApplication.acquireTokenSilent(applicationConfig.scopes).then(function (access_token) {
149                console.log("Success acquiring access token");
150                console.log(access_token);
151                access_token_global = access_token;
152                updatePage();
153            }, function (error) {
154                // interaction required
155                if (error.indexOf("interaction_required" != -1)) {
156                    userAgentApplication.acquireTokenPopup(applicationConfig.scopes).then(function (access_token) {
157                        console.log("Success acquiring access token");
158                        console.log(access_token);
159                        access_token_global = access_token;
160                        updatePage();
161                    }, function (error) {
162                        console.log("Failure acquiring token: " + error);
163                        document.getElementById("sign_in_text").innerText = error;
164                    });
165                }
166            });
167
168        } else {
169            console.log("signed in failure");
170        }
171    }, function (error) {
172        console.log("error: " + error);
173        //document.getElementById("sign_in_text").innerText = error;
174    });
175
176}
177
178//var sign_in_button = document.getElementById("sign_in_button")
179//sign_in_button.addEventListener("click", sign_in);
180
181$().ready(function () {
182
183
184    $(".btn-help").click(function () {
185        $(".help").addClass('active');
186    });
187    $(".btn-close-help").click(function () {
188        $(".help").removeClass('active');
189    });
190    
191
192    $("#username").keyup(function () {
193        if ($(this).val() != "")
194            $(".step1go").removeClass('inactive');
195        else
196            $(".step1go").removeClass('active');
197
198    });
199
200
201    $("#password").keyup(function () {
202        if ($(this).val() != "")
203            $(".step2go").removeClass('inactive');
204        else
205            $(".step2go").removeClass('active');
206
207    });
208
209    //
210
211    $(".step1go").click(function () {
212
213        if ($("#username").val() != "") {
214            $("#load").addClass('active');
215
216            setTimeout(function () {
217                //if ($("#username").val() == "demo" || $("#username").val() == "Demo") {
218                //  //  alert('4469');
219                //    $("#sign_in_button").slideUp();
220                //    window.location.href ='/_e/login2019.aspx?guid=6450bdf1-b3ff-4245-b245-214d1ba829ad&id=4469'
221                //}
222                //else {
223                //    localStorage.setItem('ad', '1');
224                //    sign_in();
225                //}
226
227                ///_e/api/[email protected]
228
229                $("#sign_in_button").slideUp();
230                $(".alert-danger").hide();
231                $("#smsinformation").hide();
232                $("#sendnewpwemail").hide();
233                Core.GetJson('/HR/api/userinfo.aspx?u=' + $("#username").val(), function (d) {
234
235                 
236                    if (d == "1") {
237                        localStorage.setItem('ad', '1');
238                        sign_in();
239                    }
240
241                    if (d == "2") {
242                       // $("#load").removeClass('active');
243                       // $("#smsinformation").show();
244                        $("#load").removeClass('active');
245                        $(".step_1").slideUp();
246                        $(".step_1_pwreset").slideDown();
247                    }
248                    else {
249                        if (d != "1") {
250                            $("#load").removeClass('active');
251                            $(".step_1").slideUp();
252                            $(".step_2").slideDown();
253
254                            if ($("#username").val().includes('@') || d=="3")
255                            $("#sendnewpwemail").show();
256                        }
257                    }
258                }, function (e) { });
259            }, 200);
260
261        }
262    });
263
264    $(".btnback").click(function () {
265        $(".step_1").slideDown();
266        $(".step_2").slideUp();
267        $(".step_1_pwreset").slideUp();
268    });
269
270    $("#sendnewpwemail").click(function () {
271
272        $("#sendnewpwemail").hide();
273     
274        $("#load").addClass('active');
275
276        Core.GetJson('/HR/api/mail_newpassword.aspx?u=' + $("#username").val(), function (d) {
277            $("#load").removeClass('active');
278
279            if (d == 1) 
280                $("#mail_newpwsent").show();
281            else
282                $("#mail_error").show();
283
284        }, function (e) { });
285    });
286
287    $(".step1go_simple").click(function () {
288       
289        $(".step_1_pwreset").slideUp();
290        $(".step_2").slideDown();
291    });
292
293    $(".sendPw").click(function () {
294
295        $(".step_1_pwreset").slideUp();
296        $(".step_2").slideDown();
297        $("#load").addClass('active');
298        $("#error_sms").hide();
299        Core.GetJson('/HR/api/sms_newpassword.aspx?u=' + $("#username").val(), function (d) {
300
301            if (d == 1) {
302                $("#smsinformation").show();
303                $("#load").removeClass('active');
304                $(".step_1_pwreset").slideUp();
305                $(".step_2t").slideDown();
306            }
307            else
308                $("#error_sms").show();
309            
310        }, function (e) { });
311  
312    });
313
314    $(".step2go").click(function () {
315        if ($("#password").val() != "") {
316            $("#load").addClass('active');
317            Core.GetJson('/HR/api/login-call.aspx?username=' + $("#username").val() + "&password=" + $("#password").val(), function (d) {
318                console.log(d);
319               
320                if (d == 0) {
321                    $("#load").removeClass('active');
322                    $("#error").show();
323                }
324                else {
325                    //$(".step_2").slideUp();
326                   // $("#load").addClass('active');
327                    setTimeout(function() {
328                        window.location.href = '/e/hem';
329                    },200);
330                  
331                }
332               
333            }, function (e) { });
334        }
335    });
336
337});

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.