From 775e8f0d31b6971812da01e08bb750df20e18e78 Mon Sep 17 00:00:00 2001 From: Nikolaos Laskaris Date: Wed, 1 Nov 2017 19:23:00 +0200 Subject: [PATCH] - --- .../src/app/login-OLD/login-page.html | 55 ------------ dmp-frontend/src/app/login-OLD/login-page.ts | 87 ------------------- 2 files changed, 142 deletions(-) delete mode 100644 dmp-frontend/src/app/login-OLD/login-page.html delete mode 100644 dmp-frontend/src/app/login-OLD/login-page.ts diff --git a/dmp-frontend/src/app/login-OLD/login-page.html b/dmp-frontend/src/app/login-OLD/login-page.html deleted file mode 100644 index 56caf9983..000000000 --- a/dmp-frontend/src/app/login-OLD/login-page.html +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - -
- - - - - -
- - - - - - - - - - - \ No newline at end of file diff --git a/dmp-frontend/src/app/login-OLD/login-page.ts b/dmp-frontend/src/app/login-OLD/login-page.ts deleted file mode 100644 index 169a15775..000000000 --- a/dmp-frontend/src/app/login-OLD/login-page.ts +++ /dev/null @@ -1,87 +0,0 @@ -import { Component, OnInit, NgZone, AfterViewInit, ElementRef } from '@angular/core'; -import { GoogleSignInSuccess } from 'angular-google-signin'; -import { Router, ActivatedRoute } from '@angular/router'; -import { TokenService, TokenProvider } from '../services/login/token.service'; - -@Component({ - selector: 'login-page', - templateUrl: './login-page.html', - providers: [] -}) -export class LoginComponent implements OnInit, AfterViewInit { - returnUrl: string; - token: any; - - constructor( - private route: ActivatedRoute, - private router: Router, - private ngZone: NgZone, - private tokenService: TokenService, - private element: ElementRef - ) { - - } - - ngOnInit() { - // reset login status - //this.authenticationService.logout(); - - // get return url from route parameters or default to '/' - - //this.returnUrl = this.route.snapshot.queryParams['returnUrl'] || '/'; - } - //private myClientId: string = '524432312250-vhgidft856v8qftsc81kls4c74v87d8o.apps.googleusercontent.com'; - private myClientId: string = '1010962018903-glegmqudqtl1lub0150vacopbu06lgsg.apps.googleusercontent.com'; - - public auth2: any; - - private scope = [ - 'profile', - 'email' - ].join(' '); - - public googleInit() { - - gapi.load('auth2', () => { - this.auth2 = gapi.auth2.init({ - client_id: this.myClientId, - cookie_policy: 'single_host_origin', - scope: this.scope - }); - var buttonElement = this.element.nativeElement.querySelector('#googleBtn'); - this.attachSignin(buttonElement); - }); - } - - public attachSignin(element) { - this.auth2.attachClickHandler(element, {}, - (googleUser) => { - this.token = googleUser.getAuthResponse().id_token; - - let profile = googleUser.getBasicProfile(); - - this.tokenService.setLoggedIn(true); - this.tokenService.setToken(this.token); - this.tokenService.setProvider(TokenProvider.google); - this.tokenService.setUsername(profile.getName()); - this.tokenService.setEmail(profile.getEmail()); - - this.ngZone.run(() => this.router.navigateByUrl('tabs')); - - window.location.reload(); - - }, function (error) { - console.log(JSON.stringify(error, undefined, 2)); - }); - - - - } - - ngAfterViewInit() { - this.googleInit(); - } - - - -}