70 lines
2.2 KiB
Plaintext
70 lines
2.2 KiB
Plaintext
.external-login
|
|
if facebook_auth
|
|
div#fb-root
|
|
script.
|
|
window.fbAsyncInit = function() {
|
|
FB.init({
|
|
appId : '#{facebook_auth}',
|
|
cookie : true,
|
|
xfbml : true,
|
|
version : 'v2.8'
|
|
});
|
|
FB.AppEvents.logPageView();
|
|
};
|
|
|
|
(function(d, s, id) {
|
|
var js, fjs = d.getElementsByTagName(s)[0];
|
|
if (d.getElementById(id)) return;
|
|
js = d.createElement(s); js.id = id;
|
|
js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.10&appId=1124948240960869";
|
|
fjs.parentNode.insertBefore(js, fjs);
|
|
}(document, 'script', 'facebook-jssdk'));
|
|
fb:login-button(scope="public_profile,email", onlogin="checkLoginState();" data-max-rows="1", data-size="large", data-button-type="login_with", data-show-faces="false", data-auto-logout-link="false", data-use-continue-as="false")
|
|
if google_auth
|
|
script(src="https://apis.google.com/js/api:client.js")
|
|
a.googleLogin
|
|
i.fa.fa-fw.fa-google
|
|
span Log in With Google
|
|
script.
|
|
var googleUser = {};
|
|
var startApp = function() {
|
|
gapi.load('auth2', function(){
|
|
// Retrieve the singleton for the GoogleAuth library and set up the client.
|
|
auth2 = gapi.auth2.init({
|
|
client_id: '#{google_auth}',
|
|
cookiepolicy: 'single_host_origin',
|
|
fetch_basic_profile: true
|
|
});
|
|
attachSignin(document.querySelector('.googleLogin'));
|
|
});
|
|
};
|
|
|
|
function attachSignin(element) {
|
|
auth2.attachClickHandler(element, {},
|
|
function (googleUser) {
|
|
let profile = googleUser.getBasicProfile();
|
|
let dataTree = {
|
|
id_token: googleUser.getAuthResponse().id_token,
|
|
name: profile.getName(),
|
|
email: profile.getEmail(),
|
|
image: profile.getImageUrl()
|
|
};
|
|
|
|
if (window.googlePOST) {
|
|
window.googlePOST(dataTree);
|
|
}
|
|
}, function(error) {
|
|
alert('Failed to log you in using Google.');
|
|
});
|
|
}
|
|
|
|
startApp()
|
|
if twitter_auth
|
|
a.twitterLogin.loginDiag(href="/api/external/twitter/login")
|
|
i.fa.fa-fw.fa-twitter
|
|
span Log in With Twitter
|
|
if discord_auth
|
|
a.discordLogin.loginDiag(href="/api/external/discord/login")
|
|
img(src="/static/image/Discord-Logo-White.svg")
|
|
span Log in With Discord
|