Skip to content

Commit

Permalink
displays 'invalid credentials' when inputting unauthorized credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
ema14006 committed Mar 11, 2019
1 parent d710fe5 commit ee67b05
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/app/authentication/authentication.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ <h4 class="text-center mb-3">Log In</h4>
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.
</p>
</p>
</div>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions src/app/authentication/authentication.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export class AuthenticationComponent implements OnInit {
// private items: Array<string>;
@ViewChild('email_input') email_input: ElementRef;
@ViewChild('password_input') password_input: ElementRef;
content = null;

constructor(private data: LoginService, private router: Router, private handleError: ErrorHandler) {
}
Expand Down
13 changes: 12 additions & 1 deletion src/app/http-error.interceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<any>, next: HttpHandler): Observable<HttpEvent<any>> {
Expand All @@ -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}`;
Expand Down

0 comments on commit ee67b05

Please sign in to comment.