Permalink
Browse files

Make short client id optional

  • Loading branch information...
1 parent ef20d3d commit 27d066c8cd7fa256a285007698104a636b467924 @Rauno56 Rauno56 committed Feb 6, 2014
Showing with 9 additions and 7 deletions.
  1. +9 −7 google-plus-signin.js
View
@@ -8,13 +8,16 @@
angular.module('directive.g+signin', []).
directive('googlePlusSignin', function () {
+ var ending = /\.apps\.googleusercontent\.com$/;
+
return {
restrict: 'E',
template: '<span class="g-signin"></span>',
replace: true,
link: function (scope, element, attrs) {
+ attrs.clientid += (ending.test(attrs.clientid) ? '' : '.apps.googleusercontent.com');
- attrs.$set('data-clientid', attrs.clientid + '.apps.googleusercontent.com');
+ attrs.$set('data-clientid', attrs.clientid);
// Some default values, based on prior versions of this directive
var defaults = {
@@ -40,13 +43,12 @@ angular.module('directive.g+signin', []).
})();
}
};
-}).run(['$window','$rootScope',function($window,$rootScope) {
+}).run(['$window','$rootScope',function($window, $rootScope) {
$window.signinCallback = function (authResult) {
- if(authResult && authResult.access_token){
- $rootScope.$broadcast('event:google-plus-signin-success',authResult);
- }
- else{
- $rootScope.$broadcast('event:google-plus-signin-failure',authResult);
+ if (authResult && authResult.access_token){
+ $rootScope.$broadcast('event:google-plus-signin-success', authResult);
+ } else {
+ $rootScope.$broadcast('event:google-plus-signin-failure', authResult);
}
};
}]);

0 comments on commit 27d066c

Please sign in to comment.