<commit_before>'use strict';

myApp.factory('Message', ['$resource', function ($resource) {
    return $resource('http://eneid-api.herokuapp.com/api/timeline');
}]);
myApp.factory('User', ['$resource', function ($resource) {
    return $resource('http://eneid-api.herokuapp.com/api/users/');
}]);

myApp.controller('TimeLineController', function ($scope, $timeout, Message, $cookies, $route) {
    $scope.currentTimeline = 0;

    $scope.update = function () {
        $scope.messages = Message.query();
        $scope.currentTimeline = $scope.currentTimeline + 1;
        $timeout($scope.update, 10000);
    };

    $scope.update();

    $scope.sendMessage = function() {
        new Message({contents: $scope.content}).$save();
        $scope.content = '';
        $route.reload();
    }
});

myApp.controller('LoggedController', function ($scope, $cookies, $location) {
    $scope.disconnect = function () {
        $cookies.token = null;
        $location.path("/auth");
    };

    $scope.isLogged = function () {
        return $cookies.token !== "null";
    };

    $scope.cssClasspath = function () {
        return $location.path().substring(1);
    }
});

myApp.controller('AuthController', function ($http, $scope, $cookies, $base64, $location) {
    $scope.auth = function (email, password) {
        $cookies.token = $base64.encode(email + ":" + password);
        $http.defaults.headers.common['Authorization'] = "Basic " + $cookies.token;
        $location.path("/timeline");
    };

    $scope.subscribe = function () {
        $location.path("/subscribe");
    }
});

myApp.controller('SubscribeController', function ($http, $scope, User, $cookies, $base64, $location) {
    $scope.subscribe = function (email, password, name, firstName) {<commit_msg>correct login<commit_after>'use strict';

var target = 'http://eneid-api.herokuapp.com/api/';

myApp.factory('Message', ['$resource', function ($resource) {
    return $resource(target + 'timeline');
}]);
myApp.factory('User', ['$resource', function ($resource) {
    return $resource(target + 'users');
}]);

myApp.controller('TimeLineController', function ($scope, $timeout, Message, $cookies, $route) {
    $scope.currentTimeline = 0;

    $scope.update = function () {
        $scope.messages = Message.query();
        $scope.currentTimeline = $scope.currentTimeline + 1;
        $timeout($scope.update, 10000);
    };

    if (!!$cookies.token) {
        $scope.update();
    }

    $scope.sendMessage = function () {
        new Message({contents: $scope.content}).$save();
        $scope.content = '';
        $route.reload();
    }
});

myApp.controller('LoggedController', function ($scope, $cookies, $location) {
    $scope.disconnect = function () {
        delete $cookies.token;
        $location.path("/auth");
    };

    $scope.isLogged = function () {
        return !!$cookies.token;
    };

    $scope.cssClasspath = function () {
        return $location.path().substring(1);
    }
});

myApp.controller('AuthController', function ($http, $scope, $cookies, $base64, $location) {
    $scope.auth = function (email, password) {
        var token = $base64.encode(email + ":" + password);
        $http.get(target + "timeline", {headers: {"Authorization": "Basic " + token}}).success(function () {
            $cookies.token = token;
            $http.defaults.headers.common['Authorization'] = "Basic " + $cookies.token;
            $location.path("/timeline");
        }).error(function (content, error_code) {
            console.log("error " + error_code + " during logging");
        });
    };

    $scope.subscribe = function () {
        $location.path("/subscribe");
    }
});

myApp.controller('SubscribeController', function ($http, $scope, User, $cookies, $base64, $location) {
    $scope.subscribe = function (email, password, name, firstName) {
{'fraction_non_alphanumeric': 0.18522372528616024, 'fraction_numerical': 0.007284079084287201, 'mean_word_length': 3.2252747252747254, 'pattern_counts': {'":': 3, '<': 3, '<?xml version=': 0, '>': 3, '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': '184749', 'n_tokens_mistral': 1181, 'n_tokens_neox': 1149, 'n_words': 211}