Skip to content

Commit 1813fb3

Browse files
committed
Fix identation
1 parent cdabc71 commit 1813fb3

File tree

3 files changed

+78
-76
lines changed

3 files changed

+78
-76
lines changed

LICENSE

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
Copyright (c) 2012-2015 Alex Chernyakhovsky ([email protected])
2+
Copyright (c) 2015 Google, Inc.
23

34
Permission is hereby granted, free of charge, to any person obtaining a copy
45
of this software and associated documentation files (the "Software"), to deal

assets/webathena-sql/core.js

+76-76
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,43 @@
11
function supportsLocalStorage() {
22
try {
3-
return 'localStorage' in window && window['localStorage'] !== null;
3+
return 'localStorage' in window && window['localStorage'] !== null;
44
} catch (e) {
5-
return false;
5+
return false;
66
}
77
}
88

99
function getCachedTicket() {
1010
if (!supportsLocalStorage()) {
11-
return;
11+
return;
1212
}
1313
var storedTicket = localStorage["webathena.ticket"];
1414
if (!storedTicket) {
15-
return;
15+
return;
1616
}
1717
var session = krb.Session.fromDict(JSON.parse(storedTicket));
1818
if (session.isExpired()) {
19-
return;
19+
return;
2020
}
2121
return session;
2222
}
2323

2424
function saveTicketToCache(ticket) {
2525
if (!supportsLocalStorage()) {
26-
return;
26+
return;
2727
}
2828
localStorage["webathena.ticket"] = JSON.stringify(ticket);
2929
}
3030

3131
function destroyCachedTicket() {
3232
if (!supportsLocalStorage()) {
33-
return;
33+
return;
3434
}
3535
localStorage.removeItem("webathena.ticket");
3636
}
3737

3838
function getCurrentLocker() {
3939
if (!supportsLocalStorage()) {
40-
return;
40+
return;
4141
}
4242
// TODO implement this to actually work...
4343
return getCachedTicket().client.principalName.nameString[0];
@@ -47,29 +47,29 @@ function getTicket() {
4747
var deferred = Q.defer();
4848
var session = getCachedTicket();
4949
if (session) {
50-
deferred.resolve(session);
51-
return deferred.promise;
50+
deferred.resolve(session);
51+
return deferred.promise;
5252
}
5353
WinChan.open({
54-
url: "https://webathena.mit.edu/#!request_ticket_v1",
55-
relay_url: "https://webathena.mit.edu/relay.html",
56-
params: {
57-
realm: 'ATHENA.MIT.EDU',
58-
principal: ['host', 'sql.mit.edu'],
59-
}
54+
url: "https://webathena.mit.edu/#!request_ticket_v1",
55+
relay_url: "https://webathena.mit.edu/relay.html",
56+
params: {
57+
realm: 'ATHENA.MIT.EDU',
58+
principal: ['host', 'sql.mit.edu'],
59+
}
6060
}, function (err, r) {
61-
console.log("got reply", err, r);
62-
if (err) {
63-
deferred.reject(err);
64-
return;
65-
}
66-
if (r.status !== "OK") {
67-
deferred.reject(r);
68-
return;
69-
}
70-
saveTicketToCache(r.session);
71-
session = krb.Session.fromDict(r.session);
72-
deferred.resolve(session);
61+
console.log("got reply", err, r);
62+
if (err) {
63+
deferred.reject(err);
64+
return;
65+
}
66+
if (r.status !== "OK") {
67+
deferred.reject(r);
68+
return;
69+
}
70+
saveTicketToCache(r.session);
71+
session = krb.Session.fromDict(r.session);
72+
deferred.resolve(session);
7373
});
7474
return deferred.promise;
7575
}
@@ -81,8 +81,8 @@ function updateLoginControls() {
8181
notSignedIn.hidden = !!session;
8282
myAccount.hidden = !session;
8383
if (session) {
84-
var username = document.getElementById("sql-username");
85-
username.textContent = session.client.principalName.nameString[0];
84+
var username = document.getElementById("sql-username");
85+
username.textContent = session.client.principalName.nameString[0];
8686
}
8787
}
8888

@@ -100,7 +100,7 @@ document.getElementById("log-out").addEventListener("click", function (e) {
100100

101101
!function ($) {
102102
$(function() {
103-
updateLoginControls();
103+
updateLoginControls();
104104
})
105105
}(window.jQuery)
106106

@@ -122,23 +122,23 @@ function remctl(command) {
122122
var streams = { };
123123

124124
function flushStreams() {
125-
var overallLength = 0;
126-
for (var i = 0; (i < chunks.length); i++) {
127-
overallLength += chunks[i].length;
128-
}
129-
var arr = new Uint8Array(overallLength);
130-
overallLength = 0;
131-
for (var i = 0; (i < chunks.length); i++) {
132-
arr.set(chunks[i], overallLength);
133-
overallLength += chunks[i].length;
134-
}
135-
return arrayutils.toString(arr);
125+
var overallLength = 0;
126+
for (var i = 0; (i < chunks.length); i++) {
127+
overallLength += chunks[i].length;
128+
}
129+
var arr = new Uint8Array(overallLength);
130+
overallLength = 0;
131+
for (var i = 0; (i < chunks.length); i++) {
132+
arr.set(chunks[i], overallLength);
133+
overallLength += chunks[i].length;
134+
}
135+
return arrayutils.toString(arr);
136136
}
137137

138138
var chunks = [ ];
139139
return session.ready().then(function() {
140140
return session.command(command, function(stream, data) {
141-
chunks.push(data);
141+
chunks.push(data);
142142
});
143143
}).then(function(status) {
144144
if (status !== 0 && status !== 1) {
@@ -175,14 +175,14 @@ function showAlert(basename, heading, body, style) {
175175
var alertTemplate = $("#alert-template");
176176
var alertPlaceholder = $("#" + basename + "-placeholder");
177177
if (alertPlaceholder.length > 0) {
178-
var alertNode = alertTemplate.clone().removeAttr("id");
178+
var alertNode = alertTemplate.clone().removeAttr("id");
179179
alertNode.find(".alert-template-head").text(heading);
180180
alertNode.find(".alert-template-body").text(body);
181181
alertNode.removeAttr("hidden");
182-
if (style) {
182+
if (style) {
183183
alertNode.addClass(style);
184-
}
185-
alertPlaceholder.append(alertNode);
184+
}
185+
alertPlaceholder.append(alertNode);
186186
}
187187
}
188188

@@ -193,41 +193,41 @@ function clearAlerts(basename) {
193193
function registerModalListeners() {
194194
var cpw = $('#change-password');
195195
if (cpw) {
196-
cpw.unbind("submit");
197-
cpw.submit(function (e) {
198-
e.preventDefault();
196+
cpw.unbind("submit");
197+
cpw.submit(function (e) {
198+
e.preventDefault();
199199
clearAlerts("password-alert");
200-
pw = cpw.find(".field-password").val();
201-
confirmPw = cpw.find(".field-confirmPassword").val()
202-
if (pw.length < 6) {
203-
showAlert("password-alert", "Error!", "Password is too short.", "alert-error");
204-
return false;
205-
}
206-
if (pw === confirmPw) {
207-
showAlert("password-alert", "Processing!", "Please wait.");
200+
pw = cpw.find(".field-password").val();
201+
confirmPw = cpw.find(".field-confirmPassword").val()
202+
if (pw.length < 6) {
203+
showAlert("password-alert", "Error!", "Password is too short.", "alert-error");
204+
return false;
205+
}
206+
if (pw === confirmPw) {
207+
showAlert("password-alert", "Processing!", "Please wait.");
208208
cpw.find(":submit").attr("disabled", "");
209-
sqlCommand(["password", "set", getCurrentLocker(), pw]).finally(function () {
209+
sqlCommand(["password", "set", getCurrentLocker(), pw]).finally(function () {
210210
clearAlerts("password-alert");
211211
cpw.find(":submit").removeAttr("disabled");
212212
}).then(function (result) {
213-
showAlert("password-alert", "Success!", "Password updated.", "alert-success");
214-
}, function (err) {
213+
showAlert("password-alert", "Success!", "Password updated.", "alert-success");
214+
}, function (err) {
215215
showAlert("password-alert", "Error", "Failed to change password: " + err, "alert-error");
216216
throw err;
217217
}).done();
218-
return false;
219-
}
220-
showAlert("password-alert", "Error", "Passwords do not match.", "alert-error");
221-
return false;
222-
});
218+
return false;
219+
}
220+
showAlert("password-alert", "Error", "Passwords do not match.", "alert-error");
221+
return false;
222+
});
223223
}
224224
var profile = $('#change-profile');
225225
if (profile) {
226226
// Disable all input while we load up the profile.
227227
profile.find("input").attr("disabled", "");
228228
profile.find(":submit").attr("disabled", "");
229229

230-
showAlert("profile-alert", "Loading...", "Please wait.");
230+
showAlert("profile-alert", "Loading...", "Please wait.");
231231

232232
sqlCommand(["profile", "get", getCurrentLocker()]).finally(function () {
233233
clearAlerts("profile-alert");
@@ -241,8 +241,8 @@ function registerModalListeners() {
241241
profile.find(".field-user-email").val(result.email);
242242

243243
// NOW hook up the form.
244-
profile.submit(function (e) {
245-
e.preventDefault();
244+
profile.submit(function (e) {
245+
e.preventDefault();
246246
clearAlerts("profile-alert");
247247

248248
var fullname = profile.find(".field-user-fullname").val();
@@ -252,24 +252,24 @@ function registerModalListeners() {
252252
email: email
253253
});
254254

255-
showAlert("profile-alert", "Processing!", "Please wait.");
255+
showAlert("profile-alert", "Processing!", "Please wait.");
256256
cpw.find(":submit").attr("disabled", "");
257-
sqlCommand(["profile", "set", getCurrentLocker(), profileStr]).finally(function () {
257+
sqlCommand(["profile", "set", getCurrentLocker(), profileStr]).finally(function () {
258258
clearAlerts("profile-alert");
259259
cpw.find(":submit").removeAttr("disabled");
260260
}).then(function (result) {
261-
showAlert("profile-alert", "Success!", "Profile updated.", "alert-success");
262-
}, function (err) {
261+
showAlert("profile-alert", "Success!", "Profile updated.", "alert-success");
262+
}, function (err) {
263263
showAlert("profile-alert", "Error", "Failed to change profile: " + err, "alert-error");
264264
throw err;
265265
}).done();
266-
return false;
267-
});
266+
return false;
267+
});
268268
}, function (err) {
269269
showAlert("profile-alert", "Error", "Failed to get profile: " + err, "alert-error");
270270
}).done();
271271

272-
profile.unbind("submit");
272+
profile.unbind("submit");
273273
}
274274
}
275275

assets/webathena-sql/manage.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
function showConfirmDialog(database) {
23
var deferred = Q.defer();
34

0 commit comments

Comments
 (0)