<commit_before>/**
 * CareWheels - Login Controller
 *
 */
angular.module('careWheels')
  .controller('loginController',
    function($scope, $controller, User, $state, $ionicLoading, $ionicHistory, $ionicPopup, GroupInfo, $interval, notifications, onlineStatus, VERSION_NUMBER){

    var DOWNLOAD_INTERVAL = 1000 * 60 * 5; // constant interval for download, 5 mins
    var dataDownload = $scope.$new();
    var dataAnalysis = $scope.$new();
    var loginTimeout = false;
    var loginIntervalSteps = 0;
    var popupTemplate = '<ion-spinner></ion-spinner>' + '<p>Contacting Server...</p>';
    var info = '';

    var credentials = angular.fromJson(window.localStorage['loginCredentials']);

    $ionicHistory.nextViewOptions({disableBack: true});

    $controller('DownloadCtrl', {$scope : dataDownload});
    $controller('AnalysisCtrl', {$scope : dataAnalysis});

    $scope.rememberMe = false;
    $scope.logoImage = 'img/CareWheelsLogo.png';
    $scope.connectionError = false;
    $scope.versionNumber = VERSION_NUMBER;


    /**
     * Login function is called from app.js. This method
     * goes through the following steps
     *
     *      1. login into the carebank
     *      2. download data from sen.se
     *      3. analyze the data
     *      4. if success - redirect to group view, otherwise
     *         reload the login controller, and try again.
     *         (user will have to manually input credentials at this point)
     * */
    $scope.login = function(uname, passwd, rmbr) {
      User.login(uname, passwd, rmbr).then(function(response) {

        if (User.credentials()) {
          //pull up loading overlay so user knows App hasn't frozen
          $ionicLoading.show({ template: popupTemplate });

          // do the data download
          dataDownload.DownloadData();

          // store the interval promise in this variable<commit_msg>Add feature: upload log after log in succesfully.<commit_after>/**
 * CareWheels - Login Controller
 *
 */
angular.module('careWheels')
  .controller('loginController',
    function($scope, $controller, User, $state, $ionicLoading, $ionicHistory, $ionicPopup, GroupInfo, $interval, notifications, onlineStatus, VERSION_NUMBER, $fileLogger, fileloggerService){

    var DOWNLOAD_INTERVAL = 1000 * 60 * 5; // constant interval for download, 5 mins
    var dataDownload = $scope.$new();
    var dataAnalysis = $scope.$new();
    var loginTimeout = false;
    var loginIntervalSteps = 0;
    var popupTemplate = '<ion-spinner></ion-spinner>' + '<p>Contacting Server...</p>';
    var info = '';

    var credentials = angular.fromJson(window.localStorage['loginCredentials']);

    $ionicHistory.nextViewOptions({disableBack: true});

    $controller('DownloadCtrl', {$scope : dataDownload});
    $controller('AnalysisCtrl', {$scope : dataAnalysis});

    $scope.rememberMe = false;
    $scope.logoImage = 'img/CareWheelsLogo.png';
    $scope.connectionError = false;
    $scope.versionNumber = VERSION_NUMBER;


    /**
     * Login function is called from app.js. This method
     * goes through the following steps
     *
     *      1. login into the carebank
     *      2. download data from sen.se
     *      3. analyze the data
     *      4. if success - redirect to group view, otherwise
     *         reload the login controller, and try again.
     *         (user will have to manually input credentials at this point)
     * */
    $scope.login = function(uname, passwd, rmbr) {
      User.login(uname, passwd, rmbr).then(function(response) {

        if (User.credentials()) {
          // do the log upload
          console.log(uname + " - " + passwd);
          fileloggerService.initLogComponent();
          fileloggerService.logUpload(uname, passwd);
          console.log("Done upload log file!");

          //pull up loading overlay so user knows App hasn't frozen
          $ionicLoading.show({ template: popupTemplate });

          // do the data download
          dataDownload.DownloadData();

          // store the interval promise in this variable
{'fraction_non_alphanumeric': 0.11837237977805179, 'fraction_numerical': 0.006411837237977805, 'mean_word_length': 2.8702290076335877, 'pattern_counts': {'":': 0, '<': 11, '<?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': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4195986', 'n_tokens_mistral': 1147, 'n_tokens_neox': 1087, 'n_words': 327}