forked from cory/tildefriends
Added support for Google Sign-In, optional in every way.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3187 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
@ -266,7 +266,15 @@ function updateLogin() {
|
||||
var a = document.createElement("a");
|
||||
if (gCredentials && gCredentials.session) {
|
||||
a.appendChild(document.createTextNode("logout " + gCredentials.session.name));
|
||||
a.setAttribute("href", "/login/logout?return=" + encodeURIComponent(url()));
|
||||
if (gCredentials.session.google) {
|
||||
gapi.load("auth2", function() {
|
||||
gapi.auth2.init();
|
||||
});
|
||||
a.setAttribute("onclick", "logoutGoogle()");
|
||||
a.setAttribute("href", "#");
|
||||
} else {
|
||||
a.setAttribute("href", "/login/logout?return=" + encodeURIComponent(url()));
|
||||
}
|
||||
} else if (window.location.href.indexOf("?guest=1") != -1) {
|
||||
window.location.href = "/login?submit=Proceed+as+Guest&return=" + encodeURIComponent(url());
|
||||
} else {
|
||||
@ -275,6 +283,12 @@ function updateLogin() {
|
||||
login.appendChild(a);
|
||||
}
|
||||
|
||||
function logoutGoogle() {
|
||||
gapi.auth2.getAuthInstance().signOut().then(function() {
|
||||
window.location.href = "/login/logout?return=" + encodeURIComponent(url());
|
||||
});
|
||||
}
|
||||
|
||||
var gOriginalInput;
|
||||
function dragHover(event) {
|
||||
event.stopPropagation();
|
||||
|
Reference in New Issue
Block a user