~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to www/media/common/tos.js

  • Committer: mattgiuca
  • Date: 2008-02-15 05:43:52 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:475
Commited some earlier changes to users.sql (not committed earlier due to
misunderstanding :|) Previous changes today actually depended on the database
being updated with this schema.

users.sql: Added "pending" option to login.state, and added a bunch of new
fields to login: expiry timers, time of last login.

login.py: Checks if account has expired. Sets last login.
    (Currently buggy with some XXXs, because we don't have a way to convert
    Python time values into SQL).

db.py: Added last_login to list of allowable fields for login.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
 * activate their account).
25
25
 */
26
26
 
27
 
/* The user must send this declaration message to ensure they acknowledge the
28
 
 * TOS.
29
 
 * (This is the exact same string as in userservice).
30
 
 */
31
 
USER_DECLARATION = {"declaration":
32
 
                        "I accept the IVLE Terms of Service"};
33
 
 
34
27
/** Creates a "dot dot dot" animation to indicate the client is waiting for a
35
28
 * response from the server.
36
29
 * This will keep animating forever.
63
56
     * We need to wait on this page for the server's response.
64
57
     */
65
58
    /* Start by clearing away these buttons. */
66
 
    var tos_acceptbuttons = document.getElementById("tos_acceptbuttons");
 
59
    tos_acceptbuttons = document.getElementById("tos_acceptbuttons");
67
60
    dom_removechildren(tos_acceptbuttons);
68
61
    /* Print a "please wait" message */
69
62
    tos_acceptbuttons.appendChild(dom_make_text_elem("p",
70
63
        "IVLE is now setting up your environment. Please wait..."));
71
64
    tos_acceptbuttons.appendChild(make_dots_anim());
72
 
    /* Make the Ajax request */
73
 
    ajax_call(handle_accept_response, "userservice", "activate_me",
74
 
        USER_DECLARATION, "POST")
75
 
}
76
 
 
77
 
function handle_accept_response(xhr)
78
 
{
79
 
    /* TEMP */
80
 
    var tos_acceptbuttons = document.getElementById("tos_acceptbuttons");
81
 
    dom_removechildren(tos_acceptbuttons);
82
 
 
83
 
    try
84
 
    {
85
 
        response = JSON.parse(xhr.responseText);
86
 
    }
87
 
    catch (e)
88
 
    {
89
 
        response = {'response': 'parse-failure'};
90
 
    }
91
 
 
92
 
    if (response.response == 'usrmgt-failure')
93
 
    {
94
 
    tos_acceptbuttons.appendChild(dom_make_text_elem("p",
95
 
        "Error connecting to User Management server. Please try again later.")); 
96
 
    }
97
 
    else if (response.response == 'parse-failure')
98
 
    {
99
 
    tos_acceptbuttons.appendChild(dom_make_text_elem("p",
100
 
        "Error connecting to server. Please try again later. "));
101
 
    }
102
 
    else
103
 
    {
104
 
        /* Refresh the page; as the user is now (apparently) logged in */
105
 
        window.location.href = parse_url(window.location.href).args["url"] || "/";
106
 
    }
107
65
}
108
66
 
109
67
function decline_license()
110
68
{
111
69
    /* Redirect to the logout page */
112
 
    window.location.href = app_path("+logout");
 
70
    window.location.href = app_path("logout");
113
71
}