aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Web/Tango.MachineService/Scripts/Account/Login.js
blob: 3354a54233dc30af97272abee35cdf50374209cb (plain)
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
$(document).ready(function () {

    var state = false;

    //$("input:text:visible:first").focus();

    $('#accesspanel').on('submit', function (e) {

        e.preventDefault();

        state = !state;

        document.getElementById("litheader").className = "poweron";
        document.getElementById("go").className = "";
        document.getElementById("go").value = "Initializing...";

        $('#accesspanel').css("cursor", "wait");
        $("#go").attr("disabled", true);
        $('#go').css("cursor", "wait");

        $.ajax({
            type: "POST",
            url: "Login",
            // The key needs to match your method's input parameter (case-sensitive).
            data: JSON.stringify({ Email: $("#email").val(), Password: $("#password").val() }),
            contentType: "application/json; charset=utf-8",
            success: function (data) {
                window.location.href = "/Downloads/index";
            },
            error: function (errMsg) {
                document.getElementById("litheader").className = "";
                document.getElementById("go").className = "denied";
                document.getElementById("go").value = "Access Denied";

                setTimeout(function () {

                    document.getElementById("litheader").className = "";
                    document.getElementById("go").className = "";
                    document.getElementById("go").value = "Authorize";

                    $('#accesspanel').css("cursor", "auto");
                    $("#go").attr("disabled", false);
                    $('#go').css("cursor", "auto");

                }, 1500);
            },
        });

    });

});