Merge pull request #501 in FS/freeswitch from vc-configs to master

* commit '34d72cba985247531c3745d649cc5b1947bc3f48':
  remove unused code
  FS-8183 #resolve #comment add google api logins to Verto Communicator
  FS-8102 #resolve #comment Add auto-provision/config support to VC
This commit is contained in:
Ken Rice committed 2015-09-22 14:16:31 -05:00
commit 04b83a38be
11 files changed
+147 -37

No files matched your search

@@ -88,6 +88,10 @@
var disconnectCallback = function(v, connected) {
console.debug('Redirecting to login page.');
storage.reset();
if (typeof gapi !== 'undefined'){
console.debug(gapi);
gapi.auth.signOut();
}
$location.path('/login');
};
@@ -275,6 +279,40 @@
});
$scope.$on('event:google-plus-signin-success', function (event,authResult) {
// Send login to server or save into cookie
console.log('Google+ Login Success');
console.log(authResult);
gapi.client.load('plus', 'v1', gapiClientLoaded);
});
function gapiClientLoaded() {
gapi.client.plus.people.get({userId: 'me'}).execute(handleEmailResponse);
}
function handleEmailResponse(resp){
var primaryEmail;
for (var i=0; i < resp.emails.length; i++) {
if (resp.emails[i].type === 'account') primaryEmail = resp.emails[i].value;
}
console.debug("Primary Email: " + primaryEmail );
console.debug("display name: " + resp.displayName);
console.debug("imageurl: " + resp.image.url);
console.debug(resp);
console.debug(verto.data);
verto.data.email = primaryEmail;
verto.data.name = resp.displayName;
storage.data.name = verto.data.name;
storage.data.email = verto.data.email;
$scope.login();
}
$scope.$on('event:google-plus-signin-failure', function (event,authResult) {
// Auth failure or signout detected
console.log('Google+ Login Failure');
});
$rootScope.callActive = function(data) {
verto.data.mutedMic = storage.data.mutedMic;
verto.data.mutedVideo = storage.data.mutedVideo;