cherry pick from master

This commit is contained in:
Nikolaos Laskaris 2017-11-23 13:13:20 +02:00 committed by annampak
parent 2c47630087
commit 123660f250
4 changed files with 11 additions and 21 deletions

View File

@ -57,12 +57,10 @@ export class AppComponent implements OnInit {
login(){
//redirect to login page
this.router.navigate(['/login'], { queryParams: { /*refresh : Math.random() ,returnUrl: this.state.url*/ }});
location.reload();
}
logout(){
this.tokenService.logout();
location.reload();
}

View File

@ -27,16 +27,6 @@ export class GooggleSignInComponent implements OnInit, AfterViewInit, Injectable
}
ngAfterViewInit() {
/*
$( window ).on( "load", function(){
if($("#googleBtn").length == 0) {
alert("GoogleButton found");
}
});
*/
this.googleInit();
@ -64,8 +54,16 @@ export class GooggleSignInComponent implements OnInit, AfterViewInit, Injectable
cookiepolicy: 'single_host_origin',
scope: this.scope
});
//RE-Render the button (due to known issues of google-button with angular's lifecycle)
gapi.signin2.render('googleBtn', {
'onsuccess': console.log("SUCCESSFULLY RERENDERED THE BUTTON"),
'onfailure': console.log("FAILED TO RERENDER THE BUTTON")
});
var buttonElement = this.element.nativeElement.querySelector('#googleBtn');
this.attachSignin(buttonElement);
});
}

View File

@ -2,7 +2,7 @@
var sign_out_google = (function() {
var auth2 = gapi.auth2.getAuthInstance();
auth2.signOut().then(function () {
console.log('User signed out from google.');
console.log('User signed out from google.');
});
});

View File

@ -52,16 +52,10 @@
</head>
<body>
<script>
  function signOut() {
    var auth2 = gapi.auth2.getAuthInstance();
    auth2.signOut().then(function () {
      console.log('User signed out.');
localStorage.removeItem('currentUser');
    });
  }
 
</script>
<app-root></app-root>
</body>
</html>
</html>