<commit_before>import { Component, ViewChild } from '@angular/core';
import { SmallModalComponent } from './small-modal.component';
import { LoginService } from '../services/login.service';
import { LoginWindowService } from '../services/login-window.service';
import { AuthService } from '../services/auth.service';
import { LoginWindowService } from '../services/login-window.service';
import { UserModel } from '../models/user.model';

@Component({
  moduleId: module.id,
  selector: 'sd-login',
  templateUrl: 'login.html',
})
export class LoginComponent {

  @ViewChild('modal') public modal: SmallModalComponent;

  username: string;
  password: string;
  accessCode: string;
  checking: boolean = false;
  failure: boolean = false;
  userLogin: boolean = true;

  constructor(private login: LoginService,
              private auth: AuthService,
              private loginWindow: LoginWindowService) {
    this.loginWindow.show$.subscribe(this.show.bind(this));
  }

  show(userLogin: boolean = true) {
    this.userLogin = userLogin;
    this.modal.show();
  }

  submit() {
    this.failure = false;
    this.checking = true;
    if (this.userLogin) {
      this.loginUser();
    } else {
      this.loginGuest();
    }
  }

  close() {
    this.failure = false;
    this.checking = false;
    this.username = '';
    this.password = '';
    this.accessCode = '';
    this.modal.hide();
    this.loginWindow.closed();
  }

  private loginUser() {
    this.login.post(this.username, this.password).subscribe(
      user => this.loginSuccess(user),
      err => this.loginFailed()
    );
  }

  private loginGuest() {
    this.login.get(this.accessCode).subscribe(
      user => {
        user.attributes.api_token = this.accessCode;
        this.loginSuccess(user);
      },
      err => this.loginFailed()
    );
  }

  private loginSuccess(user: UserModel) {
    this.auth.user = user;
    this.close();
  }

  private loginFailed() {
    this.failure = true;
    this.checking = false;
  }

}
<commit_msg>show access code login by default<commit_after>import { Component, ViewChild } from '@angular/core';
import { SmallModalComponent } from './small-modal.component';
import { LoginService } from '../services/login.service';
import { LoginWindowService } from '../services/login-window.service';
import { AuthService } from '../services/auth.service';
import { LoginWindowService } from '../services/login-window.service';
import { UserModel } from '../models/user.model';

@Component({
  moduleId: module.id,
  selector: 'sd-login',
  templateUrl: 'login.html',
})
export class LoginComponent {

  @ViewChild('modal') public modal: SmallModalComponent;

  username: string;
  password: string;
  accessCode: string;
  checking: boolean = false;
  failure: boolean = false;
  userLogin: boolean = false;

  constructor(private login: LoginService,
              private auth: AuthService,
              private loginWindow: LoginWindowService) {
    this.loginWindow.show$.subscribe(this.show.bind(this));
  }

  show(userLogin: boolean = false) {
    this.userLogin = userLogin;
    this.modal.show();
  }

  submit() {
    this.failure = false;
    this.checking = true;
    if (this.userLogin) {
      this.loginUser();
    } else {
      this.loginGuest();
    }
  }

  close() {
    this.failure = false;
    this.checking = false;
    this.username = '';
    this.password = '';
    this.accessCode = '';
    this.modal.hide();
    this.loginWindow.closed();
  }

  private loginUser() {
    this.login.post(this.username, this.password).subscribe(
      user => this.loginSuccess(user),
      err => this.loginFailed()
    );
  }

  private loginGuest() {
    this.login.get(this.accessCode).subscribe(
      user => {
        user.attributes.api_token = this.accessCode;
        this.loginSuccess(user);
      },
      err => this.loginFailed()
    );
  }

  private loginSuccess(user: UserModel) {
    this.auth.user = user;
    this.close();
  }

  private loginFailed() {
    this.failure = true;
    this.checking = false;
  }

}

{'fraction_non_alphanumeric': 0.14250493096646943, 'fraction_numerical': 0.0, 'mean_word_length': 2.977450980392157, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '1681109', 'n_tokens_mistral': 1228, 'n_tokens_neox': 1197, 'n_words': 251}