Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
updating login process changes, unauthenticated user not working yet
  • Loading branch information
rrc12004 committed Mar 1, 2019
1 parent 52c735d commit 9124e60
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 18 deletions.
12 changes: 4 additions & 8 deletions src/app/authentication/authentication.component.css
@@ -1,12 +1,8 @@
a
{
a {
text-decoration: none;
color: white;
}
/*
.login
{
box-shadow: 1px 1px 1px 1px grey;
padding: 20px;

.alert {
color: red;
}
*/
3 changes: 2 additions & 1 deletion src/app/authentication/authentication.component.html
Expand Up @@ -16,8 +16,9 @@
</div>

<!-- <a routerLink="/generator-search"><button type="submit" class="btn btn-primary">Submit</button></a> -->
<a href="#" class="btn btn-primary" (click)="logOn()">Submit</a>
<a href="#" class="btn btn-primary" (click)="logOn()">Submit</a>
</form>
<p id="peep"></p>
<p>
<br>
The Kinsley Group is a leading energy solutions supplier with a 50 plus year legacy of sales, rental and
Expand Down
23 changes: 14 additions & 9 deletions src/app/authentication/authentication.component.ts
Expand Up @@ -3,6 +3,7 @@ import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { LoginService } from '../services/login.service';
import { Router } from '@angular/router';

@Injectable()

@Component({
Expand All @@ -26,15 +27,19 @@ export class AuthenticationComponent implements OnInit {
};

this.data.authorizeUser(loginjson).subscribe((data) => {
const token = data['token'];
const message = data['message'];
if (message === 'Authorized') {
// Authorized
// console.log(token);
localStorage.setItem('auth_token', token);
// window.open();
this.router.navigateByUrl('/generator-search');
}
if (data) {
const token = data['token'];
const message = data['message'];
if (message === 'Authorized') {
// Authorized
// console.log(token);
localStorage.setItem('auth_token', token);
this.router.navigateByUrl('/generator-search');
}
} else {
document.getElementById('peep').innerHTML = 'Username or Password is Invalid';
}


});
}
Expand Down

0 comments on commit 9124e60

Please sign in to comment.