SHARE
TWEET

Untitled

a guest Aug 17th, 2018 108 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import { Component, OnInit } from '@angular/core';
  2. import {AuthService} from '../services/auth.service';
  3.  
  4. @Component({
  5.   selector: 'app-login',
  6.   templateUrl: './login.component.html',
  7.   styleUrls: ['./login.component.css']
  8. })
  9. export class LoginComponent implements OnInit {
  10.   message: string;
  11.   constructor(private authService: AuthService) { }
  12.  
  13.   ngOnInit() {
  14.   }
  15.  
  16.   login(username: string, password: string): boolean {
  17.     this.message = '';
  18.     if (!this.authService.login(username, password)) {
  19.       this.message = 'Incorrect credentials.';
  20.       setTimeout(function() {
  21.         this.message = '';
  22.       }.bind(this), 2500);
  23.     }
  24.     return false;
  25.   }
  26.   logout(): boolean {
  27.     this.authService.logout();
  28.     return false;
  29.   }
  30. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top