<commit_before>/**
 *Adapted from ACRONYM - Code by <NAME> & <NAME> on 11/02/2016.
 */
angular.module('user')
    .service('user.service', ['user.request.factory', 'localStorageService','$location', 'toastr', function(requestHelper, localStorageService, $location, toastr){

        var user = null;

        this.login = function(username, password){
            requestHelper.login(username, password)
                .then(function(data){
                    if(data.data.successful === true){
                        var response = data.data;
                        user = response.result;
                        generateGravatar();
                        saveUser();
                        $location.path('/');
                    }else{
                        if(data.data.message!=null){
                         toastr.error(data.data.message, 'Error');
                        }
                        else{
                            toastr.error("An unknown error has occurred", 'Error');
                        }
                    }
                })
                .catch(function(data){
                    toastr.error('Unable to contact the server.', 'Login Error');
                });
        };

        this.register = function(username, email, password){

            requestHelper.register(username, email, password)
                .then(function(data){

                    if(data.data.successful === true){
                        var response = data.data;
                        user = response.result;
                        // generateGravatar();
                        // saveUser();
                        toastr.success('You can now attempt to login!','Registration Complete')
                        $location.path('/user/login');
                    }else{
                        if(data.data.message!=null){
                         toastr.error(data.data.message, 'Error');
                        }
                        else{
                            toastr.error("An unknown error has occurred", 'Error');
                        }
                    }
                })
                .catch(function(data){
                    toastr.error('Unable to contact the server.', 'Registration Error');
                });
        };

        this.logout = function(){<commit_msg>added missing semicolon to reg data<commit_after>/**
 *Adapted from ACRONYM - Code by <NAME> & <NAME> on 11/02/2016.
 */
angular.module('user')
    .service('user.service', ['user.request.factory', 'localStorageService','$location', 'toastr', function(requestHelper, localStorageService, $location, toastr){

        var user = null;

        this.login = function(username, password){
            requestHelper.login(username, password)
                .then(function(data){
                    if(data.data.successful === true){
                        var response = data.data;
                        user = response.result;
                        generateGravatar();
                        saveUser();
                        $location.path('/');
                    }else{
                        if(data.data.message!=null){
                         toastr.error(data.data.message, 'Error');
                        }
                        else{
                            toastr.error("An unknown error has occurred", 'Error');
                        }
                    }
                })
                .catch(function(data){
                    toastr.error('Unable to contact the server.', 'Login Error');
                });
        };

        this.register = function(username, email, password){

            requestHelper.register(username, email, password)
                .then(function(data){

                    if(data.data.successful === true){
                        var response = data.data;
                        user = response.result;
                        // generateGravatar();
                        // saveUser();
                        toastr.success('You can now attempt to login!','Registration Complete');
                        $location.path('/user/login');
                    }else{
                        if(data.data.message!=null){
                         toastr.error(data.data.message, 'Error');
                        }
                        else{
                            toastr.error("An unknown error has occurred", 'Error');
                        }
                    }
                })
                .catch(function(data){
                    toastr.error('Unable to contact the server.', 'Registration Error');
                });
        };

        this.logout = function(){
{'fraction_non_alphanumeric': 0.11380557328228036, 'fraction_numerical': 0.0034035311635822164, 'mean_word_length': 1.0991071428571428, 'pattern_counts': {'":': 0, '<': 7, '<?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': '7237324', 'n_tokens_mistral': 1086, 'n_tokens_neox': 997, 'n_words': 210}