mgebbe@0: doctype html
mgebbe@0: html(lang="en")
mgebbe@0: head
mgebbe@0: title= pageTitle
mgebbe@0:
mgebbe@0: link(rel='stylesheet', href='/stylesheets/style.css')
mgebbe@0: link(rel='icon', href='/images/favicon.ico',type='image/x-icon')
mgebbe@0: link(rel='stylesheet', href='/stylesheets/bootstrap.min.css')
mgebbe@0:
mgebbe@0: // load jquery
mgebbe@0: script(src='https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js')
mgebbe@0:
mgebbe@0: // load googleplus api
mgebbe@0: script(type='text/javascript').
mgebbe@0: (function() {
mgebbe@0: var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
mgebbe@0: po.src = 'https://apis.google.com/js/client:plusone.js';
mgebbe@0: var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
mgebbe@0: })();
mgebbe@0:
mgebbe@6:
mgebbe@0: // load googleplus api sign in
mgebbe@0:
mgebbe@0: script(type='text/javascript').
mgebbe@6:
mgebbe@3:
mgebbe@0: (function() {
mgebbe@0: var po = document.createElement('script');
mgebbe@0: po.type = 'text/javascript'; po.async = true;
mgebbe@0: po.src = 'https://apis.google.com/js/client:plusone.js?onload=render';
mgebbe@0: var s = document.getElementsByTagName('script')[0];
mgebbe@0: s.parentNode.insertBefore(po, s);
mgebbe@0: })();
mgebbe@0:
mgebbe@0: /* Executed when the APIs finish loading */
mgebbe@0: function render() {
mgebbe@0:
mgebbe@0: gapi.signin.render('gp-root', {
mgebbe@0: 'callback': 'signinCallback',
mgebbe@15: 'clientid': 'GOOGLEPLUSID.apps.googleusercontent.com',
mgebbe@0: 'redirecturi': 'postmessage',
mgebbe@0: 'response_type' : 'code',
mgebbe@0: 'accesstype': 'offline',
mgebbe@0: 'approvalprompt': 'force',
mgebbe@15: 'cookiepolicy': "https://server.example",
mgebbe@0: 'requestvisibleactions': 'http://schemas.google.com/AddActivity',
mgebbe@0: 'scope': 'https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/userinfo.email'
mgebbe@0: });
mgebbe@0: }
mgebbe@0:
mgebbe@0: // handle googleplus callback
mgebbe@0:
mgebbe@0: script(type='text/javascript').
mgebbe@0: function signinCallback(authResult) {
mgebbe@0: if (authResult['status']['signed_in']) {
mgebbe@0: // Update the app to reflect a signed in user
mgebbe@0: // Hide the sign-in button now that the user is authorized, for example:
mgebbe@0: //document.getElementById('signinButton').setAttribute('style', 'display: none');
mgebbe@0: //alert('googleplus is ready for bridging');
mgebbe@6:
mgebbe@0: gapi.client.load('plus', 'v1', function() {
mgebbe@0: var request = gapi.client.plus.people.get({
mgebbe@0: 'userId': 'me'
mgebbe@0: });
mgebbe@6: request.execute(function(resp) {
mgebbe@6: //alert(JSON.stringify(resp));
mgebbe@0: $('#gpstatus').html(' ' + resp.displayName + '');
mgebbe@0: var token = gapi.auth.getToken();
mgebbe@6: //alert(JSON.stringify(resp.id));
mgebbe@0: $('#gpid').val(resp.id+'@google');
mgebbe@0: $('#gptoken').val(token.access_token + ';' + token.code);
mgebbe@6: });
mgebbe@6: });
mgebbe@0:
mgebbe@6:
mgebbe@0: } else {
mgebbe@0: // Update the app to reflect a signed out user
mgebbe@0: // Possible error values:
mgebbe@0: // "user_signed_out" - User is signed-out
mgebbe@0: // "access_denied" - User denied access to your app
mgebbe@0: // "immediate_failed" - Could not automatically log in the user
mgebbe@0: //alert('you cancelled login or did not fully authorize: ' + authResult['error']);
mgebbe@0: }
mgebbe@0: }
mgebbe@0:
mgebbe@6: script.
mgebbe@3: // twitter stuff
mgebbe@3: function getCookie(cname) {
mgebbe@3: var name = cname + "=";
mgebbe@3: var ca = document.cookie.split(';');
mgebbe@3: for(var i=0; i ' + getCookie('twitteruser') + '');
mgebbe@6:
mgebbe@0: $.ajaxSetup({
mgebbe@0: cache: true
mgebbe@0: });
mgebbe@0:
mgebbe@12: $.getScript('//connect.facebook.net/de_DE/all.js', function () {
mgebbe@0: FB.init({
mgebbe@15: appId: 'FACEBOOKID',
mgebbe@12: status: true
mgebbe@0: });
mgebbe@0:
mgebbe@0: FB.getLoginStatus(function(response) {
mgebbe@0: if (response.status === 'connected') {
mgebbe@0: // the user is logged in and has authenticated your
mgebbe@0: // app, and response.authResponse supplies
mgebbe@0: // the user's ID, a valid access token, a signed
mgebbe@6: // request, and the time the access token
mgebbe@0: // and signed request each expire
mgebbe@0: var uid = response.authResponse.userID;
mgebbe@0: var accessToken = response.authResponse.accessToken;
mgebbe@0: $('#fbtoken').val(accessToken);
mgebbe@0: FB.api('/me', function(response) {
mgebbe@0: $('#fbstatus').html(' ' + response.name + '');
mgebbe@0: $('#fbid').val(response.id+'@facebook');
mgebbe@0: });
mgebbe@0: } else if (response.status === 'not_authorized') {
mgebbe@6: // the user is logged in to Facebook,
mgebbe@0: // but has not authenticated your app
mgebbe@0: $('#fbstatus').html('not authorized');
mgebbe@0: } else {
mgebbe@0: // the user isn't logged in to Facebook.
mgebbe@0: $('#fbstatus').html('not logged in');
mgebbe@0: }
mgebbe@0: });
mgebbe@0: });
mgebbe@6:
mgebbe@0: $('.fbloginbutton').on('click', function(e){
mgebbe@0: FB.login(function(response) {
mgebbe@0: if (response.authResponse) {
mgebbe@0: FB.api('/me', function(response) {
mgebbe@0: //document.getElementById("logoutbutton").disabled = false;
mgebbe@0: });
mgebbe@0: } else {
mgebbe@0: //Not logged in
mgebbe@0: //alert('you cancelled login or did not fully authorize.');
mgebbe@0: }
mgebbe@12: }, {scope: 'publish_actions,publish_stream,read_stream,read_friendlists,user_likes,user_friends,user_activities,user_status'});
mgebbe@0: })
mgebbe@0:
mgebbe@0: //$('.logoutbutton').on('click', function(e){
mgebbe@0: // FB.logout();
mgebbe@0: // })
mgebbe@6: $('#pumpobj').val(JSON.stringify(!{JSON.stringify(user)}));
mgebbe@0: });
mgebbe@0:
mgebbe@0: body
mgebbe@0: block content
mgebbe@6: .main
mgebbe@15: .headlinebox
mgebbe@15: img(class="ribbon", src="/images/ribbonl.png")
mgebbe@15: h1(class='headline') pumpbridge.
connecting social networks
mgebbe@7: #pump-root.pump-root
mgebbe@7: h4
mgebbe@15: | logged in as:
mgebbe@7: a(id='pumpstatus',class='pumpstatus',href=user.homepage)=user.id
mgebbe@7: #fb.fb
mgebbe@7: #fb-root.fb-root
mgebbe@7: input(id='fbloginbutton',type='image',class='fbloginbutton',value='fbLogin',src='images/fb.svg',width='100px',height='100px')
mgebbe@7: #fb-info.fb-info
mgebbe@7: i(id='fbstatus') not logged in
mgebbe@7: br
mgebbe@7: form(class='',action='/bridge',method='post')
mgebbe@7: input(id='fbdeleted',name='fbdelete',hidden='true',value=user.id)
mgebbe@15: button(id='fbdeletebutton',type='submit',class='btn btn-default btn-xs',hidden='true')
mgebbe@7: | delete credentials
mgebbe@15: button(id='fbloginbutton2',name='fbloginbutton2',class='btn btn-default btn-xs',onClick='$("#fbloginbutton").click()')
mgebbe@15: | add credentials
mgebbe@7: #gp.gp
mgebbe@7: #gp-root.gp-root
mgebbe@7: input(id='gploginbutton',type='image',class='gploginbutton',value='gpLogin',src='images/gp.svg',width='100px',height='100px')
mgebbe@7: #gp-info.gp-info
mgebbe@7: i(id='gpstatus') not logged in
mgebbe@7: br
mgebbe@7: form(class='',action='/bridge',method='post')
mgebbe@7: input(id='gpdeleted',name='gpdelete',hidden='true',value=user.id)
mgebbe@15: button(name='gpdeletebutton',id='gpdeletebutton',type='submit',class='btn btn-default btn-xs')
mgebbe@7: | delete credentials
mgebbe@15: button(id='gploginbutton2',name='gploginbutton2',class='btn btn-default btn-xs',onClick='$("#gploginbutton").click()')
mgebbe@15: | add credentials
mgebbe@7: #tw.tw
mgebbe@7: #tw-root.tw-root
mgebbe@7: a(href='/add-account'): input(type='image',value='twitterlogin',src='images/twitter.svg',width='100px',height='100px')
mgebbe@7: #tw-info.tw-info
mgebbe@7: i(id='twstatus') not logged in
mgebbe@7: br
mgebbe@7: form(class='',action='/bridge',method='post')
mgebbe@7: input(id='twdeleted',name='twdelete',hidden='true',value=user.id)
mgebbe@15: button(id='twdeletebutton',type='submit',class='btn btn-default btn-xs')
mgebbe@7: | delete credentials
mgebbe@15: button(id='twloginbutton2',name='twloginbutton2',type='submit',class='btn btn-default btn-xs',onClick='location.href="/add-account"')
mgebbe@15: | add credentials
mgebbe@7: form(class='',action='/bridge',method='post')
mgebbe@6: input(id='pumpid',name='pumpid',hidden='true',value=user.id)
mgebbe@6: input(id='pumptoken',name='pumptoken',hidden='true', value=user.token)
mgebbe@6: input(id='pumpsecret',name='pumpsecret',hidden='true', value=user.secret)
mgebbe@6: input(id='pumpobj',name='pumpobj', hidden='true' value='')
mgebbe@0: input(id='fbid',name='fbid',hidden='true')
mgebbe@0: input(id='fbtoken',name='fbtoken',hidden='true')
mgebbe@0: input(id='gpid',name='gpid',hidden='true')
mgebbe@0: input(id='gptoken',name='gptoken',hidden='true',size=100)
mgebbe@3: br
mgebbe@15: | you need to extra save the credentials
mgebbe@15: br
mgebbe@15: | for facebook and googleplus
mgebbe@15: br
mgebbe@7: input(type='submit',class='btn btn-default',value='save credentials')
mgebbe@0: .footer
mgebbe@0: #logout.logout
mgebbe@0: //input(id='logoutbutton',type='button',class='logoutbutton',value='Logout',disabled)
mgebbe@0: form(class='',action='/logout',method='post')
mgebbe@0: input(type='submit',class='btn btn-default',value='logout')
mgebbe@0: br
mgebbe@0: p.
mgebbe@15: pumpbridge is Free Software and available under the Apache License 2.0.
mgebbe@15:
mgebbe@15: visit https://wald.intevation.org/projects/pumpbridge for more informations!
mgebbe@15:
mgebbe@15: pumpbridge is hosted and operated by Mathias Gebbe (Contact)