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