<commit_before>'use strict';

(function () {
    angular
        .module('dailyMummApp')
        .controller('ProfileCtrl', ProfileController);

    ProfileController.$inject = ['$scope', '$rootScope', 'AuthService', '$state', '$timeout', 'UserService'];

    function ProfileController($scope, $rootScope, AuthService, $state, $timeout, UserService) {
        var vm = this;

        if (!AuthService.isLoggedIn()) {
            $state.go('home');
        } else {
            $state.go('profile.view');
        }

        vm.changePassword = false;

        vm.showChangePasswordPanel = showChangePasswordPanel;
        vm.saveChangePassword = saveChangePassword;
        vm.cancelChangePassword = cancelChangePassword;
        vm.saveBasicInfo = saveBasicInfo;
        vm.discardBasicInfo = discardBasicInfo;
        vm.userData = AuthService.getCurrentUserInfo();
        vm.userTempData = angular.copy(vm.userData);

        function showChangePasswordPanel() {
            vm.changePassword = true;
        }

        function saveChangePassword() {
            vm.changePassword = false;
        }

        function cancelChangePassword() {
            vm.changePassword = false;
        }

        function saveBasicInfo() {
            UserService.updateUserBasicInfo(vm.userTempData, function(data) {
                if(data.success){
                    vm.userData = angular.copy(vm.userTempData);
                    AuthService.setCredintials(vm.userTempData);
                }
            })
         }

        function discardBasicInfo() {
            vm.userTempData = angular.copy(vm.userData);
        }<commit_msg>Switching back to profile view after save<commit_after>'use strict';

(function () {
    angular
        .module('dailyMummApp')
        .controller('ProfileCtrl', ProfileController);

    ProfileController.$inject = ['$scope', '$rootScope', 'AuthService', '$state', '$timeout', 'UserService'];

    function ProfileController($scope, $rootScope, AuthService, $state, $timeout, UserService) {
        var vm = this;

        if (!AuthService.isLoggedIn()) {
            $state.go('home');
        } else {
            $state.go('profile.view');
        }

        vm.changePassword = false;

        vm.showChangePasswordPanel = showChangePasswordPanel;
        vm.saveChangePassword = <PASSWORD>;
        vm.cancelChangePassword = cancelChangePassword;
        vm.saveBasicInfo = saveBasicInfo;
        vm.discardBasicInfo = discardBasicInfo;
        vm.userData = AuthService.getCurrentUserInfo();
        vm.userTempData = angular.copy(vm.userData);

        function showChangePasswordPanel() {
            vm.changePassword = true;
        }

        function saveChangePassword() {
            vm.changePassword = false;
        }

        function cancelChangePassword() {
            vm.changePassword = false;
        }

        function saveBasicInfo() {
            UserService.updateUserBasicInfo(vm.userTempData, function(data) {
                if(data.success){
                    vm.userData = angular.copy(vm.userTempData);
                    AuthService.setCredintials(vm.userTempData);
                    $state.go('profile.view');
                }
            })
         }

        function discardBasicInfo() {
            vm.userTempData = angular.copy(vm.userData);
        }
{'fraction_non_alphanumeric': 0.11141060197663971, 'fraction_numerical': 0.0, 'mean_word_length': 2.1273408239700373, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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': '7372747', 'n_tokens_mistral': 882, 'n_tokens_neox': 847, 'n_words': 145}