From 23bfc340428bce646e62380234a63cdd101cbe91 Mon Sep 17 00:00:00 2001 From: Chris Veilleux Date: Mon, 8 Apr 2019 00:14:51 -0500 Subject: [PATCH] changed federated authentication to use tokens instead of email addresses for security purposes --- .../authentication-step.component.html | 6 ++++-- .../authentication-step.component.ts | 11 +++++++++-- .../app/modules/profile/pages/new/new.component.ts | 7 ++++--- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/projects/account/src/app/modules/profile/components/views/authentication-step/authentication-step.component.html b/projects/account/src/app/modules/profile/components/views/authentication-step/authentication-step.component.html index a2be505..788f121 100644 --- a/projects/account/src/app/modules/profile/components/views/authentication-step/authentication-step.component.html +++ b/projects/account/src/app/modules/profile/components/views/authentication-step/authentication-step.component.html @@ -4,8 +4,10 @@

Log In Using...

{{federatedLoginText}}

- - + + + +
diff --git a/projects/account/src/app/modules/profile/components/views/authentication-step/authentication-step.component.ts b/projects/account/src/app/modules/profile/components/views/authentication-step/authentication-step.component.ts index 569f181..84c203d 100644 --- a/projects/account/src/app/modules/profile/components/views/authentication-step/authentication-step.component.ts +++ b/projects/account/src/app/modules/profile/components/views/authentication-step/authentication-step.component.ts @@ -1,6 +1,11 @@ import { Component, Input, OnInit } from '@angular/core'; import { FormGroup } from '@angular/forms'; +export interface FederatedLoginToken { + platform: string; + token: string; +} + @Component({ selector: 'account-authentication-step', templateUrl: './authentication-step.component.html', @@ -21,8 +26,10 @@ export class AuthenticationStepComponent implements OnInit { 'servers are encrypted for your privacy and protection.'; } - onFacebookLogin(email: string) { - this.newAcctForm.patchValue({login: {federatedEmail: email}}); + onFederatedLogin(token: FederatedLoginToken) { + this.newAcctForm.patchValue( + {login: {federatedPlatform: token.platform, federatedToken: token.token}} + ); this.disableInternal = true; } } diff --git a/projects/account/src/app/modules/profile/pages/new/new.component.ts b/projects/account/src/app/modules/profile/pages/new/new.component.ts index 3a1a8c5..ed1720f 100644 --- a/projects/account/src/app/modules/profile/pages/new/new.component.ts +++ b/projects/account/src/app/modules/profile/pages/new/new.component.ts @@ -24,11 +24,11 @@ const noDelay = 0; export function loginValidator(): ValidatorFn { return (loginGroup: FormGroup) => { let valid = true; - const federatedEmail = loginGroup.controls['federatedEmail']; + const federatedToken = loginGroup.controls['federatedToken']; const userEnteredEmail = loginGroup.controls['userEnteredEmail']; const password = loginGroup.controls['password']; - if (federatedEmail.value) { + if (federatedToken.value) { if (userEnteredEmail.value || password.value) { valid = false; } @@ -101,7 +101,8 @@ export class NewComponent implements OnInit { private buildForm() { const loginGroup = this.formBuilder.group( { - federatedEmail: [null], + federatedPlatform: [null], + federatedToken: [null], userEnteredEmail: [null, Validators.email], password: [null] },