<commit_before>import {Component, Input, ViewEncapsulation} from '@angular/core';
import { Router, ROUTER_DIRECTIVES } from '@angular/router';
import { CORE_DIRECTIVES, FORM_DIRECTIVES } from '@angular/common';
import { LoginService } from '../shared/login/login.service';

const styles   = require('./login.css');
const template = require('./login.html');

@Component({
    selector: 'login',
    directives: [ ROUTER_DIRECTIVES, CORE_DIRECTIVES, FORM_DIRECTIVES ],
    providers: [LoginService],
    template: template,
    styles: [ styles ]
})
export class Login {

    constructor(public router: Router, public loginService: LoginService) {
    }

    login(event, username, password) {
        event.preventDefault();
        let body:any = JSON.stringify({ username, password });

        this.loginService.login(body).subscribe(
            response => {
                localStorage.setItem('token_key', response.json().token_key);
                this.router.navigate(['/yearly']);
            },<commit_msg>appy httpauth library in login component<commit_after>import {Component} from '@angular/core';
import { Router, ROUTER_DIRECTIVES } from '@angular/router';
import { CORE_DIRECTIVES, FORM_DIRECTIVES } from '@angular/common';
import { LoginService } from '../shared/login/login.service';

const styles   = require('./login.css');
const template = require('./login.html');

@Component({
    selector: 'login',
    directives: [ ROUTER_DIRECTIVES, CORE_DIRECTIVES, FORM_DIRECTIVES ],
    providers: [LoginService],
    template: template,
    styles: [ styles ]
})
export class Login {

    constructor(public router: Router, public loginService: LoginService) {
    }

    login(event, username, password) {
        event.preventDefault();
        let body:any = JSON.stringify({ username, password });

        this.loginService.login(body).subscribe(
            response => {
                localStorage.setItem('id_token', response.json().token_key);
                this.router.navigate(['/yearly']);
            },
{'fraction_non_alphanumeric': 0.13555992141453832, 'fraction_numerical': 0.0, 'mean_word_length': 3.4282608695652175, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4531513', 'n_tokens_mistral': 572, 'n_tokens_neox': 565, 'n_words': 127}