<commit_before>'use strict';

angular.
module('sevenWonders.core.auth').
factory('Auth', ['Restangular', '$cookies', '$q',
    function(Restangular, $cookies, $q) {
        return {
            login: function(user) {
                return $q(function(resolve, reject) {
                    Restangular.all('login').post({ userName: user })
                        .then(function(data) {
                            var userModel = {
                                id: data.id,
                                userName: data.userName,
                                isLoggedIn: true,
                                token: data.token
                            };
                            $cookies.putObject('user', userModel);
                            Restangular.setDefaultHeaders({ Authorization: userModel.token });
                            resolve(data);
                        })
                        .catch(function(data) {
                            reject(data);
                        });
                });
            },
            getLoggedUser: function() {
                return $cookies.getObject('user');
            }
        };
    }
]);<commit_msg>modified auth.service.js<commit_after>'use strict';

angular.
module('sevenWonders.core.auth').
factory('Auth', ['Restangular', '$cookies', '$q',
    function(Restangular, $cookies, $q) {
        return {
            login: function(user) {
                return $q(function(resolve, reject) {
                    Restangular.all('login').post({ userName: user })
                        .then(function(data) {
                            var userModel = {
                                id: data.id,
                                userName: data.userName,
                                isLoggedIn: true,
                                token: data.token
                            };
                            $cookies.putObject('user', userModel);
                            resolve(data);
                        })
                        .catch(function(data) {
                            reject(data);
                        });
                });
            },
            getLoggedUser: function() {
                return $cookies.getObject('user');
            }
        };
    }
]);
{'fraction_non_alphanumeric': 0.1132404181184669, 'fraction_numerical': 0.0, 'mean_word_length': 0.9302521008403362, 'pattern_counts': {'":': 0, '<': 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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1884132', 'n_tokens_mistral': 534, 'n_tokens_neox': 509, 'n_words': 84}