<commit_before>import { Component } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { IonicPage, NavController, NavParams, AlertController, LoadingController } from 'ionic-angular';

import { AuthService } from '../../providers/auth.service';

@IonicPage()
@Component({
  selector: 'page-login',
  templateUrl: 'login.html',
})
export class LoginPage{

  loginForm: FormGroup;

  constructor(
    public navCtrl: NavController, 
    public navParams: NavParams,
    public formBuilder: FormBuilder,
    public authService: AuthService,
    public alertCtrl: AlertController, 
    public loadingCtrl: LoadingController
  ) {
    this.loginForm = this.makeLoginForm();
  }
  
  doLogin( event: Event ){
    event.preventDefault();

    let load = this.loadingCtrl.create({
      dismissOnPageChange: true,
    });
    load.present();

    let email = this.loginForm.value.email;
    let password = this.loginForm.value.password;
    this.authService.doLogin(email, password)
    .then(user=>{
      this.authService.getProfile(user.uid)
      .then(data =>{
        let profile = data.val();
        let pages: any = {
          'admin': 'HomeAdminPage',
          'distributor': 'HomeDistributorPage',
          'preventa': 'HomePresalePage',
        };
        this.navCtrl.setRoot(pages[profile.role]);
      })<commit_msg>fix error w/ login<commit_after>import { Component } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { IonicPage, NavController, NavParams, AlertController, LoadingController } from 'ionic-angular';

import { AuthService } from '../../providers/auth.service';

@IonicPage()
@Component({
  selector: 'page-login',
  templateUrl: 'login.html',
})
export class LoginPage{

  loginForm: FormGroup;

  constructor(
    public navCtrl: NavController, 
    public navParams: NavParams,
    public formBuilder: FormBuilder,
    public authService: AuthService,
    public alertCtrl: AlertController, 
    public loadingCtrl: LoadingController
  ) {
    this.loginForm = this.makeLoginForm();
  }
  
  doLogin( event: Event ){
    event.preventDefault();

    let load = this.loadingCtrl.create({
      dismissOnPageChange: true,
    });
    load.present();

    let email = this.loginForm.value.email;
    let password = this.loginForm.value.password;
    this.authService.doLogin(email, password)
    .then(user=>{
      return this.authService.getProfile(user.uid);
    })
    .then(profile =>{
      let pages: any = {
        'admin': 'HomeAdminPage',
        'distributor': 'HomeDistributorPage',
        'preventa': 'HomePresalePage',
      };
      this.navCtrl.setRoot(pages[profile.role]);
{'fraction_non_alphanumeric': 0.1271186440677966, 'fraction_numerical': 0.0, 'mean_word_length': 3.429037520391517, 'pattern_counts': {'":': 0, '<': 3, '<?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': '2939843', 'n_tokens_mistral': 807, 'n_tokens_neox': 784, 'n_words': 177}