From ee67b05219d55e99d6093da4bc68de9b12d6298b Mon Sep 17 00:00:00 2001 From: Emil Abraham Date: Mon, 11 Mar 2019 15:41:27 -0400 Subject: [PATCH] displays 'invalid credentials' when inputting unauthorized credentials --- .../authentication/authentication.component.html | 2 +- src/app/authentication/authentication.component.ts | 1 + src/app/http-error.interceptor.ts | 13 ++++++++++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/app/authentication/authentication.component.html b/src/app/authentication/authentication.component.html index c497239..6e83028 100644 --- a/src/app/authentication/authentication.component.html +++ b/src/app/authentication/authentication.component.html @@ -25,7 +25,7 @@

Log In

service of quality energy systems. Our commercial businesses include Kinsley Power Systems, a top distributor of industrial and residential KOHLER® generators for over 50 years and Kinsley Energy Systems, representing prime movers for co-generation, biomass and landfill applications. -

+

diff --git a/src/app/authentication/authentication.component.ts b/src/app/authentication/authentication.component.ts index 49d4f1b..741d0d6 100644 --- a/src/app/authentication/authentication.component.ts +++ b/src/app/authentication/authentication.component.ts @@ -16,6 +16,7 @@ export class AuthenticationComponent implements OnInit { // private items: Array; @ViewChild('email_input') email_input: ElementRef; @ViewChild('password_input') password_input: ElementRef; + content = null; constructor(private data: LoginService, private router: Router, private handleError: ErrorHandler) { } diff --git a/src/app/http-error.interceptor.ts b/src/app/http-error.interceptor.ts index 9e6214a..eb7c259 100644 --- a/src/app/http-error.interceptor.ts +++ b/src/app/http-error.interceptor.ts @@ -8,6 +8,9 @@ import { } from '@angular/common/http'; import { Observable, throwError } from 'rxjs'; import { retry, catchError } from 'rxjs/operators'; +import { Component, Input} from '@angular/core'; + + export class HttpErrorInterceptor implements HttpInterceptor { intercept(request: HttpRequest, next: HttpHandler): Observable> { @@ -19,7 +22,15 @@ export class HttpErrorInterceptor implements HttpInterceptor { if (error.error instanceof ErrorEvent) { // client-side error errorMessage = `Error: ${error.error.message}`; - } else { + } + else if (error.message == "Http failure response for http://sd5-backend.engr.uconn.edu/auth: 404 Not Found") + { + //console.log(error.message); + + window.alert("Invalid Credentials"); + + } + else { // server-side error //console.log("poop"); errorMessage = `Error Code: ${error.status}\nMessage: ${error.message}`;