<commit_before>'use strict';

define(['./module', 'darkwallet', 'model/upgrade'], function (controllers, DarkWallet, Upgrade) {
  controllers.controller('ReseedCtrl', ['$scope', 'modals', 'notify', '_Filter', function($scope, modals, notify, _) {
    $scope.reseedIdentity = function() {
        modals.password('Write your password to reseed. EXPERIMENTAL. You can lose all data.', function(password) {
            var identity = DarkWallet.getIdentity();
            try {
                var res = Upgrade(identity.store.store, identity, password);
            } catch(e) {
                if (e.message.slice(0, 4) === "ccm:") {
                    notify.warning('Bad password');
                } else {
                    notify.error('Fatal error!');
                }
                return;
            }
            if (res) {
                if (identity.store.get('version') === 5) {
                    identity.store.save();
                    notify.success('Reseed successfull');
                    $scope.clearAlert();
                } else {
                    notify.warning('Could not finish reseeding');
                }
            } else {
                notify.warning('Could not reseed');
            }
        });
    };

  }]);
});<commit_msg>Reload walletProvider after reseed.<commit_after>'use strict';

define(['./module', 'darkwallet', 'model/upgrade'], function (controllers, DarkWallet, Upgrade) {
  controllers.controller('ReseedCtrl', ['$scope', 'modals', 'notify', '$wallet', '_Filter', function($scope, modals, notify, $wallet, _) {
    $scope.reseedIdentity = function() {
        modals.password('Write your password to reseed. EXPERIMENTAL. You can lose all data.', function(password) {
            var identity = DarkWallet.getIdentity();
            try {
                var res = Upgrade(identity.store.store, identity, password);
            } catch(e) {
                if (e.message.slice(0, 4) === "ccm:") {
                    notify.warning('Bad password');
                } else {
                    notify.error('Fatal error!');
                }
                return;
            }
            if (res) {
                if (identity.store.get('version') === 5) {
                    identity.store.save();
                    $wallet.onIdentityLoaded(identity);
                    notify.success('Reseed successfull');
                    $scope.clearAlert();
                } else {
                    notify.warning('Could not finish reseeding');
                }
            } else {
                notify.warning('Could not reseed');
            }
        });
    };

  }]);
});
{'fraction_non_alphanumeric': 0.14016578749058026, 'fraction_numerical': 0.002260738507912585, 'mean_word_length': 1.5801749271137027, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1344146', 'n_tokens_mistral': 699, 'n_tokens_neox': 662, 'n_words': 144}