<commit_before>import template from './login.html';
import angular from 'angular';

class LoginCtrl {
  /* @ngInject */
  constructor($http, userService, blogService, $state) {
    this.$http = $http;
    this.userService = userService;
    this.blogService = blogService;
    this.$state = $state;
  }


  $onInit() {
    this.user = this.userService.user;
    this.isLoggedIn = this.user.isLoggedIn;
    this.resetStatus();
  }

  resetStatus () {
    this.error = false;
    this.logging = false;
  }

  logIn () {
    this.resetStatus();
    this.logging = true;
    const user = {
      email: this.email,
      password: <PASSWORD>
    }
    this.userService.logIn(user)
      .then((resp)=> {
        if (resp.data.token){ 
          this.userService.saveToken(resp.data.token);
          this.user.isLoggedIn = this.userService.isLoggedIn();
          this.user.payload = this.userService.getUser();
          this.goBack();
        }
        else {
          this.error = resp.data.message;
          this.logging = false;
        }
      })<commit_msg>fixed problem with getting an error when logging in properly<commit_after>import template from './login.html';
import angular from 'angular';

class LoginCtrl {
  /* @ngInject */
  constructor($http, userService, blogService, $state) {
    this.$http = $http;
    this.userService = userService;
    this.blogService = blogService;
    this.$state = $state;
  }


  $onInit() {
    this.user = this.userService.user;
    this.isLoggedIn = this.user.isLoggedIn;
    this.resetStatus();
  }

  resetStatus () {
    this.error = false;
    this.logging = false;
  }

  logIn () {
    this.resetStatus();
    this.logging = true;
    const user = {
      email: this.email,
      password: <PASSWORD>
    }
    this.userService.logIn(user)
      .then((resp)=> {
        if (resp.data.token){ 
          this.userService.saveToken(resp.data.token);
          this.user.isLoggedIn = this.userService.isLoggedIn();
          this.user.payload = this.userService.getUser();
          this.blogService.goBack();
          
        }
        else {
          this.error = resp.data.message;
          this.logging = false;
        }
      })
{'fraction_non_alphanumeric': 0.13445761166818596, 'fraction_numerical': 0.0, 'mean_word_length': 2.237463126843658, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '1364016', 'n_tokens_mistral': 697, 'n_tokens_neox': 688, 'n_words': 127}